-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Allows Optional lists with unique_items check #4568
Conversation
When using `unique_items` with an `Optional[List[T]]` field, the field validator would raise the following error if the field was not provided: > `'NoneType' object is not iterable (type=type_error)` Updating the validator to return `None` in these cases avoids the issue. Fixes pydantic#3957, pydantic#4050, pydantic#4119
db257ed
to
3ba804e
Compare
Thanks @mfulgo for this PR 👍 The fix LGTM But, As it was a problem before and has not been introduced in @samuelcolvin What do you think? |
I hear that, but I expect that folks will depend on 1.10.x for a while before being able to switch to V2. So bug fixes to this branch (and you could cherry pick this commit to 1.9.x) seem like a good thing to me. In any case, thanks for y'alls efforts and consideration! |
Thank you so much for this PR! We'd love to get this merged soon. Just adding some ❤️ and open source downstream customer 😄 . |
Please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hear that, but I expect that folks will depend on 1.10.x for a while before being able to switch to V2.
reluctantly, i think I agree with you.
I'm happy with this, @PrettyWood and @hramezani please confirm you're happy with this (or just merge if you are).
Fine for me |
thanks so much @mfulgo. |
When is v1.10.3 expected to be released? |
I'll try work on next week, any help with #4552 would be VERY MUCH appreciated and would help get the release out asap. |
When using
unique_items
with anOptional[List[T]]
field, the field validator would raise the following error if the field was not provided:Updating the validator to return
None
in these cases avoids the issue.Fixes #3957, fix #4050, fix #4119