From e7ca67071e391ae2c2cb08e34ae040a8d1053c12 Mon Sep 17 00:00:00 2001 From: Matthew Date: Sun, 9 Jan 2022 11:19:57 -0500 Subject: [PATCH] [python] Fix 10773 - Use base_name for file uploads in form data (#11182) * Use base_name for file uploads in form data * Added missed sample changes --- .../src/main/resources/python/api_client.mustache | 4 ++-- samples/client/petstore/python/petstore_api/api_client.py | 4 ++-- .../petstore_api/api_client.py | 4 ++-- .../x-auth-id-alias/python/x_auth_id_alias/api_client.py | 4 ++-- .../dynamic-servers/python/dynamic_servers/api_client.py | 4 ++-- .../client/petstore/python/petstore_api/api_client.py | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index b4d1260eb74..39f33aee0b3 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -774,11 +774,11 @@ class Endpoint(object): base_name = self.attribute_map[param_name] 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/samples/client/petstore/python/petstore_api/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py index e750f965b22..664cf1c917b 100644 --- a/samples/client/petstore/python/petstore_api/api_client.py +++ b/samples/client/petstore/python/petstore_api/api_client.py @@ -753,11 +753,11 @@ class Endpoint(object): base_name = self.attribute_map[param_name] 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/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py index e750f965b22..664cf1c917b 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py @@ -753,11 +753,11 @@ class Endpoint(object): base_name = self.attribute_map[param_name] 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/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api_client.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api_client.py index d7137238a17..e77be7a5319 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api_client.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api_client.py @@ -753,11 +753,11 @@ class Endpoint(object): base_name = self.attribute_map[param_name] 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/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api_client.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api_client.py index 470cc1aac89..e38f7442f7b 100644 --- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api_client.py +++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api_client.py @@ -753,11 +753,11 @@ class Endpoint(object): base_name = self.attribute_map[param_name] 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/samples/openapi3/client/petstore/python/petstore_api/api_client.py b/samples/openapi3/client/petstore/python/petstore_api/api_client.py index 9fbac41d73a..f29efaa1ce1 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -760,11 +760,11 @@ class Endpoint(object): base_name = self.attribute_map[param_name] 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)