Skip to content

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

Merged
dbanty merged 17 commits into
openapi-generators:mainfrom
KristinnVikar:main
Aug 12, 2023
Merged

feat: Upgrade internal Pydantic use to v2. Thanks @KristinnVikar!#779
dbanty merged 17 commits into
openapi-generators:mainfrom
KristinnVikar:main

Conversation

@KristinnVikar

@KristinnVikar KristinnVikar commented Jul 19, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
KristinnVikar marked this pull request as ready for review July 25, 2023 21:42
@codecov

codecov Bot commented Jul 26, 2023

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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

jpoppe commented Aug 7, 2023

Copy link
Copy Markdown

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 :)

Comment thread openapi_python_client/schema/openapi_schema_pydantic/schema.py Outdated
dbanty
dbanty previously approved these changes Aug 12, 2023

@dbanty dbanty left a comment

Copy link
Copy Markdown
Collaborator

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!

@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.

4 participants