Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Swagger UI not showing responses examples

While using swagger-editor I create the below YAML that shows an example of the response object. It's properly displaying in the swagger-editor. When I then download the JSON and display it in swagger-ui, the example is completely missing.

/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"
                }
              ]
            ]
like image 275
Gargoyle Avatar asked Jan 27 '17 23:01

Gargoyle


People also ask

How do you get Swagger response time?

Using swagger: In Chrome, open the tools (F12). Bring up the network tab and watch the request. Compare the time instant when the request is completed and the page is displayed.


1 Answers

This might be because the response does not have a schema - in Swagger this means the response does not have a body.

That said, Swagger UI 3.0 displays this example correctly.

JSON response example in Swagger UI

like image 132
Helen Avatar answered Oct 14 '22 21:10

Helen