-
Notifications
You must be signed in to change notification settings - Fork 34
Description
OpenAPI 3.1.0 changed the type of exclusiveMinimum and exclusiveMaximum from boolean properties to numbers. This spec should be valid under OpenAPI 3.1.0:
{
"openapi": "3.1.0",
"info": {
"title": "Sample API",
"description": "description",
"version": "0.0.1"
},
"servers": [
{
"url": "http://api.example.com/v1",
"description": "Optional server description, e.g. Main (production) server"
}
],
"paths": {
"/test": {
"post": {
"summary": "Post a number.",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"num": {
"type": "number",
"exclusiveMaximum": 100,
"exclusiveMinimum": 0
}
}
}
}
}
},
"responses": {
"200": {
"description": "A number",
"content": {
"application/json": {
"schema": {
"type": "number"
}
}
}
}
}
}
}
}
}But when I try to run the mock server (with version 2.0), I get:
[FATAL] Error while mocking schema: Expected a value of type
undefined | {parameters,responses,requestBody}for/test.postbut received{"summary":"Post a number.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"num":{"type":"number","exclusiveMaximum":100,"exclusiveMinimum":0,"nullable":false,"readOnly":false,"writeOnly":false,"deprecated":false}},"nullable":false,"readOnly":false,"writeOnly":false,"deprecated":false}}}},"responses":{"200":{"description":"A number","content":{"application/json":{"schema":{"type":"number","nullable":false,"readOnly":false,"writeOnly":false,"deprecated":false}}}}}}. in paths./test.post
Changing exclusiveMinimum and exclusiveMaximum to minimum and maximum fixes the error, but preferably this would be supported by the mock server, since it is a valid spec. If openAPI 3.1.0 is not supported, a clearer error message would also be helpful.