From 8a10a63394f8e73ee1fa9d59a2fbe8e5b1cf0c2b Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Tue, 13 May 2025 08:11:52 +0200 Subject: [PATCH] Address explicit nullable types in network Some conversion schemes missed explicit null support. Change-Id: I01ed16f2690c78492a0d8673ad86f67de92c80ae --- codegenerator/openapi/neutron.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codegenerator/openapi/neutron.py b/codegenerator/openapi/neutron.py index 82b2161..84dc095 100644 --- a/codegenerator/openapi/neutron.py +++ b/codegenerator/openapi/neutron.py @@ -1345,7 +1345,7 @@ def get_schema(param_data): elif "type:list_of_any_key_specs_or_none" in schema_data: logging.warning("TODO: Implement type:list_of_any_key_specs_or_none") schema = { - "type": "array", + "type": ["array", "null"], "items": {"type": "object", "extraProperties": True}, "x-openstack": {"todo": "implementme"}, } @@ -1356,7 +1356,7 @@ def get_schema(param_data): elif "type:ip_address" in schema_data: schema = {"type": "string"} elif "type:ip_address_or_none" in schema_data: - schema = {"type": "string"} + schema = {"type": ["string", "null"]} elif "type:subnet_or_none" in schema_data: schema = {"type": ["string", "null"]} elif "type:fip_dns_host_name" in schema_data: @@ -1407,7 +1407,7 @@ def get_schema(param_data): elif "type:dict_or_empty" in schema_data: schema = get_schema(schema_data["type:dict_or_empty"]) elif "type:list_of_subnets_or_none" in schema_data: - schema = {"type": "array", "items": {"type": "string"}} + schema = {"type": ["array", "null"], "items": {"type": "string"}} if convert_to: # Nice way to get type of the field, isn't it? if convert_to.__name__ == "convert_to_boolean":