We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
unique_items validation breaks optional lists when None is passed as a value.
unique_items
None
from typing import Any, Optional from pydantic import BaseModel, conlist class Model(BaseModel): prop: Optional[conlist(Any, unique_items=True)] m = Model(prop=None) #> pydantic.error_wrappers.ValidationError: 1 validation error for Model #> prop #> 'NoneType' object is not iterable (type=type_error)
pydantic version: 2.0.0.dev0 install path: C:\repos_me\ppp\pydantic\pydantic python version: 3.9.8 (tags/v3.9.8:bb3fdcf, Nov 5 2021, 20:48:33) [MSC v.1929 64 bit (AMD64)] platform: Windows-10-10.0.19044 optional deps. installed: ['email-validator', 'typing-extensions']
.dict()
.json()
construct()
The text was updated successfully, but these errors were encountered:
Fixed by #4568
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Initial Checks
Description
unique_items
validation breaks optional lists whenNone
is passed as a value.Example Code
Python, Pydantic & OS Version
Affected Components
.dict()
and.json()
construct()
, pickling, private attributes, ORM modeThe text was updated successfully, but these errors were encountered: