首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >openapi生成器-maven插件生成带有格式的AsciiDoc描述

openapi生成器-maven插件生成带有格式的AsciiDoc描述
EN

Stack Overflow用户
提问于 2022-02-03 09:34:55
回答 1查看 481关注 0票数 0

我正在使用openapi生成器-maven-插件5.4.0版本将我的OpenAPI.json文件转换为AsciiDoc。在我的OpenApi.json规范中,我为path参数描述设置了一些格式:

"TestDescription \n Line2 TestDescription",

但是AsciiDoc生成器输出它时不需要格式化:

TestDescription Line2 TestDescription

有办法保留我的格式吗?

我如何使用插件:

代码语言:javascript
运行
复制
           <plugin>
              <groupId>org.openapitools</groupId>
              <artifactId>openapi-generator-maven-plugin</artifactId>
              <version>5.4.0</version>
              <executions>
                 <execution>
                    <goals>
                       <goal>generate</goal>
                    </goals>
                    <configuration>
                       <inputSpec>openapi.json</inputSpec>
                       <generatorName>asciidoc</generatorName>
                       <skipValidateSpec>true</skipValidateSpec>
                       <configOptions>
                          <useIntroduction>true</useIntroduction>
                          <useMethodAndPath>true</useMethodAndPath>
                          <useTableTitles>true</useTableTitles>
                       </configOptions>
                       <output>output</output>
                    </configuration>
                 </execution>
              </executions>
           </plugin>

我的openapi.json文件:

代码语言:javascript
运行
复制
{
    "openapi": "3.0.1",
    "info": {
        "title": "TestOpenAPI",
        "description": "Testdescription",
        "version": "1.2.3"
    },
    "servers": [
        {
            "url": "http://TestServer"
        }
    ],
    "tags": [
        {
            "name": "testTag",
            "description": "TestDescription"
        }
    ],
    "paths": {
        "/texts": {
            "get": {
                "tags": [
                    "TestTag1"
                ],
                "operationId": "testOperation",
                "parameters": [
                    {
                        "name": "testName",
                        "in": "query",
                        "description": "TestDescription \n Line2 TestDescription",
                        "required": true,
                        "schema": {
                            "pattern": "^(([a-z]{2}_[A-Z]{2})+,){0,9}([a-z]{2}_[A-Z]{2}){1}$",
                            "type": "string",
                            "description": "TestDescription \n Line2 TestDescription"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "*/*": {
                                "schema": {
                                    "oneOf": [
                                        {
                                            "$ref": "#/components/schemas/test"
                                        },
                                        {
                                            "$ref": "#/components/schemas/test2"
                                        }
                                    ]
                                }
                            }
                        }
                    }
                }
            }
        },
        "components": {
            "schemas": {
                "test": {
                    "type": "object",
                    "properties": {
                        "texts": {
                            "type": "array",
                            "xml": {
                                "name": "text"
                            },
                            "items": {
                                "$ref": "#/components/schemas/test"
                            }
                        }
                    },
                    "xml": {
                        "name": "texts"
                    }
                },
                "TextType": {
                    "required": [],
                    "type": "object",
                    "properties": {
                        "key": {
                            "type": "string",
                            "description": "The key of the text"
                        },
                        "value": {
                            "type": "string",
                            "description": "The value of the text"
                        },
                        "category": {
                            "type": "string",
                            "description": "The category of the text"
                        },
                        "language": {
                            "maxLength": 5,
                            "minLength": 5,
                            "pattern": "[a-z]{2}_[A-Z]{2}",
                            "type": "string",
                            "description": "TestDescription \n Line2 TestDescription"
                        }
                    }
                }
            }
        }
    }
}
EN

回答 1

Stack Overflow用户

发布于 2022-02-03 17:22:09

OpenApi支持MarkDown语法来呈现富文本.例如:

代码语言:javascript
运行
复制
description: |
    # Title with *italics*
    Next line
    Some **bold** comments

(请参阅更多这里)

现在的问题是:当遇到这样的标记时,OpenapiTools插件将如何表现.

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70968832

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档