Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Incorrect parsing of null as nullable enum value serialized as strings

Open
#1,243 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
openapi, python
Domain
api

Research direction

Reproduce the nullable enum case from the issue using the openapi-python-client 0.23.1 behavior and the shown generated deserialization code. Start at the handling of deviceEncryptionKeyScheme after d.pop; compare the UNSET path with the null path. Done means an explicitly null value deserializes successfully while an unset property remains represented as UNSET.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
2k
Forks
293
Avg merge
34m
Merged PRs (30d)
1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openapi-generators/openapi-python-client

All issues in openapi-generators/openapi-python-client

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.