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
'exclusiveMaximum': inf probably shouldn't appear in model schema #1417
Comments
'exclusiveMaximum': inf
probably shouldn't appear in model schema
Happy to accept a pr to fix this. I agree it should be omitted.
You could probably achieve the same thing with a validator and avoid anything begging added to the schema, though it might be less elegant. |
This issue is really the definition of an edge case haha. Happy to make any changes you suggest. |
@samuelcolvin any reason not to use the json equivalent value Infinity ?
|
very good point, we should. |
As noted in the PR (#1422 (comment)), |
@chris-allnutt Where it gets really confusing is that |
I had just imagine the python-ideas thread where someone said " |
Closed by #1422 |
What about |
Bug
Output of
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
:Example code:
The
inf
is not json-compliant:However, json-compliant strings cannot include
inf
anyway, so the presence of'exclusiveMaximum': inf
(or conversely,'exclusiveMinimum': -inf
) in the schema seems to be a bug.Note that the reason that I have
lt=math.inf
in the first place is because I am trying to limit myfloat to real-valued floats. Perhaps pydantic provides a better way to do this?The text was updated successfully, but these errors were encountered: