我最近更新了运行 springfox-swagger2 和 springfox-swagger-ui 2.5.0 的应用程序以使用版本 2.6.0。应用程序的API文档使用<li>
, <b>
and <br>
标签,在 2.5.0 中可以正确呈现,但在 2.6.0 版本中<li>
and <br>
swagger-ui 会忽略标签。
我需要做什么才能让 springfox 再次渲染 HTML 标签?
标签用于以下位置:
ApiInfoBuilder().description("HERE")
@ApiOperation(notes="HERE")
@ApiResponse(message="HERE")
尝试后@ApiOperation
注解我发现在2.7.0版本中SpringFox支持Markdown https://guides.github.com/features/mastering-markdown/文本格式的语法(就像 Stack Overflow、GitHub、Atlassian 等)。请参阅任何 Markdown 语法指南以供参考。
我的实验表明,这个 Swagger 注释和下面的 YAML 定义应该是等效的。
@ApiOperation(value = "Markdown in Swagger API descriptions",
notes = "#Head 1 \n## Head 2 \n###Sorting rules\nThe data is sorted by priority (from the highest to the lowest).<br/> Unordered list \n * item 1.\n * <b>bold item 2</b>\n")
=
summary: Markdown in Swagger API descriptions
description: <h1>Head 1</h1><h2>Head 2</h2><h3>Sorting rules</h3>
The data is sorted by priority (from the highest to the lowest).<br/> Unordered list
<ul><li>item 1.</li><li><b>bold item 2</b></li></ul>
并且注释在 Swagger-UI 中生成此输出
我需要做什么才能让 SpringFox 再次渲染 HTML 标签?
您必须将 API 描述翻译为 Markdown。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)