Skip to content

Handle "empty" default values as null #1376

@csbrown-noaa

Description

@csbrown-noaa

Describe the bug
"empty" default values for optional fields throw an error. swagger-parser explicitly allows these (even though they are technically out-of-spec) by converting them silently to null. So, there exist openapi json in the wild built by swagger tools that pass swagger validation, but throw an error here in openapi-python-client.

OpenAPI Spec File
https://www.marinespecies.org/rest/api-docs/openapi.yaml

grep for:

                schema:
                    type: integer
                    default: ""

There are three endpoints that have this property. One of which is AphiaTaxonRanksByID. It might be useful to check this endpoint out in the swagger docs here.

Desktop (please complete the following information):

  • openapi-python-client version 0.28.0

Additional context
I am in contact with the folks at WORMS to try and find out how their openapi.yaml got this way. Will update here when I get more info.

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