Springfox:带标题的描述

问题描述 投票:0回答:1

我们如何在描述中获得多个标题,如下所示:

description: |
The Engine API  ....

# Errors

The API uses standard HTTP status codes ...


# Versioning

Some other text

在上面的示例中,错误和版本控制是两个标头。

当前,我正在添加如下描述:

ApiInfoBuilder().description(" ... ")
swagger springfox
1个回答
0
投票

您可以像这样使用markdown:

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)
© www.soinside.com 2019 - 2024. All rights reserved.