Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generator and template files for python to v7.8.0 #29

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified openapi-generator-cli.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
python_dateutil >= 2.5.3
setuptools >= 21.0.0
urllib3 >= 1.25.3, < 2.1.0
pydantic >= 1.10.5, < 2
pydantic >= 2
aenum >= 3.1.11
mypy>=1.4.1
types-python-dateutil>=2.8.19
1 change: 1 addition & 0 deletions sdk-resources/resources/README.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ This Python package is automatically generated by the [OpenAPI Generator](https:
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Generator version: {{generatorVersion}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
Expand Down
1 change: 1 addition & 0 deletions sdk-resources/resources/README_onlypackage.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The `{{packageName}}` package is automatically generated by the [OpenAPI Generat
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Generator version: {{generatorVersion}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
Expand Down
32 changes: 13 additions & 19 deletions sdk-resources/resources/api.mustache
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
# coding: utf-8

{{>partial_header}}

import io
import warnings

from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Dict, List, Optional, Tuple, Union, Any

try:
from typing import Annotated
except ImportError:
from typing_extensions import Annotated
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

{{#imports}}
{{import}}
{{/imports}}

from {{packageName}}.api_client import ApiClient
from {{packageName}}.api_client import ApiClient, RequestSerialized
from {{packageName}}.api_response import ApiResponse
from {{packageName}}.rest import RESTResponseType

Expand Down Expand Up @@ -84,7 +77,7 @@ class {{classname}}:
_content_type,
_headers,
_host_index,
) -> Tuple:
) -> RequestSerialized:

{{#servers.0}}
_hosts = [{{#servers}}
Expand All @@ -108,7 +101,7 @@ class {{classname}}:
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[str, str] = {}
_files: Dict[str, Union[str, bytes]] = {}
_body_params: Optional[bytes] = None

# process the path parameters
Expand Down Expand Up @@ -170,7 +163,7 @@ class {{classname}}:
{{#isBinary}}
# convert to byte array if the input is a file name (str)
if isinstance({{paramName}}, str):
with io.open({{paramName}}, "rb") as _fp:
with open({{paramName}}, "rb") as _fp:
_body_params = _fp.read()
else:
_body_params = {{paramName}}
Expand All @@ -183,7 +176,7 @@ class {{classname}}:
{{#constantParams}}
{{#isQueryParam}}
# Set client side default value of Query Param "{{baseName}}".
_query_params['{{baseName}}'] = {{#_enum}}'{{{.}}}'{{/_enum}}
_query_params.append(('{{baseName}}', {{#_enum}}'{{{.}}}'{{/_enum}}))
{{/isQueryParam}}
{{#isHeaderParam}}
# Set client side default value of Header Param "{{baseName}}".
Expand All @@ -193,11 +186,12 @@ class {{classname}}:

{{#hasProduces}}
# set the HTTP header `Accept`
_header_params['Accept'] = self.api_client.select_header_accept(
[{{#produces}}
'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}
]
)
if 'Accept' not in _header_params:
_header_params['Accept'] = self.api_client.select_header_accept(
[{{#produces}}
'{{{mediaType}}}'{{^-last}}, {{/-last}}{{/produces}}
]
)
{{/hasProduces}}

{{#hasConsumes}}
Expand Down
Loading
Loading