python: generate Pydantic v2 + typing complete code (#16624)

* python: improve type generation with more specific typing

* Annotate function parameters

* Remove unused imports

* remove unused files

* remove temporary hack

* remove lock file

* fix Annotated import

* support Python 3.7

* Regenerate code with typing-extensions

* Fix setup.py

* More Pydantic v2 compatibility

* depend on pydantic v2

* fix client_echo tests

* fix JSON serialization

* Fix references

* Skip circular dependency tests for now

* Temporarily hide the "float" property

The "float" property aliases the "float" type and completely breaks the
model: all the properties that were "float" now become the type of the
"float" property instead.

* Fix errors

* Import Literal from typing_extensions

* Fix GitHub Action workflows

* Fix Python 3.7 failure

* Fix quotes

* Apply suggestions from code review

* Fix tests

* split model imports from other modules imports

* fix workflow

* Comment the array unique items convertion, remove set translation

* Replace alias usage
This commit is contained in:
Jonathan Ballet
2023-09-28 13:13:14 +02:00
committed by GitHub
parent af352df10f
commit 04fa53b692
219 changed files with 3305 additions and 1566 deletions

View File

@@ -19,10 +19,11 @@ import warnings
from pydantic import validate_arguments, ValidationError
from pydantic import Field
from typing_extensions import Annotated
from pydantic import Field, StrictBytes, StrictStr, conlist
from pydantic import StrictBytes, StrictStr
from typing import Any, Dict, Optional, Union
from typing import Any, Dict, List, Optional, Union
from openapi_client.models.pet import Pet
from openapi_client.models.tag import Tag
@@ -332,7 +333,7 @@ class BodyApi:
_request_auth=_params.get('_request_auth'))
@validate_arguments
def test_body_multipart_formdata_array_of_binary(self, files : conlist(Union[StrictBytes, StrictStr]), **kwargs) -> str: # noqa: E501
def test_body_multipart_formdata_array_of_binary(self, files : List[Union[StrictBytes, StrictStr]], **kwargs) -> str: # noqa: E501
"""Test array of binary in multipart mime # noqa: E501
Test array of binary in multipart mime # noqa: E501
@@ -362,7 +363,7 @@ class BodyApi:
return self.test_body_multipart_formdata_array_of_binary_with_http_info(files, **kwargs) # noqa: E501
@validate_arguments
def test_body_multipart_formdata_array_of_binary_with_http_info(self, files : conlist(Union[StrictBytes, StrictStr]), **kwargs) -> ApiResponse: # noqa: E501
def test_body_multipart_formdata_array_of_binary_with_http_info(self, files : List[Union[StrictBytes, StrictStr]], **kwargs) -> ApiResponse: # noqa: E501
"""Test array of binary in multipart mime # noqa: E501
Test array of binary in multipart mime # noqa: E501