-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
Can't validate UNSET from json dumped model #165
Comments
Ops... githubkit has already added a custom validation function for the Unset type. This seems not working. |
Hi, i just reproduce the example. To convert a model into a jsonable dict (json mode), you should use: from githubkit.utils import UNSET
from githubkit.typing import Missing
from githubkit.compat import GitHubModel
class TestModel(GitHubModel):
a: Missing[bool] = UNSET
a = TestModel().model_dump(mode="json", exclude_unset=True)
TestModel.model_validate(a) Since |
Oh, right, that works. Thank you! Just a suggestion: maybe it would be handy to use a custom serializer not to include |
adding a serializer will make the pydantic v1/v2 compat layer too complex. i could add a note to the documentation. |
Pydantic V2 does not allow validating Literal of plain enum by enum values:
raises
Relevant pydantic issue: pydantic/pydantic#8708
Pydantic and python version:
The text was updated successfully, but these errors were encountered: