Skip to content

Commit 2c5ebb3

Browse files
committed
upgrade generator and templates to v7.14.0 of the openapi-generator
1 parent 05de041 commit 2c5ebb3

File tree

4 files changed

+35
-14
lines changed

4 files changed

+35
-14
lines changed

scripts/generate-sdk/generate-sdk.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ go)
5858
;;
5959
python)
6060
# Renovate: datasource=github-tags depName=OpenAPITools/openapi-generator versioning=semver
61-
GENERATOR_VERSION="v7.13.0"
61+
GENERATOR_VERSION="v7.14.0"
6262
;;
6363
*)
6464
echo "SDK language not supported."

templates/python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This folder contains only our customized python templates. Beside these customized templates,
44
the original templates of openapi-generator for python are used. These can be found in the
5-
official GitHub repo of the [openapi-generator](https://github.com/OpenAPITools/openapi-generator/tree/v7.13.0/modules/openapi-generator/src/main/resources/python).
5+
official GitHub repo of the [openapi-generator](https://github.com/OpenAPITools/openapi-generator/tree/v7.14.0/modules/openapi-generator/src/main/resources/python).
66

77
If you need to change something in the Python Generator, try always first to add
88
[user-defined templates](https://openapi-generator.tech/docs/customization#user-defined-templates),

templates/python/__init__package.mustache

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,44 @@
66

77
__version__ = "{{packageVersion}}"
88

9+
# Define package exports
10+
__all__ = [
11+
{{#apiInfo}}{{#apis}}"{{classname}}",
12+
{{/apis}}{{/apiInfo}}"ApiResponse",
13+
"ApiClient",
14+
"HostConfiguration",
15+
"OpenApiException",
16+
"ApiTypeError",
17+
"ApiValueError",
18+
"ApiKeyError",
19+
"ApiAttributeError",
20+
"ApiException",
21+
{{#hasHttpSignatureMethods}}"HttpSigningConfiguration",
22+
{{/hasHttpSignatureMethods}}{{#models}}{{#model}}"{{classname}}"{{^-last}},
23+
{{/-last}}{{#-last}},{{/-last}}{{/model}}{{/models}}
24+
]
25+
926
# import apis into sdk package
10-
{{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classFilename}} import {{classname}}
27+
{{#apiInfo}}{{#apis}}from {{apiPackage}}.{{classFilename}} import {{classname}} as {{classname}}
1128
{{/apis}}{{/apiInfo}}
1229
# import ApiClient
13-
from {{packageName}}.api_response import ApiResponse
14-
from {{packageName}}.api_client import ApiClient
15-
from {{packageName}}.configuration import HostConfiguration
16-
from {{packageName}}.exceptions import OpenApiException
17-
from {{packageName}}.exceptions import ApiTypeError
18-
from {{packageName}}.exceptions import ApiValueError
19-
from {{packageName}}.exceptions import ApiKeyError
20-
from {{packageName}}.exceptions import ApiAttributeError
21-
from {{packageName}}.exceptions import ApiException
30+
from {{packageName}}.api_response import ApiResponse as ApiResponse
31+
from {{packageName}}.api_client import ApiClient as ApiClient
32+
from {{packageName}}.configuration import HostConfiguration as HostConfiguration
33+
from {{packageName}}.exceptions import OpenApiException as OpenApiException
34+
from {{packageName}}.exceptions import ApiTypeError as ApiTypeError
35+
from {{packageName}}.exceptions import ApiValueError as ApiValueError
36+
from {{packageName}}.exceptions import ApiKeyError as ApiKeyError
37+
from {{packageName}}.exceptions import ApiAttributeError as ApiAttributeError
38+
from {{packageName}}.exceptions import ApiException as ApiException
2239
{{#hasHttpSignatureMethods}}
23-
from {{packageName}}.signing import HttpSigningConfiguration
40+
from {{packageName}}.signing import HttpSigningConfiguration as HttpSigningConfiguration
2441
{{/hasHttpSignatureMethods}}
2542

2643
# import models into sdk package
2744
{{#models}}
2845
{{#model}}
29-
from {{modelPackage}}.{{classFilename}} import {{classname}}
46+
from {{modelPackage}}.{{classFilename}} import {{classname}} as {{classname}}
3047
{{/model}}
3148
{{/models}}
3249
{{#recursionLimit}}

templates/python/api_client.mustache

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,10 @@ class ApiClient:
371371
else:
372372
obj_dict = obj.__dict__
373373

374+
if isinstance(obj_dict, list):
375+
# here we handle instances that can either be a list or something else, and only became a real list by calling to_dict()
376+
return self.sanitize_for_serialization(obj_dict)
377+
374378
return {
375379
key: self.sanitize_for_serialization(val)
376380
for key, val in obj_dict.items()

0 commit comments

Comments
 (0)