swagger - 未应用 Swagger OAS 3.0 中的独有最小值
问题描述
Swagger Editor 给了我这个示例响应:
[
{
"simulation_run_id": 0
}
]
定义:
/v1/simulation-run-submissions:
post:
summary: 'Post a simulation run creation TODO: Will need to update API with parameters weather file, glmfile, name, start,end,interval, etc.. check wireframe. Submit model file and get back validation and ID. We will use the same API above and just return validation error.'
#description:
responses:
'201':
description: The metadata for a simulation run
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/SimulationRunSubmissionResponse'
...
components:
schemas:
SimulationRunId:
type : integer
format: int64
minimum: 1
exclusiveMinimum: true
该exclusiveMinimum
选项似乎不适用于架构,因为示例显示为 0。
解决方案
目前 Swagger UI 和 Swagger Editor在生成请求和响应示例时不使用minimum
和值。exclusiveMinimum
随时提交增强请求。
最简单的解决方案是example
手动指定:
components:
schemas:
SimulationRunId:
type : integer
format: int64
minimum: 1
exclusiveMinimum: true
example: 2 # <-------
推荐阅读
- mysql - 在mysql中显示相同orderNo的下一行总列中上一行的余额列数据
- actions-on-google - 我应该为热泵使用哪些设备类型/特性?
- cumulocity - 删除由片段名称选择的许多托管对象
- docker - Docker,ENOENT:没有这样的文件或目录
- cuda - CUDA 扫描伪代码错误?
- android - 把recyclerview放在recyclerview里面好不好?
- flutter - 通过网络加载 Fluter/Dart 代码
- java - 在线程池中查找活动线程的名称:Java 中的 ExecutorService
- javascript - 如何调整 Box 的大小,打开第 3 层?
- c# - 尝试连接到 MS Dynamics 365 时应在 appSettings 中提供的链接是什么