Skip to content

None is not correctly serialized for certain optional query params #380

Closed
@forest-benchling

Description

@forest-benchling

Describe the bug
In #331, we decided to allow None to be passed in optional query params and treated identically to UNSET.

However, a few cases weren't supported:

  • model properties
  • enum properties
  • datetime properties

I haven't done an exhaustive search so there may be others as well; potentially any types that require non-trivial JSON serialization.

To Reproduce
This can already be seen in end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py:90, which will crash if None is passed in for the model.

Expected behavior
For all types, if the query param is optional, None is treated as UNSET.

OpenAPI Spec File
The 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