tiangolo / fastapi

FastAPI framework, high performance, easy to learn, fast to code, ready for production
https://fastapi.tiangolo.com/
MIT License
73.34k stars 6.18k forks source link

🐛 Allow_inf_nan option for Param subclasses #11579

Open pat-lasswell opened 1 month ago

pat-lasswell commented 1 month ago

There was a typo in the __init__ method of the Param class which misnamed the allow_inf_nan option in the kwargs passed to the underlying Pydantic FieldInfo initializer. This resulted in the validator failing to enforce the constraint, and hence inf and nan values were being passed to the route handler when they should not have.

See https://github.com/tiangolo/fastapi/discussions/11577 for the original question.

Kludex commented 1 month ago
pat-lasswell commented 1 month ago

I just noticed that I put the test file in the root rather in the tests directory. I pushed a commit to fix that.