From fdf8bda6beebac9e699428d4efc7616b9edbe93f Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Mon, 8 Jul 2024 10:06:08 +0200 Subject: [PATCH] Fix nova schema workaround Nova fixed server_groups schema in that it replaced corrupted policies array with a new "prefixItems" key what breaks the workaround. Add additional check into the workaround. Change-Id: I4bea8419b37d9daf10b2b5891917793c6b3a57ff --- codegenerator/openapi/base.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/codegenerator/openapi/base.py b/codegenerator/openapi/base.py index 6651805..7357aab 100644 --- a/codegenerator/openapi/base.py +++ b/codegenerator/openapi/base.py @@ -1077,8 +1077,14 @@ class OpenStackServerSourceBase: if typ == "array" and "additionalItems" in v: # additionalItems have nothing to do under the type array (create servergroup) schema.properties[k].pop("additionalItems") - if typ == "array" and isinstance(v["items"], list): + if ( + typ == "array" + and "items" in v + and isinstance(v["items"], list) + ): # server_group create - type array "items" is a dict and not list + # NOTE: server_groups recently changed to "prefixItems", + # so this may be not necessary anymore schema.properties[k]["items"] = v["items"][0] if start_version and self._api_ver_major(start_version) not in [ "0",