Skip to content

feat: Upgrade internal Pydantic use to v2. Thanks @KristinnVikar! #779

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 17 commits into from
Aug 12, 2023

Conversation

KristinnVikar
Copy link
Contributor

@KristinnVikar KristinnVikar commented Jul 19, 2023

Inital changes required for Pydantic v2 support, both hand updating + bump pydantic

Blockers

Currently 14 2 out of 449 tests are failing, all of which are due to the issue above.

@KristinnVikar
Copy link
Contributor Author

Local tests seem to be mostly working, only tests failing are GeneratorErrors, since Error messages have changed since Pydantic V1.

So I went about a different approach to roughly match the content of the GeneratorError instead of exact match (Since the Pydantic version is included in GeneratorError.detail)

KristinnVikar and others added 3 commits July 25, 2023 21:32

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@KristinnVikar KristinnVikar marked this pull request as ready for review July 25, 2023 21:42
@codecov
Copy link

codecov bot commented Jul 26, 2023

Codecov Report

Merging #779 (4be69e1) into main (be5b306) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #779   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           49        49           
  Lines         1971      1918   -53     
=========================================
- Hits          1971      1918   -53     
Files Changed Coverage Δ
openapi_python_client/config.py 100.00% <100.00%> (ø)
openapi_python_client/parser/openapi.py 100.00% <100.00%> (ø)
..._python_client/parser/properties/model_property.py 100.00% <100.00%> (ø)
...lient/schema/openapi_schema_pydantic/components.py 100.00% <100.00%> (ø)
...n_client/schema/openapi_schema_pydantic/contact.py 100.00% <100.00%> (ø)
...nt/schema/openapi_schema_pydantic/discriminator.py 100.00% <100.00%> (ø)
..._client/schema/openapi_schema_pydantic/encoding.py 100.00% <100.00%> (ø)
...n_client/schema/openapi_schema_pydantic/example.py 100.00% <100.00%> (ø)
.../openapi_schema_pydantic/external_documentation.py 100.00% <100.00%> (ø)
...on_client/schema/openapi_schema_pydantic/header.py 100.00% <100.00%> (ø)
... and 19 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

* Schema union ordering try Schema before Reference
* Support for boolean values in Schema.enum
* Missing default=None in SecurityScheme.security_scheme_in which is enforced by Pydantic V2
* Update Pydantic to V2.1.1
@KristinnVikar
Copy link
Contributor Author

Did some minor fixes with missing default in Field & schema ordering. Running it on the project I'm using this tool for seems to work just fine as of this last commit!

Hoping someone else can test it as well to see if there's any issues I need to fix!

@johnthagen
Copy link
Collaborator

Thanks for this @KristinnVikar! Just wanted to drop a link to some thoughts I had written on another thread about the motivation for this change

@jpoppe
Copy link

jpoppe commented Aug 7, 2023

Hoping someone else can test it as well to see if there's any issues I need to fix!

For what it's worth, I have tested it for my use cases and did not encounter any issues :)

dbanty and others added 5 commits August 12, 2023 12:04

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Unverified

This user has not yet uploaded their public signing key.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Unverified

This user has not yet uploaded their public signing key.

Unverified

This user has not yet uploaded their public signing key.
dbanty
dbanty previously approved these changes Aug 12, 2023
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 so much for doing this!

Unverified

This user has not yet uploaded their public signing key.
@dbanty dbanty changed the title feat: Initial changes for update to pydantic v2 feat: Upgrade internal Pydantic use to v2 Aug 12, 2023
@dbanty dbanty changed the title feat: Upgrade internal Pydantic use to v2 feat: Upgrade internal Pydantic use to v2. Thanks @KristinnVikar! Aug 12, 2023
@dbanty dbanty enabled auto-merge August 12, 2023 19:30
@dbanty dbanty disabled auto-merge August 12, 2023 23:00
@dbanty dbanty merged commit a6d7d7b into openapi-generators:main Aug 12, 2023
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

4 participants