Allows Optional lists with unique_items check#4568
Allows Optional lists with unique_items check#4568samuelcolvin merged 1 commit intopydantic:1.10.X-fixesfrom
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 |
samuelcolvin
left a comment
There was a problem hiding this comment.
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_itemswith anOptional[List[T]]field, the field validator would raise the following error if the field was not provided:Updating the validator to return
Nonein these cases avoids the issue.Fixes #3957, fix #4050, fix #4119