question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] exclusiveMinimum and exclusiveMaximum should be boolean

See original GitHub issue

Describe 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:open
  • Created 4 years ago
  • Reactions:14
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
domiko96commented, May 25, 2021

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?

5reactions
Hultnercommented, Apr 15, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found