🐛 Allow_inf_nan option for Param subclasses#11579
Closed
pat-lasswell wants to merge 3 commits intofastapi:masterfrom
Closed
🐛 Allow_inf_nan option for Param subclasses#11579pat-lasswell wants to merge 3 commits intofastapi:masterfrom
pat-lasswell wants to merge 3 commits intofastapi:masterfrom
Conversation
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 being passed to the route handler where they should not have.
Kludex
approved these changes
May 15, 2024
Author
|
I just noticed that I put the test file in the root rather in the |
9 tasks
Member
|
Thanks for the bug report and the fix, @pat-lasswell! Appreciate the detailed explanation in the original discussion and the extensive unit tests that you added here. While this fix seems right, the newer PR #11867 covers a similar issue with |
Member
|
Thanks for your contribution @pat-lasswell! 🚀 And thanks for the help here everyone. ☕ This was covered in #11867, so I'll close this one now, but thanks for the effort! 🍰 It will be available in FastAPI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 #11577 for the original question.