diff --git a/modules/openapi-generator/src/main/resources/python-nextgen/api.mustache b/modules/openapi-generator/src/main/resources/python-nextgen/api.mustache index a1c267adae69..24356a2f1706 100644 --- a/modules/openapi-generator/src/main/resources/python-nextgen/api.mustache +++ b/modules/openapi-generator/src/main/resources/python-nextgen/api.mustache @@ -4,6 +4,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated{{#asyncio}} @@ -47,7 +48,7 @@ class {{classname}}(object): {{/asyncio}} @validate_arguments def {{operationId}}(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}{{#asyncio}}async_req: Optional[bool]=None, {{/asyncio}}**kwargs) -> {{#asyncio}}Union[{{{returnType}}}{{^returnType}}None{{/returnType}}, Awaitable[{{{returnType}}}{{^returnType}}None{{/returnType}}]]{{/asyncio}}{{^asyncio}}{{{returnType}}}{{^returnType}}None{{/returnType}}{{/asyncio}}: # noqa: E501 - """{{{summary}}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 + """{{#isDeprecated}}(Deprecated) {{/isDeprecated}}{{{summary}}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 {{#notes}} {{{.}}} # noqa: E501 @@ -84,7 +85,7 @@ class {{classname}}(object): @validate_arguments def {{operationId}}_with_http_info(self, {{#allParams}}{{paramName}} : {{{vendorExtensions.x-py-typing}}}{{^required}} = None{{/required}}, {{/allParams}}**kwargs) -> ApiResponse: # noqa: E501 - """{{{summary}}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 + """{{#isDeprecated}}(Deprecated) {{/isDeprecated}}{{{summary}}}{{^summary}}{{operationId}}{{/summary}} # noqa: E501 {{#notes}} {{{.}}} # noqa: E501 @@ -124,6 +125,10 @@ class {{classname}}(object): :rtype: {{#returnType}}tuple({{.}}, status_code(int), headers(HTTPHeaderDict)){{/returnType}}{{^returnType}}None{{/returnType}} """ + {{#isDeprecated}} + warnings.warn("{{{httpMethod}}} {{{path}}} is deprecated.", DeprecationWarning) + + {{/isDeprecated}} {{#servers.0}} _hosts = [ {{#servers}} diff --git a/modules/openapi-generator/src/main/resources/python-nextgen/common_README.mustache b/modules/openapi-generator/src/main/resources/python-nextgen/common_README.mustache index e9182751f7d1..2691d0627333 100644 --- a/modules/openapi-generator/src/main/resources/python-nextgen/common_README.mustache +++ b/modules/openapi-generator/src/main/resources/python-nextgen/common_README.mustache @@ -1,5 +1,4 @@ ```python -from __future__ import print_function {{#apiInfo}}{{#apis}}{{#-last}}{{#hasHttpSignatureMethods}}import datetime{{/hasHttpSignatureMethods}}{{/-last}}{{/apis}}{{/apiInfo}} import time import {{{packageName}}} diff --git a/samples/client/echo_api/python-nextgen/README.md b/samples/client/echo_api/python-nextgen/README.md index df593d82aa7b..2d44a510f475 100644 --- a/samples/client/echo_api/python-nextgen/README.md +++ b/samples/client/echo_api/python-nextgen/README.md @@ -49,7 +49,6 @@ Execute `pytest` to run the tests. Please follow the [installation procedure](#installation--usage) and then run the following: ```python -from __future__ import print_function import time import openapi_client diff --git a/samples/client/echo_api/python-nextgen/openapi_client/api/body_api.py b/samples/client/echo_api/python-nextgen/openapi_client/api/body_api.py index c210c30ffcb6..a9c5c092068f 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/api/body_api.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/api/body_api.py @@ -15,6 +15,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/client/echo_api/python-nextgen/openapi_client/api/form_api.py b/samples/client/echo_api/python-nextgen/openapi_client/api/form_api.py index 8a46142d6bfa..79f4f4956b6c 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/api/form_api.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/api/form_api.py @@ -15,6 +15,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/client/echo_api/python-nextgen/openapi_client/api/header_api.py b/samples/client/echo_api/python-nextgen/openapi_client/api/header_api.py index 6ac1f29c52c9..acae0564d7a1 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/api/header_api.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/api/header_api.py @@ -15,6 +15,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/client/echo_api/python-nextgen/openapi_client/api/path_api.py b/samples/client/echo_api/python-nextgen/openapi_client/api/path_api.py index d55df6ec09bf..a30d5579e80a 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/api/path_api.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/api/path_api.py @@ -15,6 +15,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/client/echo_api/python-nextgen/openapi_client/api/query_api.py b/samples/client/echo_api/python-nextgen/openapi_client/api/query_api.py index 9c19d3be2b72..299a625d12e7 100644 --- a/samples/client/echo_api/python-nextgen/openapi_client/api/query_api.py +++ b/samples/client/echo_api/python-nextgen/openapi_client/api/query_api.py @@ -15,6 +15,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/README.md b/samples/openapi3/client/petstore/python-nextgen-aiohttp/README.md index d04bb6e09e9d..338c15e81dbf 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/README.md +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/README.md @@ -49,7 +49,6 @@ Execute `pytest` to run the tests. Please follow the [installation procedure](#installation--usage) and then run the following: ```python -from __future__ import print_function import datetime import time import petstore_api diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/another_fake_api.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/another_fake_api.py index 03c4184500fc..1241b57b6f61 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/another_fake_api.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/another_fake_api.py @@ -14,6 +14,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/default_api.py index 8123b68f39df..ed550c2c011b 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/default_api.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/default_api.py @@ -14,6 +14,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/fake_api.py index 1b68e85b046d..ab86c71bc2f1 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/fake_api.py @@ -14,6 +14,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/fake_classname_tags123_api.py index 62fa3a64823a..298b76f2362b 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/fake_classname_tags123_api.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/fake_classname_tags123_api.py @@ -14,6 +14,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/pet_api.py index 76fb763d8e72..4949f3523638 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/pet_api.py @@ -14,6 +14,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated @@ -508,7 +509,7 @@ def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=Tru @validate_arguments def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], async_req: Optional[bool]=None, **kwargs) -> Union[List[Pet], Awaitable[List[Pet]]]: # noqa: E501 - """Finds Pets by tags # noqa: E501 + """(Deprecated) Finds Pets by tags # noqa: E501 Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -539,7 +540,7 @@ def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=Tru @validate_arguments def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> ApiResponse: # noqa: E501 - """Finds Pets by tags # noqa: E501 + """(Deprecated) Finds Pets by tags # noqa: E501 Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -575,6 +576,8 @@ def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr, u :rtype: tuple(List[Pet], status_code(int), headers(HTTPHeaderDict)) """ + warnings.warn("GET /pet/findByTags is deprecated.", DeprecationWarning) + _params = locals() _all_params = [ diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/store_api.py index 24f6807b6aad..a0aad3801347 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/store_api.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/store_api.py @@ -14,6 +14,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/user_api.py index a9b5a8820188..28e52cd724c6 100644 --- a/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/user_api.py +++ b/samples/openapi3/client/petstore/python-nextgen-aiohttp/petstore_api/api/user_api.py @@ -14,6 +14,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/openapi3/client/petstore/python-nextgen/README.md b/samples/openapi3/client/petstore/python-nextgen/README.md index 9e25a6dd300c..ccafe47182a2 100755 --- a/samples/openapi3/client/petstore/python-nextgen/README.md +++ b/samples/openapi3/client/petstore/python-nextgen/README.md @@ -49,7 +49,6 @@ Execute `pytest` to run the tests. Please follow the [installation procedure](#installation--usage) and then run the following: ```python -from __future__ import print_function import datetime import time import petstore_api diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/another_fake_api.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/another_fake_api.py index b233c0d6591b..9664f40d693a 100755 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/another_fake_api.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/another_fake_api.py @@ -14,6 +14,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/default_api.py index 9d5cd5b875fc..829d78f3cdab 100755 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/default_api.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/default_api.py @@ -14,6 +14,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/fake_api.py index 88bd094209ba..af7cef6ae4a8 100755 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/fake_api.py @@ -14,6 +14,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/fake_classname_tags123_api.py index dd47fb53a777..65b6d5c9f70b 100644 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/fake_classname_tags123_api.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/fake_classname_tags123_api.py @@ -14,6 +14,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/pet_api.py index 44baa75ef1f3..93a2233cd24a 100755 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/pet_api.py @@ -14,6 +14,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated @@ -469,7 +470,7 @@ def find_pets_by_status_with_http_info(self, status : Annotated[conlist(StrictSt @validate_arguments def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> List[Pet]: # noqa: E501 - """Finds Pets by tags # noqa: E501 + """(Deprecated) Finds Pets by tags # noqa: E501 Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -498,7 +499,7 @@ def find_pets_by_tags(self, tags : Annotated[conlist(StrictStr, unique_items=Tru @validate_arguments def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr, unique_items=True), Field(..., description="Tags to filter by")], **kwargs) -> ApiResponse: # noqa: E501 - """Finds Pets by tags # noqa: E501 + """(Deprecated) Finds Pets by tags # noqa: E501 Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. # noqa: E501 This method makes a synchronous HTTP request by default. To make an @@ -534,6 +535,8 @@ def find_pets_by_tags_with_http_info(self, tags : Annotated[conlist(StrictStr, u :rtype: tuple(List[Pet], status_code(int), headers(HTTPHeaderDict)) """ + warnings.warn("GET /pet/findByTags is deprecated.", DeprecationWarning) + _params = locals() _all_params = [ diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/store_api.py index 9b55a6cde73f..0dd057c5980c 100755 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/store_api.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/store_api.py @@ -14,6 +14,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated diff --git a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/user_api.py index e016ae5e049f..c82c30c51b55 100755 --- a/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/user_api.py +++ b/samples/openapi3/client/petstore/python-nextgen/petstore_api/api/user_api.py @@ -14,6 +14,7 @@ import re # noqa: F401 import io +import warnings from pydantic import validate_arguments, ValidationError from typing_extensions import Annotated