[PYTHON] generate code based on pydantic v2#16655
[PYTHON] generate code based on pydantic v2#16655fa0311 wants to merge 15 commits intoOpenAPITools:oshmoun-masterfrom
Conversation
Signed-off-by: ふぁ <yuki@yuki0311.com>
Signed-off-by: ふぁ <yuki@yuki0311.com>
Signed-off-by: ふぁ <yuki@yuki0311.com>
Signed-off-by: ふぁ <yuki@yuki0311.com>
Signed-off-by: ふぁ <yuki@yuki0311.com>
Signed-off-by: ふぁ <yuki@yuki0311.com>
Signed-off-by: ふぁ <yuki@yuki0311.com>
Signed-off-by: ふぁ <yuki@yuki0311.com>
Signed-off-by: ふぁ <yuki@yuki0311.com>
| "__root__\n" | ||
| " DanishPig expected dict not int (type=type_error)") | ||
| " Input should be a valid dictionary or instance of BasquePig [type=model_type, input_value=1, input_type=int]\n" | ||
| " For further information visit https://errors.pydantic.dev/2.3/v/model_type, 1 validation error for DanishPig\n" |
There was a problem hiding this comment.
It is not wise to include the document url in the test
Since pydantic v2.4.0 was released a few hours ago, the URL has changed and the test will fail
There was a problem hiding this comment.
agreed. we didn't take into consideration upgrading pydantic to newer version when writing the test. please feel free to revise the test
| {{/vendorExtensions.x-py-postponed-example-imports}} | ||
| {{classname}}.update_forward_refs() | ||
| try: | ||
| {{classname}}.{{#usePydanticV2}}model_rebuild{{/usePydanticV2}}{{^usePydanticV2}}update_forward_refs{{/usePydanticV2}}() |
There was a problem hiding this comment.
should use .model_rebuild(raise_errors=False) instead of try.
However, this is a stopgap measure and in practice should be implemented without using raise_errors.
I spent a lot of time trying to rebuild without raise_errors, but couldn't come up with a good solution.
There was a problem hiding this comment.
I think we can remove the usePydanticV2 switch the template and the java class as python client generator now only supports pydantic v2.
|
I didn't use the usePydanticV2 flag 🙈
then I am receiving following error:
Python version: 3.11.5 |
|
Continue to #16685 |
PR checklist
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.For Windows users, please run the script in Git BASH.
master(upcoming 7.1.0 minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)