diff --git a/doc/api/garage-admin-v2.json b/doc/api/garage-admin-v2.json index 0d1f78e8..82beb0c9 100644 --- a/doc/api/garage-admin-v2.json +++ b/doc/api/garage-admin-v2.json @@ -3922,23 +3922,26 @@ } }, { - "allOf": [ - { - "$ref": "#/components/schemas/NodeAssignedRole" - }, - { - "type": "object", - "required": [ - "id" - ], - "properties": { - "id": { - "type": "string", - "description": "ID of the node for which this change applies" - } - } + "$ref": "#/components/schemas/NodeRoleUpdate" + } + ] + }, + "NodeRoleUpdate": { + "allOf": [ + { + "$ref": "#/components/schemas/NodeAssignedRole" + }, + { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string", + "description": "ID of the node for which this change applies" } - ] + } } ] }, diff --git a/src/api/admin/openapi.rs b/src/api/admin/openapi.rs index 285d499c..0b7910e5 100644 --- a/src/api/admin/openapi.rs +++ b/src/api/admin/openapi.rs @@ -293,13 +293,16 @@ pub enum NodeRoleChangeOpenapi { /// Set `remove` to `true` to remove the node from the layout remove: bool, }, - #[serde(rename_all = "camelCase")] - Update { - /// ID of the node for which this change applies - id: String, - #[serde(flatten)] - role: NodeAssignedRole, - }, + Update(NodeRoleUpdate), +} + +#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct NodeRoleUpdate { + /// ID of the node for which this change applies + id: String, + #[serde(flatten)] + role: NodeAssignedRole, } #[utoipa::path(post,