我正在使用openapi生成器-maven-插件5.4.0版本将我的OpenAPI.json文件转换为AsciiDoc。在我的OpenApi.json规范中,我为path参数描述设置了一些格式:
"TestDescription \n Line2 TestDescription",
但是AsciiDoc生成器输出它时不需要格式化:
TestDescription Line2 TestDescription
有办法保留我的格式吗?
我如何使用插件:
<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文件:
{
"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"
}
}
}
}
}
}
}发布于 2022-02-03 17:22:09
OpenApi支持MarkDown语法来呈现富文本.例如:
description: |
# Title with *italics*
Next line
Some **bold** comments(请参阅更多这里)
现在的问题是:当遇到这样的标记时,OpenapiTools插件将如何表现.
https://stackoverflow.com/questions/70968832
复制相似问题