Skip to content

Generating a python client with openAPI reference files is not working. #1261

@nateg-sr

Description

@nateg-sr

Describe the bug

This error response object has an empty key, which causes the openapi-generator to generate invalid code with a type hint for a missing class member, like the following:

class UpdateSettingsStorefrontSeo422ResponseErrors(BaseModel):
    """
    UpdateSettingsStorefrontSeo422ResponseErrors
    """ # noqa: E501
    : Optional[Annotated[str, Field(min_length=1, strict=True)]] = None
    __properties: ClassVar[List[str]] = [""]

To Reproduce

Run the following from the root of this repository to generate a python client

docker run \
  --rm \
  -v .:/local \
  docker.io/openapitools/openapi-generator-cli generate \
  --input-spec-root-directory /local/reference \
  -o /client \
  -g python \
  --package-name bc

Expected behavior

The key should have a name, or the parent field should be a string instead of an object.

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