Skip to content

Commit b536ae8

Browse files
committed
scope to python generator
1 parent 7948103 commit b536ae8

4 files changed

Lines changed: 53 additions & 77 deletions

File tree

modules/openapi-generator/src/main/resources/python-pydantic-v1/configuration.mustache

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,6 @@ conf = {{{packageName}}}.Configuration(
162162
server_index=None, server_variables=None,
163163
server_operation_index=None, server_operation_variables=None,
164164
verify_ssl=True, ssl_ca_cert=None,
165-
retries=None, cert_file=None, key_file=None,
166-
assert_hostname=None, tls_server_name=None,
167-
connection_pool_maxsize=None, proxy=None, proxy_headers=None,
168-
safe_chars_for_path_param='', client_side_validation=True,
169-
socket_options=None,
170-
datetime_format="{{{datetimeFormat}}}", date_format="{{{dateFormat}}}",
171165
) -> None:
172166
"""Constructor
173167
"""
@@ -244,28 +238,28 @@ conf = {{{packageName}}}.Configuration(
244238
self.ssl_ca_cert = ssl_ca_cert
245239
"""Set this to customize the certificate file to verify the peer.
246240
"""
247-
self.cert_file = cert_file
241+
self.cert_file = None
248242
"""client certificate file
249243
"""
250-
self.key_file = key_file
244+
self.key_file = None
251245
"""client key file
252246
"""
253-
self.assert_hostname = assert_hostname
247+
self.assert_hostname = None
254248
"""Set this to True/False to enable/disable SSL hostname verification.
255249
"""
256-
self.tls_server_name = tls_server_name
250+
self.tls_server_name = None
257251
"""SSL/TLS Server Name Indication (SNI)
258252
Set this to the SNI value expected by the server.
259253
"""
260254

261255
{{#asyncio}}
262-
self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else 100
256+
self.connection_pool_maxsize = 100
263257
"""This value is passed to the aiohttp to limit simultaneous connections.
264258
Default values is 100, None means no-limit.
265259
"""
266260
{{/asyncio}}
267261
{{^asyncio}}
268-
self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else multiprocessing.cpu_count() * 5
262+
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
269263
"""urllib3 connection pool's maximum number of connections saved
270264
per pool. urllib3 uses 1 connection as default value, but this is
271265
not the best value when you are making a lot of possibly parallel
@@ -274,30 +268,30 @@ conf = {{{packageName}}}.Configuration(
274268
"""
275269
{{/asyncio}}
276270

277-
self.proxy = proxy
271+
self.proxy = None
278272
"""Proxy URL
279273
"""
280-
self.proxy_headers = proxy_headers
274+
self.proxy_headers = None
281275
"""Proxy headers
282276
"""
283-
self.safe_chars_for_path_param = safe_chars_for_path_param
277+
self.safe_chars_for_path_param = ''
284278
"""Safe chars for path_param
285279
"""
286-
self.retries = retries
280+
self.retries = None
287281
"""Adding retries to override urllib3 default value 3
288282
"""
289283
# Enable client side validation
290-
self.client_side_validation = client_side_validation
284+
self.client_side_validation = True
291285

292-
self.socket_options = socket_options
286+
self.socket_options = None
293287
"""Options to pass down to the underlying urllib3 socket
294288
"""
295289

296-
self.datetime_format = datetime_format
290+
self.datetime_format = "{{{datetimeFormat}}}"
297291
"""datetime format
298292
"""
299293

300-
self.date_format = date_format
294+
self.date_format = "{{{dateFormat}}}"
301295
"""date format
302296
"""
303297

samples/client/echo_api/python-pydantic-v1/openapi_client/configuration.py

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,6 @@ def __init__(self, host=None,
9797
server_index=None, server_variables=None,
9898
server_operation_index=None, server_operation_variables=None,
9999
verify_ssl=True, ssl_ca_cert=None,
100-
retries=None, cert_file=None, key_file=None,
101-
assert_hostname=None, tls_server_name=None,
102-
connection_pool_maxsize=None, proxy=None, proxy_headers=None,
103-
safe_chars_for_path_param='', client_side_validation=True,
104-
socket_options=None,
105-
datetime_format="%Y-%m-%dT%H:%M:%S.%f%z", date_format="%Y-%m-%d",
106100
) -> None:
107101
"""Constructor
108102
"""
@@ -172,52 +166,52 @@ def __init__(self, host=None,
172166
self.ssl_ca_cert = ssl_ca_cert
173167
"""Set this to customize the certificate file to verify the peer.
174168
"""
175-
self.cert_file = cert_file
169+
self.cert_file = None
176170
"""client certificate file
177171
"""
178-
self.key_file = key_file
172+
self.key_file = None
179173
"""client key file
180174
"""
181-
self.assert_hostname = assert_hostname
175+
self.assert_hostname = None
182176
"""Set this to True/False to enable/disable SSL hostname verification.
183177
"""
184-
self.tls_server_name = tls_server_name
178+
self.tls_server_name = None
185179
"""SSL/TLS Server Name Indication (SNI)
186180
Set this to the SNI value expected by the server.
187181
"""
188182

189-
self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else multiprocessing.cpu_count() * 5
183+
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
190184
"""urllib3 connection pool's maximum number of connections saved
191185
per pool. urllib3 uses 1 connection as default value, but this is
192186
not the best value when you are making a lot of possibly parallel
193187
requests to the same host, which is often the case here.
194188
cpu_count * 5 is used as default value to increase performance.
195189
"""
196190

197-
self.proxy = proxy
191+
self.proxy = None
198192
"""Proxy URL
199193
"""
200-
self.proxy_headers = proxy_headers
194+
self.proxy_headers = None
201195
"""Proxy headers
202196
"""
203-
self.safe_chars_for_path_param = safe_chars_for_path_param
197+
self.safe_chars_for_path_param = ''
204198
"""Safe chars for path_param
205199
"""
206-
self.retries = retries
200+
self.retries = None
207201
"""Adding retries to override urllib3 default value 3
208202
"""
209203
# Enable client side validation
210-
self.client_side_validation = client_side_validation
204+
self.client_side_validation = True
211205

212-
self.socket_options = socket_options
206+
self.socket_options = None
213207
"""Options to pass down to the underlying urllib3 socket
214208
"""
215209

216-
self.datetime_format = datetime_format
210+
self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
217211
"""datetime format
218212
"""
219213

220-
self.date_format = date_format
214+
self.date_format = "%Y-%m-%d"
221215
"""date format
222216
"""
223217

samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/petstore_api/configuration.py

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -156,12 +156,6 @@ def __init__(self, host=None,
156156
server_index=None, server_variables=None,
157157
server_operation_index=None, server_operation_variables=None,
158158
verify_ssl=True, ssl_ca_cert=None,
159-
retries=None, cert_file=None, key_file=None,
160-
assert_hostname=None, tls_server_name=None,
161-
connection_pool_maxsize=None, proxy=None, proxy_headers=None,
162-
safe_chars_for_path_param='', client_side_validation=True,
163-
socket_options=None,
164-
datetime_format="%Y-%m-%dT%H:%M:%S.%f%z", date_format="%Y-%m-%d",
165159
) -> None:
166160
"""Constructor
167161
"""
@@ -236,49 +230,49 @@ def __init__(self, host=None,
236230
self.ssl_ca_cert = ssl_ca_cert
237231
"""Set this to customize the certificate file to verify the peer.
238232
"""
239-
self.cert_file = cert_file
233+
self.cert_file = None
240234
"""client certificate file
241235
"""
242-
self.key_file = key_file
236+
self.key_file = None
243237
"""client key file
244238
"""
245-
self.assert_hostname = assert_hostname
239+
self.assert_hostname = None
246240
"""Set this to True/False to enable/disable SSL hostname verification.
247241
"""
248-
self.tls_server_name = tls_server_name
242+
self.tls_server_name = None
249243
"""SSL/TLS Server Name Indication (SNI)
250244
Set this to the SNI value expected by the server.
251245
"""
252246

253-
self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else 100
247+
self.connection_pool_maxsize = 100
254248
"""This value is passed to the aiohttp to limit simultaneous connections.
255249
Default values is 100, None means no-limit.
256250
"""
257251

258-
self.proxy = proxy
252+
self.proxy = None
259253
"""Proxy URL
260254
"""
261-
self.proxy_headers = proxy_headers
255+
self.proxy_headers = None
262256
"""Proxy headers
263257
"""
264-
self.safe_chars_for_path_param = safe_chars_for_path_param
258+
self.safe_chars_for_path_param = ''
265259
"""Safe chars for path_param
266260
"""
267-
self.retries = retries
261+
self.retries = None
268262
"""Adding retries to override urllib3 default value 3
269263
"""
270264
# Enable client side validation
271-
self.client_side_validation = client_side_validation
265+
self.client_side_validation = True
272266

273-
self.socket_options = socket_options
267+
self.socket_options = None
274268
"""Options to pass down to the underlying urllib3 socket
275269
"""
276270

277-
self.datetime_format = datetime_format
271+
self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
278272
"""datetime format
279273
"""
280274

281-
self.date_format = date_format
275+
self.date_format = "%Y-%m-%d"
282276
"""date format
283277
"""
284278

samples/openapi3/client/petstore/python-pydantic-v1/petstore_api/configuration.py

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,6 @@ def __init__(self, host=None,
157157
server_index=None, server_variables=None,
158158
server_operation_index=None, server_operation_variables=None,
159159
verify_ssl=True, ssl_ca_cert=None,
160-
retries=None, cert_file=None, key_file=None,
161-
assert_hostname=None, tls_server_name=None,
162-
connection_pool_maxsize=None, proxy=None, proxy_headers=None,
163-
safe_chars_for_path_param='', client_side_validation=True,
164-
socket_options=None,
165-
datetime_format="%Y-%m-%dT%H:%M:%S.%f%z", date_format="%Y-%m-%d",
166160
) -> None:
167161
"""Constructor
168162
"""
@@ -237,52 +231,52 @@ def __init__(self, host=None,
237231
self.ssl_ca_cert = ssl_ca_cert
238232
"""Set this to customize the certificate file to verify the peer.
239233
"""
240-
self.cert_file = cert_file
234+
self.cert_file = None
241235
"""client certificate file
242236
"""
243-
self.key_file = key_file
237+
self.key_file = None
244238
"""client key file
245239
"""
246-
self.assert_hostname = assert_hostname
240+
self.assert_hostname = None
247241
"""Set this to True/False to enable/disable SSL hostname verification.
248242
"""
249-
self.tls_server_name = tls_server_name
243+
self.tls_server_name = None
250244
"""SSL/TLS Server Name Indication (SNI)
251245
Set this to the SNI value expected by the server.
252246
"""
253247

254-
self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else multiprocessing.cpu_count() * 5
248+
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
255249
"""urllib3 connection pool's maximum number of connections saved
256250
per pool. urllib3 uses 1 connection as default value, but this is
257251
not the best value when you are making a lot of possibly parallel
258252
requests to the same host, which is often the case here.
259253
cpu_count * 5 is used as default value to increase performance.
260254
"""
261255

262-
self.proxy = proxy
256+
self.proxy = None
263257
"""Proxy URL
264258
"""
265-
self.proxy_headers = proxy_headers
259+
self.proxy_headers = None
266260
"""Proxy headers
267261
"""
268-
self.safe_chars_for_path_param = safe_chars_for_path_param
262+
self.safe_chars_for_path_param = ''
269263
"""Safe chars for path_param
270264
"""
271-
self.retries = retries
265+
self.retries = None
272266
"""Adding retries to override urllib3 default value 3
273267
"""
274268
# Enable client side validation
275-
self.client_side_validation = client_side_validation
269+
self.client_side_validation = True
276270

277-
self.socket_options = socket_options
271+
self.socket_options = None
278272
"""Options to pass down to the underlying urllib3 socket
279273
"""
280274

281-
self.datetime_format = datetime_format
275+
self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
282276
"""datetime format
283277
"""
284278

285-
self.date_format = date_format
279+
self.date_format = "%Y-%m-%d"
286280
"""date format
287281
"""
288282

0 commit comments

Comments
 (0)