Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/controllers/krate/owners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ pub struct ModifyResponse {
put,
path = "/api/v1/crates/{name}/owners",
params(CratePath),
request_body = inline(ChangeOwnersRequest),
security(
("api_token" = []),
("cookie" = []),
Expand All @@ -140,6 +141,7 @@ pub async fn add_owners(
delete,
path = "/api/v1/crates/{name}/owners",
params(CratePath),
request_body = inline(ChangeOwnersRequest),
security(
("api_token" = []),
("cookie" = []),
Expand All @@ -156,8 +158,13 @@ pub async fn remove_owners(
modify_owners(app, path.name, parts, body, false).await
}

#[derive(Deserialize)]
#[derive(Deserialize, utoipa::ToSchema)]
pub struct ChangeOwnersRequest {
/// List of owner login names to add or remove.
///
/// For users, use just the username (e.g., `"octocat"`).
/// For GitHub teams, use the format `github:org:team` (e.g., `"github:rust-lang:owners"`).
#[schema(example = json!(["octocat", "github:rust-lang:owners"]))]
#[serde(alias = "users")]
owners: Vec<String>,
}
Expand Down
52 changes: 52 additions & 0 deletions src/tests/snapshots/integration__openapi__openapi_snapshot-2.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2590,6 +2590,32 @@ expression: response.json()
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"owners": {
"description": "List of owner login names to add or remove.\n\nFor users, use just the username (e.g., `\"octocat\"`).\nFor GitHub teams, use the format `github:org:team` (e.g., `\"github:rust-lang:owners\"`).",
"example": [
"octocat",
"github:rust-lang:owners"
],
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"owners"
],
"type": "object"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
Expand Down Expand Up @@ -2684,6 +2710,32 @@ expression: response.json()
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"properties": {
"owners": {
"description": "List of owner login names to add or remove.\n\nFor users, use just the username (e.g., `\"octocat\"`).\nFor GitHub teams, use the format `github:org:team` (e.g., `\"github:rust-lang:owners\"`).",
"example": [
"octocat",
"github:rust-lang:owners"
],
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"owners"
],
"type": "object"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
Expand Down