如何让 Swagger 在生成的 HTML 中放置新行(在 Swagger UI 页面中)?
How to make Swagger put new line in the generated HTML (in Swagger UI page)?
我有一个带有注释的 REST 服务方法
io.swagger.annotations.ApiOperation
@ApiOperation(value = "some string")
我需要 some string
在 HTML 页面中生成换行符 swagger-ui.html
(即在 Swagger UI 页面中我可以看到我的文档并且可以测试我的 API 方法)。
我尝试将 <br/>
和 \n
放在 some string
中,以及我能想到的任何东西,
以及我在 SO 上可以找到的任何建议……但没有任何效果。
有什么想法吗?还是根本不可能?
我看到该项目使用 Swagger 1.5.20 JAR。
那个版本我不能改变。
swagger-annotations-1.5.20.jar
swagger-models-1.5.20.jar
恐怕您不能将换行符放入摘要字段而不是描述字段。查看 Swagger 团队成员的评论:Swagger UI ignores line breaks in description
The summary
field is displayed as a single line because the summary text is inside of a <span>
element. Being an inline element, the span ignores \n
characters.
Further, your <br>
is not showing up because the summary
field is a simple string field, as opposed to description
, which is a Markdown field ...
我有一个带有注释的 REST 服务方法
io.swagger.annotations.ApiOperation
@ApiOperation(value = "some string")
我需要 some string
在 HTML 页面中生成换行符 swagger-ui.html
(即在 Swagger UI 页面中我可以看到我的文档并且可以测试我的 API 方法)。
我尝试将 <br/>
和 \n
放在 some string
中,以及我能想到的任何东西,
以及我在 SO 上可以找到的任何建议……但没有任何效果。
有什么想法吗?还是根本不可能?
我看到该项目使用 Swagger 1.5.20 JAR。
那个版本我不能改变。
swagger-annotations-1.5.20.jar
swagger-models-1.5.20.jar
恐怕您不能将换行符放入摘要字段而不是描述字段。查看 Swagger 团队成员的评论:Swagger UI ignores line breaks in description
The
summary
field is displayed as a single line because the summary text is inside of a<span>
element. Being an inline element, the span ignores\n
characters.Further, your
<br>
is not showing up because thesummary
field is a simple string field, as opposed todescription
, which is a Markdown field ...