From 1ba874aee4e776d4d250c7ec8f274a087b887e70 Mon Sep 17 00:00:00 2001 From: Antal Nemes Date: Mon, 3 Feb 2025 12:29:26 +0100 Subject: [PATCH 1/2] Fix invalid OAS2 basePath (#75) Per OAS2, `basePath` should either be omitted or set to `/`. Since all generated paths are absolute, this commits sets it to `/`. Signed-off-by: Antal Nemes (antal.nemes@gmail.com) --- lib/swagger_final_path_processing.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/swagger_final_path_processing.py b/lib/swagger_final_path_processing.py index 7f8a001..fd5f249 100644 --- a/lib/swagger_final_path_processing.py +++ b/lib/swagger_final_path_processing.py @@ -44,7 +44,7 @@ def process_output( 'basic_auth': { 'type': 'basic' }}, - 'basePath': '', + 'basePath': '/', 'produces': [ 'application/json' ], @@ -159,4 +159,4 @@ def remove_query_params(self, path_dict): operation_dict['parameters'].append(q_param) path_dict[new_path] = path_dict.pop(old_path) for path in paths_to_delete: - del path_dict[path] \ No newline at end of file + del path_dict[path] From dde3f488c0168d54ca33b2147cda1568318d1be4 Mon Sep 17 00:00:00 2001 From: Antal Nemes Date: Mon, 3 Feb 2025 12:30:49 +0100 Subject: [PATCH 2/2] Fix OAS2 generation for formData parameters (#76) Required `formData` parameters set `required` to string value instead of boolean. This caused OAS2 validation to fail. This commit fixes the type of the required formData parameters. Signed-off-by: Antal Nemes (antal.nemes@gmail.com) --- lib/api_endpoint/swagger2/api_swagger_parameter_handler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/api_endpoint/swagger2/api_swagger_parameter_handler.py b/lib/api_endpoint/swagger2/api_swagger_parameter_handler.py index c7655d3..83d95d1 100644 --- a/lib/api_endpoint/swagger2/api_swagger_parameter_handler.py +++ b/lib/api_endpoint/swagger2/api_swagger_parameter_handler.py @@ -122,7 +122,7 @@ def wrap_form_data_params(self, type_dict, wrapper_name): "name": property_name} formDataEntry.update({k: v for k, v in property_value.items() if k in ['type', 'description']}) if "required" in definition and property_name in definition["required"]: - formDataEntry["required"] = "true"; + formDataEntry["required"] = True; parameter_list.append(formDataEntry) elif "$ref" in definition: reference = definition["$ref"].replace("#/definitions/", "")