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
This commit is contained in:
Gorka Eguileor
2025-05-20 16:24:27 +02:00
parent 4a711b1a2c
commit 40b76e1500

View File

@@ -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] = {