-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Nested model with Dict __root__ init behaviour #1773
Comments
Thanks, @PrettyWood |
I'm afraid it won't be available anytime soon (see https://github.com/samuelcolvin/pydantic/milestone/2) |
No problem, I believe it should be rather simple to work around. |
Question
Output of
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
:Hello,
I'm trying to nest a model with custom
Union[str, Dict]
root type in another model and seem to be getting some inconsistent behavior during model init. Consider following code snippet:This outputs:
In case of passing a string, it gets nested under the
__root__
key automatically, which is not the case with the dict, which seems to require explicit nesting.Is this expected?
The text was updated successfully, but these errors were encountered: