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
{{ message }}
Repository navigation
Optional nullable model properties are deserialized from UNSET to None #381
Describe the bug
If a model has an optional nullable model property, then in the from_dict, if the key is not present in the dictionary, it is deserialized as None instead of UNSET.
This is also true for enum properties, and probably other types as well, but we haven't done an exhaustive search.
To Reproduce
This can already be seen in end_to_end_tests/golden-record/my_test_api_client/models/a_model.py:345, where the deserialized value is initialized to None.
Expected behavior UNSET keys should be deserialized as UNSET.
OpenAPI Spec File
Existing openapi.json
Desktop (please complete the following information):
@forest-benchling does this affect main, the released version, or both?
@dbanty Both. I think it has been around for a long time. It should be pretty easy to fix, though, it might just work to switch the order of checking optional/nullable in openapi_python_client/templates/property_templates/property_macros.py.jinja:6.
Activity
forest-benchling commentedon Apr 7, 2021
Sorry @dtkav for the barrage of feedback :) We are hoping to help out with some of it eventually, but don't have the bandwidth at the moment.
LMK if anything is unclear.
cc @dtkav @bowenwr @packyg
dbanty commentedon Apr 7, 2021
@forest-benchling does this affect main, the released version, or both?
forest-benchling commentedon Apr 7, 2021
@dbanty Both. I think it has been around for a long time. It should be pretty easy to fix, though, it might just work to switch the order of checking optional/nullable in
openapi_python_client/templates/property_templates/property_macros.py.jinja:6.fix: Deserialization of optional nullable properties when no value is…
fix: Deserialization of optional nullable properties when no value is…