Swagger错误-应该只有三位数的状态代码

问题描述 投票:0回答:1

我正在Swagger编辑器中为API构建Swagger文档,并且出现此错误:

should only have three-digit status codes, `default`, and vendor extensions (`x-*`) as properties

这是招摇代码:

/stareMesaj:
    post:
      tags:
        - Metode disponibile
      summary: Stare mesaj
      description: Call de upload mesaj. More soon.
      operationId: stareMesaj
      responses:
        '200':
          description: 1.Ultimele 60 zile -  Nu aveti drept de interogare stare pentru
            mesaj/ 2.Mai mult de 60 zile -  Formularul cu id de incarcare= xxx a
            fost depus de mai mult de 60 de zile 3. Id maxim -  Nu aveti drept
            de interogare stare pentru mesaj= max id
          headers:
        X-Rate-Limit:
          description: calls per hour allowed by the user
          schema:
            type: integer
            format: int32

错误出现在此行上:

responses:

仅在'200'之前

可能是什么问题?状态代码显然是三位数代码

谢谢

api swagger swagger-editor
1个回答
0
投票

[X-Rate-Limit需要在headers的右边缩进:

      responses:
        '200':
          description: ...
          headers:
            X-Rate-Limit:
              description: calls per hour allowed by the user
              schema:
                type: integer
                format: int32
© www.soinside.com 2019 - 2024. All rights reserved.