From 47fbccd8c1ed49fe3be1790884e68a8b7f308773 Mon Sep 17 00:00:00 2001 From: bundesbot Date: Sat, 19 Feb 2022 16:10:48 +0000 Subject: [PATCH] Generate newest code from openapi.yaml --- python-client/.openapi-generator/VERSION | 2 +- .../deutschland/mudab/api/default_api.py | 45 +++++++++++++++++++ python-client/deutschland/mudab/api_client.py | 8 ++-- .../deutschland/mudab/model/__init__.py | 2 +- .../deutschland/mudab/model_utils.py | 19 ++++---- python-client/sphinx-docs/conf.py | 2 +- 6 files changed, 61 insertions(+), 17 deletions(-) diff --git a/python-client/.openapi-generator/VERSION b/python-client/.openapi-generator/VERSION index 0984c4c..5f68295 100644 --- a/python-client/.openapi-generator/VERSION +++ b/python-client/.openapi-generator/VERSION @@ -1 +1 @@ -5.4.0-SNAPSHOT \ No newline at end of file +6.0.0-SNAPSHOT \ No newline at end of file diff --git a/python-client/deutschland/mudab/api/default_api.py b/python-client/deutschland/mudab/api/default_api.py index 56b06f0..0402606 100644 --- a/python-client/deutschland/mudab/api/default_api.py +++ b/python-client/deutschland/mudab/api/default_api.py @@ -399,6 +399,10 @@ def list_mess_stationen(self, **kwargs): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) _content_type (str/None): force body content-type. Default is None and content-type will be predicted by allowed content-types and body. @@ -418,6 +422,7 @@ def list_mess_stationen(self, **kwargs): kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) + kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) kwargs["_content_type"] = kwargs.get("_content_type") kwargs["_host_index"] = kwargs.get("_host_index") return self.list_mess_stationen_endpoint.call_with_http_info(**kwargs) @@ -450,6 +455,10 @@ def list_parameter(self, **kwargs): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) _content_type (str/None): force body content-type. Default is None and content-type will be predicted by allowed content-types and body. @@ -469,6 +478,7 @@ def list_parameter(self, **kwargs): kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) + kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) kwargs["_content_type"] = kwargs.get("_content_type") kwargs["_host_index"] = kwargs.get("_host_index") return self.list_parameter_endpoint.call_with_http_info(**kwargs) @@ -501,6 +511,10 @@ def list_parameter_values(self, **kwargs): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) _content_type (str/None): force body content-type. Default is None and content-type will be predicted by allowed content-types and body. @@ -520,6 +534,7 @@ def list_parameter_values(self, **kwargs): kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) + kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) kwargs["_content_type"] = kwargs.get("_content_type") kwargs["_host_index"] = kwargs.get("_host_index") return self.list_parameter_values_endpoint.call_with_http_info(**kwargs) @@ -552,6 +567,10 @@ def list_parameters_biologie(self, **kwargs): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) _content_type (str/None): force body content-type. Default is None and content-type will be predicted by allowed content-types and body. @@ -571,6 +590,7 @@ def list_parameters_biologie(self, **kwargs): kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) + kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) kwargs["_content_type"] = kwargs.get("_content_type") kwargs["_host_index"] = kwargs.get("_host_index") return self.list_parameters_biologie_endpoint.call_with_http_info(**kwargs) @@ -603,6 +623,10 @@ def list_parameters_biota(self, **kwargs): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) _content_type (str/None): force body content-type. Default is None and content-type will be predicted by allowed content-types and body. @@ -622,6 +646,7 @@ def list_parameters_biota(self, **kwargs): kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) + kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) kwargs["_content_type"] = kwargs.get("_content_type") kwargs["_host_index"] = kwargs.get("_host_index") return self.list_parameters_biota_endpoint.call_with_http_info(**kwargs) @@ -654,6 +679,10 @@ def list_parameters_sediment(self, **kwargs): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) _content_type (str/None): force body content-type. Default is None and content-type will be predicted by allowed content-types and body. @@ -673,6 +702,7 @@ def list_parameters_sediment(self, **kwargs): kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) + kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) kwargs["_content_type"] = kwargs.get("_content_type") kwargs["_host_index"] = kwargs.get("_host_index") return self.list_parameters_sediment_endpoint.call_with_http_info(**kwargs) @@ -705,6 +735,10 @@ def list_parameters_wasser(self, **kwargs): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) _content_type (str/None): force body content-type. Default is None and content-type will be predicted by allowed content-types and body. @@ -724,6 +758,7 @@ def list_parameters_wasser(self, **kwargs): kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) + kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) kwargs["_content_type"] = kwargs.get("_content_type") kwargs["_host_index"] = kwargs.get("_host_index") return self.list_parameters_wasser_endpoint.call_with_http_info(**kwargs) @@ -756,6 +791,10 @@ def list_plc_stations(self, **kwargs): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) _content_type (str/None): force body content-type. Default is None and content-type will be predicted by allowed content-types and body. @@ -775,6 +814,7 @@ def list_plc_stations(self, **kwargs): kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) + kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) kwargs["_content_type"] = kwargs.get("_content_type") kwargs["_host_index"] = kwargs.get("_host_index") return self.list_plc_stations_endpoint.call_with_http_info(**kwargs) @@ -807,6 +847,10 @@ def list_projekt_stationen(self, **kwargs): _check_return_type (bool): specifies if type checking should be done one the data received from the server. Default is True. + _spec_property_naming (bool): True if the variable names in the input data + are serialized names, as specified in the OpenAPI document. + False if the variable names in the input data + are pythonic names, e.g. snake case (default) _content_type (str/None): force body content-type. Default is None and content-type will be predicted by allowed content-types and body. @@ -826,6 +870,7 @@ def list_projekt_stationen(self, **kwargs): kwargs["_request_timeout"] = kwargs.get("_request_timeout", None) kwargs["_check_input_type"] = kwargs.get("_check_input_type", True) kwargs["_check_return_type"] = kwargs.get("_check_return_type", True) + kwargs["_spec_property_naming"] = kwargs.get("_spec_property_naming", False) kwargs["_content_type"] = kwargs.get("_content_type") kwargs["_host_index"] = kwargs.get("_host_index") return self.list_projekt_stationen_endpoint.call_with_http_info(**kwargs) diff --git a/python-client/deutschland/mudab/api_client.py b/python-client/deutschland/mudab/api_client.py index df5738a..188584c 100644 --- a/python-client/deutschland/mudab/api_client.py +++ b/python-client/deutschland/mudab/api_client.py @@ -755,6 +755,7 @@ def __init__( "_check_input_type", "_check_return_type", "_content_type", + "_spec_property_naming", ] ) self.params_map["nullable"].extend(["_request_timeout"]) @@ -777,6 +778,7 @@ def __init__( "_return_http_data_only": (bool,), "_check_input_type": (bool,), "_check_return_type": (bool,), + "_spec_property_naming": (bool,), "_content_type": (none_type, str), } self.openapi_types.update(extra_types) @@ -809,7 +811,7 @@ def __validate_inputs(self, kwargs): value, self.openapi_types[key], [key], - False, + kwargs["_spec_property_naming"], kwargs["_check_input_type"], configuration=self.api_client.configuration, ) @@ -838,12 +840,12 @@ def __gather_params(self, kwargs): if param_location == "form" and self.openapi_types[param_name] == ( file_type, ): - params["file"][param_name] = [param_value] + params["file"][base_name] = [param_value] elif param_location == "form" and self.openapi_types[param_name] == ( [file_type], ): # param_value is already a list - params["file"][param_name] = param_value + params["file"][base_name] = param_value elif param_location in {"form", "query"}: param_value_full = (base_name, param_value) params[param_location].append(param_value_full) diff --git a/python-client/deutschland/mudab/model/__init__.py b/python-client/deutschland/mudab/model/__init__.py index cfe32b7..5e54c9f 100644 --- a/python-client/deutschland/mudab/model/__init__.py +++ b/python-client/deutschland/mudab/model/__init__.py @@ -2,4 +2,4 @@ # reference which would not work in python2 # do not import all models into this module because that uses a lot of memory and stack frames # if you need the ability to import all models from one package, import them with -# from {{packageName}.models import ModelA, ModelB +# from deutschland.mudab.models import ModelA, ModelB diff --git a/python-client/deutschland/mudab/model_utils.py b/python-client/deutschland/mudab/model_utils.py index 9aa7f3d..9f7d4f4 100644 --- a/python-client/deutschland/mudab/model_utils.py +++ b/python-client/deutschland/mudab/model_utils.py @@ -1696,6 +1696,11 @@ def model_to_dict(model_instance, serialize=True): attribute_map """ result = {} + extract_item = ( + lambda item: (item[0], model_to_dict(item[1], serialize=serialize)) + if hasattr(item[1], "_data_store") + else item + ) model_instances = [model_instance] if model_instance._composed_schemas: @@ -1725,21 +1730,13 @@ def model_to_dict(model_instance, serialize=True): res.append(v) elif isinstance(v, ModelSimple): res.append(v.value) + elif isinstance(v, dict): + res.append(dict(map(extract_item, v.items()))) else: res.append(model_to_dict(v, serialize=serialize)) result[attr] = res elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: ( - item[0], - model_to_dict(item[1], serialize=serialize), - ) - if hasattr(item[1], "_data_store") - else item, - value.items(), - ) - ) + result[attr] = dict(map(extract_item, value.items())) elif isinstance(value, ModelSimple): result[attr] = value.value elif hasattr(value, "_data_store"): diff --git a/python-client/sphinx-docs/conf.py b/python-client/sphinx-docs/conf.py index fa24ec4..8460dbf 100644 --- a/python-client/sphinx-docs/conf.py +++ b/python-client/sphinx-docs/conf.py @@ -22,7 +22,7 @@ # -- Project information ----------------------------------------------------- project = "mudab-api" -copyright = "2021, BundesAPI" +copyright = "2022, BundesAPI" author = "BundesAPI" # The short X.Y version