api - Swagger 错误 - 应该只有三位数的状态码
问题描述
我正在为 Swagger Editor 中的 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”之前
可能是什么问题?状态码明显是三位数的代码
谢谢
解决方案
X-Rate-Limit
需要缩进到headers
:
responses:
'200':
description: ...
headers:
X-Rate-Limit:
description: calls per hour allowed by the user
schema:
type: integer
format: int32
推荐阅读
- html - 如何在rails上打印ruby中的每一行
- python - 如何使用 WIDF 算法处理数据集文档 (CSV)
- json - JSON 序列化性能问题 Web API
- javascript - 如何在 react native 或 js 中从 base64 字符串或文件 uri 或 bytearray 获取实际文件类型?
- angular - Angular 将对象数组传递给 html ngFor 问题
- mysql - SQL获取产品类别的总卖家
- flutter - watch(provider) 是否更新父窗口小部件的子窗口?
- android - 如何在Android中设计javaBean
- java - 如何将 JSON 文件读入 avro mapreduce?
- postgresql - 查询在 postgresql 中没有结果数据的目的地