0

我有一个符合 json-api 规范的 API 响应application/vnd.api+json。响应如下所示:

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

但是,在“Responses”下的 Swagger UI 中,指定了模型的地方,响应示例显示如下,与实际响应不同:

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

我尝试application/vnd.api+json为 GETcontent属性添加内容类型,但这没有帮助:

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

如何使 Swagger UI 中的响应示例值与实际 API 响应匹配?

4

0 回答 0