-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Query fields with numeric types appear not to enforce allow_inf_nan=False, whereas gt=0, etc are enforced #11580
Closed
9 tasks done
Closed
9 tasks done
Labels
bug
Something isn't working
Comments
Kludex
added
bug
Something isn't working
and removed
question
Question or problem
labels
May 15, 2024
I made a PR for that at #11867 |
This was
linked to
pull requests
Aug 19, 2024
xiaoxiaoimg
pushed a commit
to xiaoxiaoimg/fastapi
that referenced
this issue
Aug 22, 2024
xiaoxiaoimg
pushed a commit
to xiaoxiaoimg/fastapi
that referenced
this issue
Aug 22, 2024
xiaoxiaoimg
pushed a commit
to xiaoxiaoimg/fastapi
that referenced
this issue
Aug 22, 2024
This should be solved by #11867, the fix will be available in FastAPI |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Discussed in #11577
Originally posted by pat-lasswell May 14, 2024
First Check
Commit to Help
Example Code
Description
I would expect the
allow_inf_nan
parameter toQuery
to restrict valid values in the same way thatgt
, etc do, resulting in a HTTP 422 status code when the constraint is violated. Instead,inf
andnan
values are passed to the route handler.To reproduce, save the example code above in the current directory in a file named
bug.py
, thenand in the bash prompt inside the container
The output will be similar to
The expected response is
Operating System
Linux
Operating System Details
No response
FastAPI Version
0.111.0
Pydantic Version
2.7.1
Python Version
3.10.14
Additional Context
No response
The text was updated successfully, but these errors were encountered: