Swagger UI 未显示响应示例

Gar*_*yle 6 swagger-ui swagger-2.0

在使用 swagger-editor 时,我创建了以下 YAML,其中显示了响应对象的示例。它在 swagger-editor 中正确显示。当我下载 JSON 并将其显示在 swagger-ui 中时,该示例完全丢失了。

/person/{email}/create:
  post:
    summary: Create a new account
    tags:
      - Person
    parameters:
      ...
    responses:
      201:
        description: The new SQL ident and sport details 
        examples:
          application/json: |
            [
              12,
              [
                {
                  "sql_idnet" : 12,
                  "name" : "Basketball"
                },
                {
                  "sql_ident" : 13,
                  "name" : "Ice Hockey"
                }
              ]
            ]
Run Code Online (Sandbox Code Playgroud)

Hel*_*len 2

可能是因为响应没有schema- 在 Swagger 中,这意味着响应没有正文。

也就是说,Swagger UI 3.0 可以正确显示此示例。

Swagger UI 中的 JSON 响应示例