[BUG] exclusiveMinimum and exclusiveMaximum should be boolean
See original GitHub issueDescribe the bug exclusiveMinimum and exclusiveMaximum should be of type boolean
To Reproduce A field with greater than property is generated as:
end:
exclusiveMinimum: 0.0
type: number
Expected behavior
It should be:
end:
exclusiveMinimum: true
minimum: 0.0
type: number
Environment:
- OS: Linux and macOS
- FastAPI version 0.22.0
- Python version 3.7
Additional context According to OpenAPI, these fields should be boolean as listed here.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Why are exclusiveMinimum and exclusiveMaximum keywords ...
If maximum is present but not exclusiveMaximum , it MAY be considered that the exclusiveMaximum keyword value is boolean false. This implies ...
Read more >tiangolo/fastapi - Gitter
The value of "exclusiveMinimum" MUST be number, representing an exclusive lower limit for a numeric instance. If the instance is a number, then...
Read more >Number type | Opis JSON Schema
Value of this keyword must be a number (integer or float) or a boolean. Schema. { "type": "number", "exclusiveMinimum": 10.5 }.
Read more >draft-handrews-json-schema-validation-02 - IETF Datatracker
String values MUST be one of the six primitive types ("null", "boolean", "object", ... exclusiveMaximum The value of "exclusiveMaximum" MUST be number, ...
Read more >$jsonSchema — MongoDB Manual
Keyword Type Definition
additionalItems arrays boolean or object
additionalProperties objects boolean or object
allOf all types array of JSON Schema objects
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Is there already a way to generate an OpenAPI 3.1 json, that can be imported into https://editor.swagger.io/, so one can generate a client from the fastAPI without having to fix this problems manually?
I’ve also run into this and did some heavy investigation into it in collaboration with @Stranger6667 yesterday to make sure that it’s indeed a bug in FastAPI/pydantic and not schemathesis. Was going to post it as an issue here but now I see that there already is one.
From our investigations it was clear that the spec for OpenAPI 3.0.x which uses draft 4/json-schema-00 is to use an integer for exclusiveM… and not a boolean combined with minimum/maximum. However, the next version which is still WIP (OAS v3.1.0) will use the newer JSON-Schema version and be compliant with current behaviour. So it would probably be wise to keep the current behaviour behind a feature toggle or similar for when that is live.
References