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

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

Closed
cbdelavenne opened this issue Mar 3, 2016 · 2 comments · Fixed by #2309
Closed

Comments

@cbdelavenne
Copy link
Contributor

{
    "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/

wing328 added a commit to wing328/swagger-codegen that referenced this issue Mar 4, 2016
@wing328 wing328 added this to the v2.1.6 milestone Mar 4, 2016
@wing328
Copy link
Contributor

wing328 commented Mar 4, 2016

@cbdelavenne thanks for reporting the issue, which has been addressed by #2309

Please pull the latest and let us know if you're still seeing the issue.

We've added some test cases, which will be reused to cover all other languages.

@cbdelavenne
Copy link
Contributor Author

Just had a chance to test it out. It's working properly now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants