Skip to content
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

fix: runtime error: invalid memory address or nil pointer dereference #1649

Merged
merged 1 commit into from May 4, 2023

Conversation

ArthurFritz
Copy link
Contributor

Resolve error:
runtime error: invalid memory address or nil pointer dereference

The case of error occurs when in the documentation we have a reference to an object in the array null.

Exp Json (Generated of python Library auto documentation Swagger [drf-spectacular]):


"NullEnum": {
      "enum": [
          null
      ]
  }

Use this in property another object where of property type Enum is Nullable:

"profile_enum": {
                        "nullable": true,
                        "oneOf": [
                            {
                                "$ref": "#/components/schemas/ProfileEnumEnum"
                            },
                            {
                                "$ref": "#/components/schemas/NullEnum"
                            }
                        ]
                    }

I performed the YAML to JSON conversion test in the swagger-editor and was successful, with that I opened this suggestion so that it does not generate problems in the conversion.

@mikefarah mikefarah merged commit d14eaa9 into mikefarah:master May 4, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants