You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we have {"Animals": ["dog", "cat"], "Location": "Montpellier"} as input json
we have {"Animals": {"root": ["dog", "cat"]}, "Location": "Montpellier"} as result json, from the pydantic object which make it impossible to reload by other application
Moreover my_pets_result_json_str gives ["dog", "cat"] ...
(sorry if the format is not correct, it is my first bug on github)
The text was updated successfully, but these errors were encountered:
silversurfer34
changed the title
wrong json() behavior for nested models with __root
wrong json() behavior for nested models with __root__
Apr 22, 2020
sorry if the format is not correct, it is my first bug on github
No problem. In future please follow the template you would have seen when you first create the issue if you'd chosen "bug" or "question" and fill the information it requests.
This look like a bug, I haven't seen it before since normally users don't use custom root types except in the root model.
I'll try and fix or or (or PR welcome if you'd like to fix it) but the best work around would be to not use models with custom root types as sub-models
Hello again, I propose this PR #1429 to fix this.
(BTW I do not know if it is the right way to link the PR)
To explain why I have nested models with root, in fact I am using another project that generates a pydantic model from an openapi definition (https://github.com/koxudaxi/datamodel-code-generator) and this is the output of this generator.
hello I have some issues with root
we have {"Animals": ["dog", "cat"], "Location": "Montpellier"} as input json
we have {"Animals": {"root": ["dog", "cat"]}, "Location": "Montpellier"} as result json, from the pydantic object which make it impossible to reload by other application
Moreover my_pets_result_json_str gives ["dog", "cat"] ...
(sorry if the format is not correct, it is my first bug on github)
The text was updated successfully, but these errors were encountered: