Ensure BS responses have some properties marked as required

In the TUI absense of "required" leads to ID/NAME being optional what those
could never be.  In adition also ensure that the response struct as well as
fields themselves are public so that we can consume them.

Change-Id: I7850b6de85a1e2aa74d597bca7226430bb45cb2c
This commit is contained in:
Artem Goncharov 2025-02-24 18:42:56 +01:00
parent 8995fa42b2
commit a40cf11ee5
9 changed files with 27 additions and 2 deletions

View File

@ -76,6 +76,7 @@ ATTACHMENT_DETAIL_SCHEMA: dict[str, Any] = {
},
**ATTACHMENT_SCHEMA["properties"],
},
"required": ["id", "instance", "name", "status", "volume_id"],
}
ATTACHMENT_CONTAINER_SCHEMA: dict[str, Any] = {

View File

@ -87,6 +87,7 @@ BACKUP_SHORT_SCHEMA: dict[str, Any] = {
"description": "The UUID of the backup.",
},
},
"required": ["id", "name"],
}
BACKUP_SCHEMA: dict[str, Any] = {
@ -170,6 +171,7 @@ BACKUP_SCHEMA: dict[str, Any] = {
"description": "The UUID of the volume.",
},
},
"required": ["id", "name", "size", "status", "volume_id"],
}
BACKUPS_SCHEMA: dict[str, Any] = {

View File

@ -136,6 +136,7 @@ GROUP_DETAIL_SCHEMA: dict[str, Any] = {
},
**GROUP_SCHEMA["properties"],
},
"required": ["id", "name"],
}
GROUPS_SCHEMA: dict[str, Any] = {

View File

@ -117,6 +117,7 @@ GROUP_SNAPSHOT_DETAIL_SCHEMA: dict[str, Any] = {
},
**GROUP_SNAPSHOT_SCHEMA["properties"],
},
"required": ["id", "name", "status"],
}
GROUP_SNAPSHOTS_SCHEMA: dict[str, Any] = {

View File

@ -95,6 +95,7 @@ GROUP_TYPE_SCHEMA: dict[str, Any] = {
},
"group_specs": GROUP_SPEC_SCHEMA,
},
"required": ["id", "name"],
}
GROUP_TYPES_SCHEMA: dict[str, Any] = {

View File

@ -117,6 +117,7 @@ SNAPSHOT_DETAIL_SCHEMA: dict[str, Any] = {
},
**SNAPSHOT_SCHEMA["properties"],
},
"required": ["created_at", "id", "name", "size", "status", "updated_at"],
}
SNAPSHOT_CONTAINER_SCHEMA: dict[str, Any] = {

View File

@ -65,6 +65,7 @@ VOLUME_SHORT_SCHEMA: dict[str, Any] = {
"description": "The UUID of the volume.",
},
},
"required": ["id", "name"],
}
VOLUME_SCHEMA: dict[str, Any] = {
@ -108,6 +109,10 @@ VOLUME_SCHEMA: dict[str, Any] = {
"type": "string",
"description": "The name of the availability zone.",
},
"bootable": {
"type": "boolean",
"description": "Enables or disables the bootable attribute. You can boot an instance from a bootable volume.",
},
"multiattach": {
"type": "boolean",
"description": "If true, this volume can attach to more than one instance.",
@ -193,6 +198,18 @@ VOLUME_SCHEMA: dict[str, Any] = {
"x-openstack": {"min-ver": "3.65"},
},
},
"required": [
"attachments",
"bootable",
"encrypted",
"id",
"migration_status",
"name",
"replication_status",
"size",
"status",
"user_id",
],
"additionalProperties": True,
}

View File

@ -51,6 +51,7 @@ VOLUME_TYPE_SCHEMA: dict[str, Any] = {
"description": "The QoS specifications ID.",
},
},
"required": ["id", "name"],
}
VOLUME_TYPE_CONTAINER_SCHEMA: dict[str, Any] = {

View File

@ -227,13 +227,13 @@ impl ConfirmableRequest for {{ class_name }} {
/// {{ response_class_name }} response representation
#[derive(Deserialize, Serialize)]
#[derive(Clone, StructTable)]
struct {{ response_class_name }} {
pub struct {{ response_class_name }} {
{%- for k, v in data_type.fields | dictsort %}
{% if not (operation_type == "list" and k in ["links"]) %}
{{ macros.docstring(v.description, indent=4) }}
{{ v.serde_macros }}
{{ v.get_structable_macros(data_type, sdk_service_name, resource_name, operation_type) }}
{{ v.local_name }}: {{ v.type_hint }},
pub {{ v.local_name }}: {{ v.type_hint }},
{%- endif %}
{%- endfor %}