-
-
Notifications
You must be signed in to change notification settings - Fork 228
Optional nullable model properties are deserialized from UNSET
to None
#381
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
Comments
@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 |
dbanty
pushed a commit
that referenced
this issue
May 12, 2021
… returned from the API [#420 & #381]. Thanks @forest-benchling! * Handle optional nullable deserialization * Fix test
p1-ra
pushed a commit
to P1sec/openapi-python-client
that referenced
this issue
May 14, 2021
… returned from the API [openapi-generators#420 & openapi-generators#381]. Thanks @forest-benchling! * Handle optional nullable deserialization * Fix test
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 asNone
instead ofUNSET
.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 toNone
.Expected behavior
UNSET
keys should be deserialized asUNSET
.OpenAPI Spec File
Existing
openapi.json
Desktop (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: