Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swagger AccessToken fixes (#16574) #16597

Merged
merged 2 commits into from
Aug 2, 2021
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
7 changes: 7 additions & 0 deletions routers/api/v1/swagger/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
3 changes: 3 additions & 0 deletions routers/api/v1/swagger/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ type swaggerParameterBodies struct {
// in:body
CreateTagOption api.CreateTagOption

// in:body
CreateAccessTokenOption api.CreateAccessTokenOption

// in:body
UserSettingsOptions api.UserSettingsOptions
}
9 changes: 2 additions & 7 deletions routers/api/v1/user/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
39 changes: 15 additions & 24 deletions templates/swagger/v1_json.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -11917,18 +11917,10 @@
"required": true
},
{
"name": "accessToken",
"name": "userCreateToken",
"in": "body",
"schema": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
}
}
"$ref": "#/definitions/CreateAccessTokenOption"
}
}
],
Expand Down Expand Up @@ -12654,6 +12646,17 @@
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"CreateAccessTokenOption": {
"description": "CreateAccessTokenOption options when create access token",
"type": "object",
"properties": {
"name": {
"type": "string",
"x-go-name": "Name"
}
},
"x-go-package": "code.gitea.io/gitea/modules/structs"
},
"CreateBranchProtectionOption": {
"description": "CreateBranchProtectionOption options for creating a branch protection",
"type": "object",
Expand Down Expand Up @@ -17044,20 +17047,8 @@
"responses": {
"AccessToken": {
"description": "AccessToken represents an API access token.",
"headers": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
},
"sha1": {
"type": "string"
},
"token_last_eight": {
"type": "string"
}
"schema": {
"$ref": "#/definitions/AccessToken"
}
},
"AccessTokenList": {
Expand Down