Skip to content

Optional nullable model properties are deserialized from UNSET to None #381

Closed
@forest-benchling

Description

@forest-benchling

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):

  • OS: [e.g. macOS 10.15.1]
  • Python Version: [e.g. 3.8.0]
  • openapi-python-client version [e.g. 0.1.0]

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions