Skip to content

Incorrect parsing of null as nullable enum value serialized as strings #1243

Open
@kunom

Description

@kunom

Consider the following schema definition (which passes validation with the openapitools/openapi-generator-cli container image):

// [...]
          "deviceEncryptionKeyScheme": {
            "$ref": "#/components/schemas/DeviceEncryptionKeyScheme",
            "nullable": true  // <-- nullability declared
          },

// [...]
      "DeviceEncryptionKeyScheme": {
        "enum": ["Default8"],
        "type": "string"
      },

It looks as if openapi-python-client version 0.23.1 supports deserialization with the deviceEncryptionKeyScheme property being unset, but not it being null:

        _device_encryption_key_scheme = d.pop("deviceEncryptionKeyScheme", UNSET)
        device_encryption_key_scheme: Union[Unset, DeviceEncryptionKeyScheme]
        if isinstance(_device_encryption_key_scheme, Unset):
            device_encryption_key_scheme = UNSET
        else:
            device_encryption_key_scheme = DeviceEncryptionKeyScheme(_device_encryption_key_scheme)

This looks like a bug to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions