From d6cbd6dc263ae6c7ec23c0a04dfc3596bedf02dd Mon Sep 17 00:00:00 2001 From: Artem Goncharov Date: Thu, 8 May 2025 15:40:18 +0200 Subject: [PATCH] Fix server schema image in the server response may be an empty string if the server was provisioned from a volume. Change-Id: I4ec1d5391d373ec1aaba40b0547b06ebc9629ec2 --- codegenerator/openapi/nova_schemas.py | 31 +++++++++++++++++++-------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/codegenerator/openapi/nova_schemas.py b/codegenerator/openapi/nova_schemas.py index 341cca4..a339fb6 100644 --- a/codegenerator/openapi/nova_schemas.py +++ b/codegenerator/openapi/nova_schemas.py @@ -1529,16 +1529,29 @@ SERVER_SCHEMA: dict[str, Any] = { "readOnly": True, }, "image": { - "type": "object", - "description": "The image property as returned from server.", - "properties": { - "id": { - "type": "string", - "format": "uuid", - "description": "The image ID", + "oneOf": [ + { + "type": "object", + "description": "The image property as returned from server.", + "properties": { + "id": { + "type": "string", + "format": "uuid", + "description": "The image ID", + }, + "links": { + "description": "Image links", + **LINKS_SCHEMA, + }, + "properties": { + "type": "object", + "x-openstack": {"min-ver": "2.98"}, + }, + }, + "required": ["id"], }, - "links": {"description": "Image links", **LINKS_SCHEMA}, - }, + {"type": "string", "enum": [""]}, + ] }, "OS-EXT-SRV-ATTR:instance_name": { "type": "string",