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 a1c267adae..24356a2f17 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 e9182751f7..2691d06273 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 df593d82aa..2d44a510f4 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 c210c30ffc..a9c5c09206 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 8a46142d6b..79f4f4956b 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 6ac1f29c52..acae0564d7 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 d55df6ec09..a30d5579e8 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 9c19d3be2b..299a625d12 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 d04bb6e09e..338c15e81d 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 03c4184500..1241b57b6f 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 8123b68f39..ed550c2c01 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 1b68e85b04..ab86c71bc2 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 62fa3a6482..298b76f236 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 76fb763d8e..4949f35236 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 @@ class PetApi(object): @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 @@ class PetApi(object): @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 @@ class PetApi(object): :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 24f6807b6a..a0aad38013 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 a9b5a88201..28e52cd724 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 9e25a6dd30..ccafe47182 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 b233c0d659..9664f40d69 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 9d5cd5b875..829d78f3cd 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 88bd094209..af7cef6ae4 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 dd47fb53a7..65b6d5c9f7 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 44baa75ef1..93a2233cd2 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 @@ class PetApi(object): @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 @@ class PetApi(object): @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 @@ class PetApi(object): :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 9b55a6cde7..0dd057c598 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 e016ae5e04..c82c30c51b 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