Repository navigation
Conversation
semohr
force-pushed
the
simplify_validate_querystring_syntax
branch
from
September 8, 2026 22:11
999b328 to
2e78741
Compare
Contributor
Author
|
@pgjones Short ping for visibility. Was thinking this is a good addition as it simplifies this quite common usecase imo. |
This branch has not been deployed
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.
validate_querystringonly produces a list when a key occurs more than once. For a field declared aslist[int], a client sending a one-item array gets a 400 instead of[1].This PR enhances
validate_querystringto treat a single occurrence of a parameter declared as a list as a one-element list, based on the model's annotations. It works for all model kinds and keeps the existing[]suffix and repeated forms working.The following requests are now treated equally:
Details
Before, accepting a single value for a list field required special pydantic syntax (a ``BeforeValidator`` per field), which is now unnecessary (also wasnt really possible with msgspec):