You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: languages/python/templates/__init__package.mustache
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
{{! This template was customized. See https://github.com/OpenAPITools/openapi-generator/blob/v7.20.0/modules/openapi-generator/src/main/resources/python/__init__package.mustache for the original template }}
1
+
{{! This template was customized. See https://github.com/OpenAPITools/openapi-generator/blob/v7.22.0/modules/openapi-generator/src/main/resources/python/__init__package.mustache for the original template }}
Copy file name to clipboardExpand all lines: languages/python/templates/api.mustache
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,8 @@
1
-
{{! This template was customized. See https://github.com/OpenAPITools/openapi-generator/blob/v7.20.0/modules/openapi-generator/src/main/resources/python/api.mustache for the original template }}
1
+
{{! This template was customized. See https://github.com/OpenAPITools/openapi-generator/blob/v7.22.0/modules/openapi-generator/src/main/resources/python/api.mustache for the original template }}
2
2
# coding: utf-8
3
3
4
4
{{>partial_header}}
5
+
5
6
import warnings
6
7
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
7
8
from typing import Any, Dict, List, Optional, Tuple, Union
Copy file name to clipboardExpand all lines: languages/python/templates/api_client.mustache
+20-20Lines changed: 20 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,9 @@
1
-
{{! This template was customized. See https://github.com/OpenAPITools/openapi-generator/blob/v7.20.0/modules/openapi-generator/src/main/resources/python/api_client.mustache for the original template }}
1
+
{{! This template was customized. See https://github.com/OpenAPITools/openapi-generator/blob/v7.22.0/modules/openapi-generator/src/main/resources/python/api_client.mustache for the original template }}
Copy file name to clipboardExpand all lines: languages/python/templates/exceptions.mustache
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
{{! This template was customized. See https://github.com/OpenAPITools/openapi-generator/blob/v7.20.0/modules/openapi-generator/src/main/resources/python/exceptions.mustache for the original template }}
1
+
{{! This template was customized. See https://github.com/OpenAPITools/openapi-generator/blob/v7.22.0/modules/openapi-generator/src/main/resources/python/exceptions.mustache for the original template }}
2
2
# coding: utf-8
3
3
4
4
{{>partial_header}}
@@ -96,9 +96,9 @@ class ApiKeyError(OpenApiException, KeyError):
96
96
class ApiException(OpenApiException):
97
97
98
98
def __init__(
99
-
self,
100
-
status=None,
101
-
reason=None,
99
+
self,
100
+
status=None,
101
+
reason=None,
102
102
http_resp=None,
103
103
*,
104
104
body: Optional[str] = None,
@@ -124,10 +124,10 @@ class ApiException(OpenApiException):
Copy file name to clipboardExpand all lines: languages/python/templates/model_generic.mustache
+60-15Lines changed: 60 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
{{! This template was customized. See https://github.com/OpenAPITools/openapi-generator/blob/v7.20.0/modules/openapi-generator/src/main/resources/python/model_generic.mustache for the original template }}
1
+
{{! This template was customized. See https://github.com/OpenAPITools/openapi-generator/blob/v7.22.0/modules/openapi-generator/src/main/resources/python/model_generic.mustache for the original template }}
2
2
from __future__ import annotations
3
3
import pprint
4
4
import re # noqa: F401
@@ -15,6 +15,7 @@ from pydantic import field_validator
15
15
{{! TEMPLATE CUSTOMIZATION - END - import for workaround below }}
16
16
from typing import Optional, Set
17
17
from typing_extensions import Self
18
+
from pydantic_core import to_jsonable_python
18
19
19
20
{{#hasChildren}}
20
21
{{#discriminator}}
@@ -56,6 +57,9 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
56
57
57
58
{{/isNullable}}
58
59
{{/required}}
60
+
if not isinstance(value, str):
61
+
value = str(value)
62
+
59
63
if not re.match(r"{{{.}}}", value{{#vendorExtensions.x-modifiers}} ,re.{{{.}}}{{/vendorExtensions.x-modifiers}}):
60
64
raise ValueError(r"must validate the regular expression {{{vendorExtensions.x-pattern}}}")
61
65
return value
@@ -114,7 +118,8 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
114
118
{{/vars}}
115
119
116
120
model_config = ConfigDict(
117
-
populate_by_name=True,
121
+
validate_by_name=True,
122
+
validate_by_alias=True,
118
123
validate_assignment=True,
119
124
protected_namespaces=(),
120
125
)
@@ -147,8 +152,7 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}
147
152
148
153
def to_json(self) -> str:
149
154
"""Returns the JSON representation of the model using alias"""
150
-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
Copy file name to clipboardExpand all lines: languages/python/templates/model_oneof.mustache
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
{{! This template was customized. See https://github.com/OpenAPITools/openapi-generator/blob/v7.20.0/modules/openapi-generator/src/main/resources/python/model_oneof.mustache for the original template }}
1
+
{{! This template was customized. See https://github.com/OpenAPITools/openapi-generator/blob/v7.22.0/modules/openapi-generator/src/main/resources/python/model_oneof.mustache for the original template }}
Copy file name to clipboardExpand all lines: languages/python/templates/rest.mustache
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,13 @@
1
-
{{! This template was customized. See https://github.com/OpenAPITools/openapi-generator/blob/v7.20.0/modules/openapi-generator/src/main/resources/python/rest.mustache for the original template }}
1
+
{{! This template was customized. See https://github.com/OpenAPITools/openapi-generator/blob/v7.22.0/modules/openapi-generator/src/main/resources/python/rest.mustache for the original template }}
2
2
# coding: utf-8
3
3
4
4
{{>partial_header}}
5
5
6
+
6
7
import io
7
8
import json
8
9
import re
10
+
import ssl
9
11
10
12
{{! TEMPLATE CUSTOMIZATION - BEGIN - requests instead of urllib3 }}
0 commit comments