Skip to content

[Swift4] Class name conflicts not handled #7148

Open
@dylan-colaco

Description

@dylan-colaco
Description

I have one of my swagger models named 'Locale' which has custom properties. I cannot change this definition as it was used in our backend and android code for years. In the generated swift4 client file, CodableHelper there is a DateFormatter object created, and locale is set on it. The problem is that swift is using my custom Locale class instead of the one from Foundation here.

Swagger-codegen version

swagger-codegen-cli-2.3.0-20171207.164637-326.jar

Swagger declaration file content or url
Command line used for generation

java -jar swagger-codegen-cli-2.3.0-20171207.164637-326.jar generate -l swift4 -i file.yaml -o client

Steps to reproduce

Use a model like Locale which is named same as a Foundation class that is used

Related issues/PRs
Suggest a fix/enhancement

If a class name is the same as Foundation, use the Foundation namespace prefix while using it: e.g.
formatter.locale = Foundation.Locale(identifier: "en_US_POSIX")
instead of
formatter.locale = Locale(identifier: "en_US_POSIX")

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions