Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specification OpenAPI - Field (exclusiveMinimum, exclusiveMaximum) #3541

Closed
carlos-rian opened this issue Jul 16, 2021 · 5 comments
Closed
Labels
question Question or problem question-migrate

Comments

@carlos-rian
Copy link

Spec Bug

I'm creating my documentation using "FastAPI". I'm having trouble importing the generated schema into Azure API Management. Because when I use the "gt" argument in the "Query" object, it defines the exclusiveMinimum field, in the OpenAPI documentation, this field is a boolean, but in FastAPI it is defined with Integer!

Spec OpenAPI:

Schema OpenAPI FastAPI

image

FastAPI Query

image

FastAPI Docs

image

@carlos-rian carlos-rian added the question Question or problem label Jul 16, 2021
@juanbeniteza
Copy link

I found this is a Pydantic issue.

It seems it depends on the version of JSONSchema the OpenAPI is targeting.

@carlos-rian
Copy link
Author

@JuanBenitezDev I understand, but I found that Spec OpenAPI V2 is also Boolean.

https://github.com/OAI/OpenAPI-Specification/blob/main/schemas/v2.0/schema.json
http://json-schema.org/draft-04/schema#

image

@juanbeniteza
Copy link

@carlos-rian Yeah I know, but Pydantic is generating schemas that are compliant with the last versions of the specifications. You can see that here

The last version of OpenAPI at the time I'm writing this is 3.1. This new version is based on the JSON Schema Draft 2020-12, here the exclusiveMinimum and exclusiveMaximum are numbers, you can see them here

image

You can even check what are the things changing from OpenAPI v3 to v3.1 here

My guess is that Azure API Management is expecting a specific OpenAPI version.

@Alexander-N
Copy link

See #240 for more discussion. As workaround you could use ge instead of gt, e.g.

Query(..., ge=11)

instead of

Query(..., gt=10)

@carlos-rian
Copy link
Author

@JuanBenitezDev I understand, it´s makes sense. Thanks you!

Hi @Alexander-N. Yes. I've seen some discussions about this. I solved the problem using ge. But I thought it was a bug in Pydantic. Thanks!

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Question or problem question-migrate
Projects
None yet
Development

No branches or pull requests

4 participants