From 0376c09fc27d848dbac471b629c83fd7a231852b Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 26 Apr 2025 22:32:15 -0700 Subject: [PATCH] Update token creation API swagger documentation (#34288) Fix #34231 --- modules/structs/user_app.go | 4 +++- templates/swagger/v1_json.tmpl | 13 ++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/modules/structs/user_app.go b/modules/structs/user_app.go index a7d2e28b41..8401252bd6 100644 --- a/modules/structs/user_app.go +++ b/modules/structs/user_app.go @@ -23,9 +23,11 @@ type AccessToken struct { type AccessTokenList []*AccessToken // CreateAccessTokenOption options when create access token +// swagger:model CreateAccessTokenOption type CreateAccessTokenOption struct { // required: true - Name string `json:"name" binding:"Required"` + Name string `json:"name" binding:"Required"` + // example: ["all", "read:activitypub","read:issue", "write:misc", "read:notification", "read:organization", "read:package", "read:repository", "read:user"] Scopes []string `json:"scopes"` } diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 0a9432fc9d..8758b5c0a1 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -21350,7 +21350,18 @@ "items": { "type": "string" }, - "x-go-name": "Scopes" + "x-go-name": "Scopes", + "example": [ + "all", + "read:activitypub", + "read:issue", + "write:misc", + "read:notification", + "read:organization", + "read:package", + "read:repository", + "read:user" + ] } }, "x-go-package": "code.gitea.io/gitea/modules/structs"