Skip to content

Generated client fails flake8 due to trailing comma #179

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

Closed
dtkav opened this issue Sep 3, 2020 · 0 comments · Fixed by #178
Closed

Generated client fails flake8 due to trailing comma #179

dtkav opened this issue Sep 3, 2020 · 0 comments · Fixed by #178
Labels
🐞bug Something isn't working

Comments

@dtkav
Copy link
Contributor

dtkav commented Sep 3, 2020

Describe the bug
A trailing comma in the type signature of the endpoint_macros template causes Union types to include a trailing comma after the last type in the union.

To Reproduce
We run the following script to generate our client:

#!/usr/bin/env bash
set -x  # added for clarity below
rm -rf test-api-client
openapi-python-client generate --path test.yaml
autoflake --in-place --remove-all-unused-imports --remove-unused-variables --expand-star-imports -r test-api-client/
isort test-api-client/
black test-api-client/
# Ignore lines too long and bare except
flake8 --ignore=E722,E501 test-api-client/

With 0.6.0-alpha release it produces the following output:

+ rm -rf test-api-client
+ openapi-python-client generate --path test.yaml
Generating test-api-client
+ autoflake --in-place --remove-all-unused-imports --remove-unused-variables --expand-star-imports -r test-api-client/
+ isort test-api-client/
+ black test-api-client/
reformatted /Users/daniel/openapi-specs1/test-api-client/test_api_client/models/__init__.py
All done! ✨ 🍰 ✨
1 file reformatted, 8 files left unchanged.
+ flake8 --ignore=E722,E501 test-api-client/
test-api-client/test_api_client/api/default/create_cat.py:33:36: E231 missing whitespace after ','
test-api-client/test_api_client/api/default/create_cat.py:43:36: E231 missing whitespace after ','
test-api-client/test_api_client/api/default/create_cat.py:56:36: E231 missing whitespace after ','
test-api-client/test_api_client/api/default/create_cat.py:73:36: E231 missing whitespace after ','
test-api-client/test_api_client/api/default/create_cat.py:86:36: E231 missing whitespace after ','
test-api-client/test_api_client/api/default/create_cat.py:102:36: E231 missing whitespace after ','

Expected behavior
Since flake8 is part of our pipeline, we'd love for it to pass on the generated client.

OpenAPI Spec File
https://gist.github.com/dtkav/3f4525af7aa7f95548c6fc2bac2eef1d

Desktop (please complete the following information):

  • OS: macOS 10.15.6
  • Python Version: 3.8.0
  • openapi-python-client version v.0.6.0-alpha.1

Additional context
I put up PR #178 which seems to fix the issue.

@dtkav dtkav added the 🐞bug Something isn't working label Sep 3, 2020
dbanty pushed a commit that referenced this issue Sep 4, 2020
dbanty pushed a commit that referenced this issue Sep 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant