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

Generated python-flask code fails when tags contain spaces #6627

Closed
alanbchristie opened this issue Oct 6, 2017 · 2 comments · Fixed by #6637
Closed

Generated python-flask code fails when tags contain spaces #6627

alanbchristie opened this issue Oct 6, 2017 · 2 comments · Fixed by #6637

Comments

@alanbchristie
Copy link

Description

When I compile for -l python-flask and use spaces in my Swagger tags, e.g.:

tags:
- name: General components

The generated Python server code, when executed as advised in the generated README fails. i.e. if you run this:

python3 -m swagger_server

You get the following error:

Failed to add operation for POST [...]
[...]
connexion.exceptions.ResolverError: <ResolverError: Cannot resolve operationId "swagger_server.controllers.general components_controller.component_accumulator_post"! Import error was "No module named 'swagger_server.controllers.general components_controller'">

The module swagger_server.controllers.general components_controller does not exist because it is compiled as swagger_server.controllers.general_components_controller ... the space replaced by an underbar.

Swagger-codegen version

latest at time of writing (master/HEAD).

Swagger declaration file content or url

Except posted above. Code is proprietary and I cannot share ATM.

Command line used for generation

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -i //swagger/swagger.yml -l python-flask -o ../runner

Steps to reproduce

I suspect you can just try using tags with spaces.

Related issues/PRs

None

Suggest a fix/enhancement

The generated code has to know what the generator created. If the generator inserts an underbar the generated code has to know this or .. the generator has to generate an error, i.e. "Spaces in tags not supported".

For now I have removed the space and everything works.

@wing328
Copy link
Contributor

wing328 commented Oct 6, 2017

@alanbchristie thanks for reporting the issue. I just work on something similar and will try to fix it over the weekend.

@wing328
Copy link
Contributor

wing328 commented Oct 9, 2017

@alanbchristie I've fixed the issue via #6637. Please pull the latest master to give it a try or use the SNAPSHOT version mentioned in the README.

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