Swagger OAS 3.0 中的 exclusiveMinimum 未应用
exclusiveMinimum in Swagger OAS 3.0 not applied
Swagger 编辑器给我这个示例响应:
[
{
"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
值。随意 submit an enhancement request.
最简单的解决方案是手动指定 example
:
components:
schemas:
SimulationRunId:
type : integer
format: int64
minimum: 1
exclusiveMinimum: true
example: 2 # <-------
Swagger 编辑器给我这个示例响应:
[
{
"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
值。随意 submit an enhancement request.
最简单的解决方案是手动指定 example
:
components:
schemas:
SimulationRunId:
type : integer
format: int64
minimum: 1
exclusiveMinimum: true
example: 2 # <-------