Open keshamin opened 8 months ago
I'm having this problem too :'(
I have two optional lists, and I want to be able to set one to [] without doing anything to the other. However, if I do a MyModel.from_dict({'myoptionallist': None}), both 'myoptionallist' and 'myotheroptionallist' get set to [].
I tried last week and I'm having the same issue.
I look for some examples but I couldn't find any, Could any maintener help us?
I'm gonna try datamodel_code_generator/ an alternative supported by Pydantic. Maybe it is helpful for others.
Describe the bug A model with a property of type
Union[Unset, List[SomeEnum]]
initializes correctly when using__init__
initialization:BUT, when I initialize it using
.from_dict()
method, unexpectedly it provides an empty list as a default value:From my point of view,
.from_dict()
initialization should keep align with the logic in__init__
initialization.OpenAPI Spec File
Desktop (please complete the following information):