Skip to content

fix: Add underscore suffix if property name is datetime #558

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 3 commits into from
Jan 17, 2022

Conversation

kmray
Copy link
Contributor

@kmray kmray commented Dec 23, 2021

If a property is named datetime and contains a date-time format, this will cause a conflict between the property name and Python's datetime. This adds datetime to the set of reserved words which will cause an underscore suffix to be appended. This resolves #557.

@dbanty dbanty added 🥚breaking This change breaks compatibility 🐞bug Something isn't working labels Jan 1, 2022
@dbanty
Copy link
Collaborator

dbanty commented Jan 1, 2022

Awesome, thanks for the fix! I think the same is probably true of date, would you mind adding that in here too just to prevent a future breaking change to solve that one?

@codecov
Copy link

codecov bot commented Jan 1, 2022

Codecov Report

Merging #558 (4c5f548) into main (48cabf9) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #558   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           48        48           
  Lines         1661      1661           
=========================================
  Hits          1661      1661           
Impacted Files Coverage Δ
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 48cabf9...4c5f548. Read the comment docs.

@dbanty dbanty added this to the 0.11.0 milestone Jan 7, 2022
@dbanty
Copy link
Collaborator

dbanty commented Jan 17, 2022

Ah, the conflict was with the module, not the class. So date isn't an issue.

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.

Thanks for the fix!

@dbanty dbanty merged commit 63c01f0 into openapi-generators:main Jan 17, 2022
dbanty pushed a commit that referenced this pull request Jan 17, 2022
…e" [#557 & #558]. Thanks @kmray!

Co-authored-by: Dylan Anthony <[email protected]>

BREAKING CHANGE: `datetime` is now considered a reserved word anywhere, so any properties which were named `datetime` will now be named `datetime_`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🥚breaking This change breaks compatibility 🐞bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Types named datetime cause conflict with Python's datetime
2 participants