diff options
author | zeripath <art27@cantab.net> | 2021-08-01 21:44:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-01 16:44:15 -0400 |
commit | 48c7c880b8fcf8e5d8495e66392e787bd7209b8c (patch) | |
tree | 8db19b925c3e1b6925688a77a40cd450715fc18f /routers | |
parent | e51c73ae5c03c83256d48cdcd0ca9cbdbf7a5222 (diff) | |
download | gitea-48c7c880b8fcf8e5d8495e66392e787bd7209b8c.tar.gz gitea-48c7c880b8fcf8e5d8495e66392e787bd7209b8c.zip |
Swagger AccessToken fixes (#16574)
There is a subtle problem with the Swagger definition for AccessTokens which causes
autogeneration of APIs for these endpoints to fail.
This PR corrects these errors.
Ref: https://github.com/zeripath/java-gitea-api/issues/4
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/swagger/app.go | 7 | ||||
-rw-r--r-- | routers/api/v1/swagger/options.go | 3 | ||||
-rw-r--r-- | routers/api/v1/user/app.go | 9 |
3 files changed, 12 insertions, 7 deletions
diff --git a/routers/api/v1/swagger/app.go b/routers/api/v1/swagger/app.go index 8be2c85574..9783abe1a0 100644 --- a/routers/api/v1/swagger/app.go +++ b/routers/api/v1/swagger/app.go @@ -14,3 +14,10 @@ type swaggerResponseOAuth2Application struct { // in:body Body api.OAuth2Application `json:"body"` } + +// AccessToken represents an API access token. +// swagger:response AccessToken +type swaggerResponseAccessToken struct { + // in:body + Body api.AccessToken `json:"body"` +} diff --git a/routers/api/v1/swagger/options.go b/routers/api/v1/swagger/options.go index 0ae96a9203..3f0c6e2d52 100644 --- a/routers/api/v1/swagger/options.go +++ b/routers/api/v1/swagger/options.go @@ -165,5 +165,8 @@ type swaggerParameterBodies struct { CreateTagOption api.CreateTagOption // in:body + CreateAccessTokenOption api.CreateAccessTokenOption + + // in:body UserSettingsOptions api.UserSettingsOptions } diff --git a/routers/api/v1/user/app.go b/routers/api/v1/user/app.go index 9f355a8289..afd209f2f0 100644 --- a/routers/api/v1/user/app.go +++ b/routers/api/v1/user/app.go @@ -76,15 +76,10 @@ func CreateAccessToken(ctx *context.APIContext) { // description: username of user // type: string // required: true - // - name: accessToken + // - name: userCreateToken // in: body // schema: - // type: object - // required: - // - name - // properties: - // name: - // type: string + // "$ref": "#/definitions/CreateAccessTokenOption" // responses: // "201": // "$ref": "#/responses/AccessToken" |