From 40b76e1500b09b22ea7c807cad55c41e9e6f8dfb Mon Sep 17 00:00:00 2001 From: Gorka Eguileor Date: 2025年5月20日 16:24:27 +0200 Subject: [PATCH] OpenAPI: Fix nova examples When generating the nova AZ detail schema we are adding examples to the `hosts` object, but we are doing it wrong: - We are adding a dictionary instead of a list, which is what the plural form of example indicates and also what we can see in the OpenAPI spec documentation [1]. - The contents of the example are wrong, it shouldn't have the `JSON request` key, as we can see in the upstream docs [2]. This patch fixes the examples to be correct. [1]: https://swagger.io/specification/#model-with-example [2]: https://docs.openstack.org/api-ref/compute/#get-detailed-availability-zone-information Change-Id: Ic694ee083f55d44d0ecdb8a72561e24ec1b70583 --- codegenerator/openapi/nova_schemas.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/codegenerator/openapi/nova_schemas.py b/codegenerator/openapi/nova_schemas.py index a339fb6..c4472e5 100644 --- a/codegenerator/openapi/nova_schemas.py +++ b/codegenerator/openapi/nova_schemas.py @@ -204,8 +204,8 @@ AZ_DETAIL_SCHEMA: dict[str, Any] = copy.deepcopy(AZ_SCHEMA) AZ_DETAIL_SCHEMA["properties"]["hosts"] = { "type": "object", "description": "An object containing a list of host information. The host information is comprised of host and service objects. The service object returns three parameters representing the states of the service: active, available, and updated_at.", - "examples": { - "JSON request": { + "examples": [ + { "conductor": { "nova-conductor": { "active": True, @@ -221,7 +221,7 @@ AZ_DETAIL_SCHEMA["properties"]["hosts"] = { } }, } - }, + ], } AZ_LIST_SCHEMA: dict[str, Any] = {

AltStyle によって変換されたページ (->オリジナル) /