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

switch away from deprecated pydantic method #1485

Merged

Conversation

iliakur
Copy link
Contributor

@iliakur iliakur commented Aug 9, 2023

I'm starting with just one method conversion to get initial feedback and check tests, but there's also one lurking in types.py which I'll convert later in the same PR.

@iliakur iliakur marked this pull request as ready for review August 9, 2023 15:02
@codecov
Copy link

codecov bot commented Aug 9, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (e9b6edf) 100.00% compared to head (382bf18) 100.00%.
Report is 693 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##            master     #1485     +/-   ##
===========================================
  Coverage   100.00%   100.00%             
===========================================
  Files           11        32     +21     
  Lines         1020      3579   +2559     
  Branches       201       839    +638     
===========================================
+ Hits          1020      3579   +2559     
Flag Coverage Δ
unittests 99.63% <99.58%> (?)

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

Files Changed Coverage Δ
datamodel_code_generator/__init__.py 100.00% <100.00%> (ø)
datamodel_code_generator/__main__.py 100.00% <100.00%> (ø)
datamodel_code_generator/format.py 100.00% <100.00%> (ø)
datamodel_code_generator/http.py 100.00% <100.00%> (ø)
datamodel_code_generator/imports.py 100.00% <100.00%> (ø)
datamodel_code_generator/model/__init__.py 100.00% <100.00%> (ø)
datamodel_code_generator/model/base.py 100.00% <100.00%> (ø)
datamodel_code_generator/model/dataclass.py 100.00% <100.00%> (ø)
datamodel_code_generator/model/enum.py 100.00% <100.00%> (ø)
datamodel_code_generator/model/imports.py 100.00% <100.00%> (ø)
... and 22 more

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

@koxudaxi
Copy link
Owner

koxudaxi commented Aug 9, 2023

Thank you for creating PR.
Could you please add the condition of PYDANIC_V2 ?
Because, we should support v1 in runtime yet.

if PYDANTIC_V2:
@classmethod
def get_fields(cls) -> Dict[str, Any]:
return cls.model_fields
else:
@classmethod
def get_fields(cls) -> Dict[str, Any]:
return cls.__fields__

@iliakur
Copy link
Contributor Author

iliakur commented Aug 9, 2023

@koxudaxi done, lmk if that's ok

@iliakur
Copy link
Contributor Author

iliakur commented Aug 9, 2023

hmm, looks like I missed something...

@koxudaxi
Copy link
Owner

koxudaxi commented Aug 9, 2023

@iliakur
I just added def model_rebuild(cls... to DataType 😉

Thank you very much!!

@koxudaxi koxudaxi merged commit 1048c52 into koxudaxi:master Aug 9, 2023
73 checks passed
@iliakur
Copy link
Contributor Author

iliakur commented Aug 10, 2023

@koxudaxi Thanks for the final tweaks! qq: when do you think this will be released?

@koxudaxi
Copy link
Owner

@iliakur
You can install the version from pypi via pip.
I'm sorry I didn't announce the released
https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.21.4

@iliakur
Copy link
Contributor Author

iliakur commented Aug 10, 2023

oh, this is great, thanks a bunch for such a quick release!!

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.

None yet

2 participants