Skip to content

[Python] Spec definition containing brackets generates model with invalid filename #2306

Closed
@cbdelavenne

Description

@cbdelavenne
{
    "definitions": {
        "SomeDto[AnotherDto]": {
             ...
        }
    }
}

When fed through swagger codegen, the definition above generates a file:
swagger_client/models/some_dto[another_dto].py

Then swagger_client/models/__init__.py can't correctly import the file:

from .some_dto[another_dto] import SomeDtoAnotherDto

Anyway, all this to say, during generation, brackets in definition/path names should be converted to _ or empty space when creating files.

Let me know if this isn't clear or if there's a naming convention for swagger spec paths and definitions that I'm not aware of. I couldn't find anything mentioning that in http://swagger.io/specification/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions