mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2026-04-26 22:24:18 +00:00
feat(python): expose all config properties in constructor (#23021)
* templates * samples * scope to python generator * address suggestions * revert pydantic-v1
This commit is contained in:
@@ -158,6 +158,8 @@ class Configuration:
|
||||
string values to replace variables in templated server configuration.
|
||||
The validation of enums is performed for variables with defined enum
|
||||
values before.
|
||||
:param verify_ssl: bool - Set this to false to skip verifying SSL certificate
|
||||
when calling API from https server.
|
||||
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
|
||||
in PEM format.
|
||||
:param retries: int | urllib3.util.retry.Retry - Retry configuration.
|
||||
@@ -165,6 +167,16 @@ class Configuration:
|
||||
in PEM (str) or DER (bytes) format.
|
||||
:param cert_file: the path to a client certificate file, for mTLS.
|
||||
:param key_file: the path to a client key file, for mTLS.
|
||||
:param assert_hostname: Set this to True/False to enable/disable SSL hostname verification.
|
||||
:param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server.
|
||||
:param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync.
|
||||
:param proxy: Proxy URL.
|
||||
:param proxy_headers: Proxy headers.
|
||||
:param safe_chars_for_path_param: Safe characters for path parameter encoding.
|
||||
:param client_side_validation: Enable client-side validation. Default True.
|
||||
:param socket_options: Options to pass down to the underlying urllib3 socket.
|
||||
:param datetime_format: Datetime format string for serialization.
|
||||
:param date_format: Date format string for serialization.
|
||||
|
||||
:Example:
|
||||
|
||||
@@ -205,6 +217,17 @@ conf = openapi_client.Configuration(
|
||||
ca_cert_data: Optional[Union[str, bytes]] = None,
|
||||
cert_file: Optional[str]=None,
|
||||
key_file: Optional[str]=None,
|
||||
verify_ssl: bool=True,
|
||||
assert_hostname: Optional[bool]=None,
|
||||
tls_server_name: Optional[str]=None,
|
||||
connection_pool_maxsize: Optional[int]=None,
|
||||
proxy: Optional[str]=None,
|
||||
proxy_headers: Optional[Any]=None,
|
||||
safe_chars_for_path_param: str='',
|
||||
client_side_validation: bool=True,
|
||||
socket_options: Optional[Any]=None,
|
||||
datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z",
|
||||
date_format: str="%Y-%m-%d",
|
||||
*,
|
||||
debug: Optional[bool] = None,
|
||||
) -> None:
|
||||
@@ -274,7 +297,7 @@ conf = openapi_client.Configuration(
|
||||
"""Debug switch
|
||||
"""
|
||||
|
||||
self.verify_ssl = True
|
||||
self.verify_ssl = verify_ssl
|
||||
"""SSL/TLS verification
|
||||
Set this to false to skip verifying SSL certificate when calling API
|
||||
from https server.
|
||||
@@ -292,46 +315,43 @@ conf = openapi_client.Configuration(
|
||||
self.key_file = key_file
|
||||
"""client key file
|
||||
"""
|
||||
self.assert_hostname = None
|
||||
self.assert_hostname = assert_hostname
|
||||
"""Set this to True/False to enable/disable SSL hostname verification.
|
||||
"""
|
||||
self.tls_server_name = None
|
||||
self.tls_server_name = tls_server_name
|
||||
"""SSL/TLS Server Name Indication (SNI)
|
||||
Set this to the SNI value expected by the server.
|
||||
"""
|
||||
|
||||
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
|
||||
self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else multiprocessing.cpu_count() * 5
|
||||
"""urllib3 connection pool's maximum number of connections saved
|
||||
per pool. urllib3 uses 1 connection as default value, but this is
|
||||
not the best value when you are making a lot of possibly parallel
|
||||
requests to the same host, which is often the case here.
|
||||
cpu_count * 5 is used as default value to increase performance.
|
||||
per pool. None in the constructor is coerced to cpu_count * 5.
|
||||
"""
|
||||
|
||||
self.proxy: Optional[str] = None
|
||||
self.proxy = proxy
|
||||
"""Proxy URL
|
||||
"""
|
||||
self.proxy_headers = None
|
||||
self.proxy_headers = proxy_headers
|
||||
"""Proxy headers
|
||||
"""
|
||||
self.safe_chars_for_path_param = ''
|
||||
self.safe_chars_for_path_param = safe_chars_for_path_param
|
||||
"""Safe chars for path_param
|
||||
"""
|
||||
self.retries = retries
|
||||
"""Retry configuration
|
||||
"""
|
||||
# Enable client side validation
|
||||
self.client_side_validation = True
|
||||
self.client_side_validation = client_side_validation
|
||||
|
||||
self.socket_options = None
|
||||
self.socket_options = socket_options
|
||||
"""Options to pass down to the underlying urllib3 socket
|
||||
"""
|
||||
|
||||
self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z"
|
||||
self.datetime_format = datetime_format
|
||||
"""datetime format
|
||||
"""
|
||||
|
||||
self.date_format = "%Y-%m-%d"
|
||||
self.date_format = date_format
|
||||
"""date format
|
||||
"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user