Skip to content

Convert property and endpoint names to snake case in Python code #29

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

Merged
merged 5 commits into from
Apr 25, 2020

Conversation

acgray
Copy link

@acgray acgray commented Apr 12, 2020

Great project! A few contributions in this PR and more to come from a similar - but much shoddier! - tool I had knocked out for a current project.

This adds conversion to snake_case for property and API operation names. I've added some regex to avoid awkward conversions like h_t_t_p__response.

Copy link
Collaborator

@dbanty dbanty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work, thank you! A couple tiny suggestions, the only semi-important change is about calculating python_name on properties once instead of as a property which runs every time. Will affect performance a bit.

My only other request is, if you feel comfortable, try to add a property which doesn't use snake_case in the FastAPI app used for end to end testing so we verify that it preserves the name of the param while making a more appropriate one for Python. If not, I can stick one in there at a later time.

dbanty added a commit that referenced this pull request Apr 25, 2020
dbanty added a commit that referenced this pull request Apr 25, 2020
@codecov
Copy link

codecov bot commented Apr 25, 2020

Codecov Report

Merging #29 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #29   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         9    +1     
  Lines          532       553   +21     
=========================================
+ Hits           532       553   +21     
Impacted Files Coverage Δ
openapi_python_client/__init__.py 100.00% <100.00%> (ø)
openapi_python_client/openapi_parser/openapi.py 100.00% <100.00%> (ø)
openapi_python_client/openapi_parser/properties.py 100.00% <100.00%> (ø)
openapi_python_client/openapi_parser/reference.py 100.00% <100.00%> (ø)
openapi_python_client/openapi_parser/responses.py 100.00% <100.00%> (ø)
openapi_python_client/utils.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5583d86...ec5c87a. Read the comment docs.

@dbanty dbanty merged commit 8fe695d into openapi-generators:master Apr 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants