swagger - Springfox:带标题的描述
问题描述
我们如何在描述中获得多个标题,如下所示:
description: |
The Engine API ....
# Errors
The API uses standard HTTP status codes ...
# Versioning
Some other text
在上面的示例中,错误和版本控制是两个标头。
目前,我正在添加如下描述:
ApiInfoBuilder().description(" ... ")
解决方案
你可以像这样使用降价:
String description = "# The Engine API ...\n" +
"## Errors\n" +
"The API uses standard HTTP status codes ...\n" +
"## Versioning\n" +
"Some other text\n";
新\n
线在这里很重要。
或者干脆使用纯 HTML:
String description = "<h2>The Engine API ....</h2>" +
"<h3>Errors</h3>" +
"<p>The API uses standard HTTP status codes ...</p>" +
"<h3>Versioning</h3>" +
"<p>Some other text</p>";
然后将字符串添加到 API 信息中:
ApiInfoBuilder().description(description)
推荐阅读
- vue.js - 我应该将“链接”放在 .vue 文件中的什么位置?
- css - 什么是抵消
- Edge 浏览器中的标签,这不是 chrome
- php - 从字符串中提取大写单词
- python-3.x - 使用三元运算符有条件地合并字典
- sql - 我收到错误“SQL 错误:ORA-01427
- javascript - 如何为“鼠标悬停”上播放()视频的页面上的每个视频添加叠加按钮?
- docker - 找不到配置选项的 docker 卷
- swift - 我可以在枚举中使用委托吗?(迅速)
- python - 从字符串python中提取年龄
- tensorboard - 什么是 hp.Discrete 和 hp.Realinterval?我可以在 hp.realinterval 中包含更多值而不仅仅是 2 吗?