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

New CLI option --output-datetime-class #1996 #2100

Merged
merged 4 commits into from
Oct 12, 2024

Conversation

archetipo
Copy link
Contributor

to choose between AwareDateTime, NaiveDateTime, generic datetime
FIX #1996 and others

Copy link

codecov bot commented Oct 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (f11c371) to head (05f7f39).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #2100   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           38        38           
  Lines         4205      4222   +17     
  Branches       976       979    +3     
=========================================
+ Hits          4205      4222   +17     
Flag Coverage Δ
unittests 99.66% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

codspeed-hq bot commented Oct 9, 2024

CodSpeed Performance Report

Merging #2100 will not alter performance

Comparing archetipo:support_multiple_datime_types (05f7f39) with main (f11c371)

Summary

✅ 31 untouched benchmarks

@koxudaxi koxudaxi merged commit 2df133c into koxudaxi:main Oct 12, 2024
76 checks passed
anis-campos pushed a commit to anis-campos/datamodel-code-generator that referenced this pull request Oct 14, 2024
applying `--output-datetime-class` from koxudaxi#2100 to dataclass to map date, time and date time to the python `datetime` objects instead of strings.
anis-campos pushed a commit to anis-campos/datamodel-code-generator that referenced this pull request Oct 14, 2024
applying `--output-datetime-class` from koxudaxi#2100 to dataclass to map date, time and date time to the python `datetime` objects instead of strings.
anis-campos pushed a commit to anis-campos/datamodel-code-generator that referenced this pull request Oct 15, 2024
applying `--output-datetime-class` from koxudaxi#2100 to dataclass to map date, time and date time to the python `datetime` objects instead of strings.
anis-campos pushed a commit to anis-campos/datamodel-code-generator that referenced this pull request Oct 15, 2024
applying `--output-datetime-class` from koxudaxi#2100 to dataclass to map date, time and date time to the python `datetime` objects instead of strings.
anis-campos pushed a commit to anis-campos/datamodel-code-generator that referenced this pull request Oct 15, 2024
applying `--output-datetime-class` from koxudaxi#2100 to dataclass to map date, time and date time to the python `datetime` objects instead of strings.
@meliache
Copy link
Contributor

Thanks for this PR, finally i can move away from the workaround with the Python API and move back to using the CLI directly.

Note that this PR not just introduces an options but also changes the default from AwareDatetime to the generic datetime. That's something I would emphasize in the changelog or release notes.

koxudaxi added a commit that referenced this pull request Oct 16, 2024
* Use apply_discriminator_type for dataclasses

Allow dataclass models to be properly generated with discriminator field

* Fix dataclass inheritance

Thanks to keyword only, dataclass models can use inheritance and no have issues with default values

* Support datetime types in dataclass fields

applying `--output-datetime-class` from #2100 to dataclass to map date, time and date time to the python `datetime` objects instead of strings.

* fix unittest

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix unittest

* fix unittest

---------

Co-authored-by: Koudai Aono <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
@koxudaxi
Copy link
Owner

@meliache
Thank you for leaving the comment. I see; I completely overlooked the change in default behavior. If possible, I'd like to maintain the existing behavior. What do you think about that? In other words, I don't want to affect existing users.

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.

Support NaiveDateTime
3 participants