2

examples応答のセクションの形式を理解するのに本当に苦労しています。500 Internal Sever エラーに対して定義された次の応答があります。

500InternalServerError:
    description: The server encountered an unexpected condition which prevented it from fulfilling the request
    schema:
      allOf:
        - $ref: '#/definitions/Failure'
    headers:
      X-Rate-Limit-Limit:
        description: The number of allowed requests in the current period
        type: integer
      X-Rate-Limit-Remaining:
        description: The number of remaining requests in the current period
        type: integer
      X-Rate-Limit-Reset:
        description: The number of seconds left in the current period
        type: integer
    examples:
      application/json:
        code: -1
        message: The server encountered an unexpected condition which prevented it from fulfilling the request

swagger-ui にロードすると、次のようになります。

Json レスポンス形式

応答を複数行にわたってフォーマットして、次のようにするにはどうすればよいですか?:

{
  "code": "-1",
  "message": "The server encountered an unexpected condition which prevented it from fulfilling the request"
}
4

1 に答える 1