From f6b1407e4c34c30001acacb4e782109b4de34579 Mon Sep 17 00:00:00 2001 From: Jason Song Date: Thu, 1 Aug 2024 17:33:40 +0800 Subject: [PATCH] Add permission description for API to add repo collaborator (#31744) Fix #31552. (cherry picked from commit 333c9ed8cab961b6dd58b04edc47a57dc4d6dbab) --- modules/structs/repo_collaborator.go | 1 + templates/swagger/v1_json.tmpl | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/modules/structs/repo_collaborator.go b/modules/structs/repo_collaborator.go index 946a6ec7e7..7d39b5a798 100644 --- a/modules/structs/repo_collaborator.go +++ b/modules/structs/repo_collaborator.go @@ -5,6 +5,7 @@ package structs // AddCollaboratorOption options when adding a user as a collaborator of a repository type AddCollaboratorOption struct { + // enum: read,write,admin Permission *string `json:"permission"` } diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 3379e3f4dc..d14e7c4b66 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -19925,6 +19925,11 @@ "properties": { "permission": { "type": "string", + "enum": [ + "read", + "write", + "admin" + ], "x-go-name": "Permission" } },