I have an API response which adheres to json-api spec of application/vnd.api+json. The response looks like this:

{
  "jsonapi": {
    "version": "1.0"
  },
  "data": {
    "type": "drawDate",
    "id": "1",
    "attributes": {
      "schoolStartDate": "2019-01-02T00:00:00.000Z"
    }
  }
}

However, in Swagger UI under "Responses", where the model is specified, the response example is displayed as follows, which is different from the actual response:

[
{
  "schoolStartDate": "2019-01-02T00:00:00.000Z"
}
]

I tried adding content type of application/vnd.api+json for the GET content property, but this did not help:

responses:
 *       200:
 *         description: Gets school list
 *         content:
 *           application/vnd.api+json:
 *               schema:
 *                 type: array
 *                 items:
 *                    $ref: '#...'

How to make the response example value in Swagger UI match the actual API response?

0

There are 0 best solutions below