1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-01 09:51:39 -05:00

Fix Swagger JSON autogeneration issues. (#4845)

* Fix Swagger JSON.

Remove unnecessary schema references for the forbidden and empty responses

Signed-off-by: Andrew Thornton <art27@cantab.net>

* Fix swagger API for CreateAccessToken

* Fix admin create org swagger

* Fix swagger for adminCreateRepo

* More swagger fixes

Set int64 format for those which are int64
Some more form fixes

* Fix swagger description of GET /repos/{owner}/{repo}/pulls
This commit is contained in:
zeripath 2018-10-21 04:40:42 +01:00 committed by techknowlogick
parent 9b2fcadeef
commit 43f9233914
23 changed files with 298 additions and 66 deletions

View file

@ -28,6 +28,10 @@ func CreateOrg(ctx *context.APIContext, form api.CreateOrgOption) {
// description: username of the user that will own the created organization // description: username of the user that will own the created organization
// type: string // type: string
// required: true // required: true
// - name: organization
// in: body
// required: true
// schema: { "$ref": "#/definitions/CreateOrgOption" }
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/Organization" // "$ref": "#/responses/Organization"

View file

@ -27,6 +27,10 @@ func CreateRepo(ctx *context.APIContext, form api.CreateRepoOption) {
// description: username of the user. This user will own the created repository // description: username of the user. This user will own the created repository
// type: string // type: string
// required: true // required: true
// - name: repository
// in: body
// required: true
// schema: { "$ref": "#/definitions/CreateRepoOption" }
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/Repository" // "$ref": "#/responses/Repository"

View file

@ -228,6 +228,10 @@ func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
// description: username of the user // description: username of the user
// type: string // type: string
// required: true // required: true
// - name: key
// in: body
// schema:
// "$ref": "#/definitions/CreateKeyOption"
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/PublicKey" // "$ref": "#/responses/PublicKey"
@ -259,6 +263,7 @@ func DeleteUserPublicKey(ctx *context.APIContext) {
// in: path // in: path
// description: id of the key to delete // description: id of the key to delete
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":

View file

@ -59,6 +59,7 @@ func GetHook(ctx *context.APIContext) {
// in: path // in: path
// description: id of the hook to get // description: id of the hook to get
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -87,6 +88,11 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
// description: name of the organization // description: name of the organization
// type: string // type: string
// required: true // required: true
// - name: body
// in: body
// required: true
// schema:
// "$ref": "#/definitions/CreateHookOption"
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/Hook" // "$ref": "#/responses/Hook"
@ -117,7 +123,12 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) {
// in: path // in: path
// description: id of the hook to update // description: id of the hook to update
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/EditHookOption"
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/Hook" // "$ref": "#/responses/Hook"
@ -144,6 +155,7 @@ func DeleteHook(ctx *context.APIContext) {
// in: path // in: path
// description: id of the hook to delete // description: id of the hook to delete
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":

View file

@ -117,12 +117,8 @@ func IsMember(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// description: user is a member // description: user is a member
// schema:
// "$ref": "#/responses/empty"
// "404": // "404":
// description: user is not a member // description: user is not a member
// schema:
// "$ref": "#/responses/empty"
userToCheck := user.GetUserByParams(ctx) userToCheck := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
return return
@ -172,12 +168,8 @@ func IsPublicMember(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// description: user is a public member // description: user is a public member
// schema:
// "$ref": "#/responses/empty"
// "404": // "404":
// description: user is not a public member // description: user is not a public member
// schema:
// "$ref": "#/responses/empty"
userToCheck := user.GetUserByParams(ctx) userToCheck := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
return return
@ -210,8 +202,6 @@ func PublicizeMember(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// description: membership publicized // description: membership publicized
// schema:
// "$ref": "#/responses/empty"
userToPublicize := user.GetUserByParams(ctx) userToPublicize := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
return return
@ -286,8 +276,6 @@ func DeleteMember(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// description: member removed // description: member removed
// schema:
// "$ref": "#/responses/empty"
member := user.GetUserByParams(ctx) member := user.GetUserByParams(ctx)
if ctx.Written() { if ctx.Written() {
return return

View file

@ -54,6 +54,7 @@ func GetTeam(ctx *context.APIContext) {
// in: path // in: path
// description: id of the team to get // description: id of the team to get
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -144,12 +145,11 @@ func DeleteTeam(ctx *context.APIContext) {
// in: path // in: path
// description: id of the team to delete // description: id of the team to delete
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":
// description: team deleted // description: team deleted
// schema:
// "$ref": "#/responses/empty"
if err := models.DeleteTeam(ctx.Org.Team); err != nil { if err := models.DeleteTeam(ctx.Org.Team); err != nil {
ctx.Error(500, "DeleteTeam", err) ctx.Error(500, "DeleteTeam", err)
return return
@ -169,6 +169,7 @@ func GetTeamMembers(ctx *context.APIContext) {
// in: path // in: path
// description: id of the team // description: id of the team
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -205,6 +206,7 @@ func AddTeamMember(ctx *context.APIContext) {
// in: path // in: path
// description: id of the team // description: id of the team
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: username // - name: username
// in: path // in: path
@ -237,6 +239,7 @@ func RemoveTeamMember(ctx *context.APIContext) {
// in: path // in: path
// description: id of the team // description: id of the team
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: username // - name: username
// in: path // in: path
@ -270,6 +273,7 @@ func GetTeamRepos(ctx *context.APIContext) {
// in: path // in: path
// description: id of the team // description: id of the team
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -316,6 +320,7 @@ func AddTeamRepository(ctx *context.APIContext) {
// in: path // in: path
// description: id of the team // description: id of the team
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: org // - name: org
// in: path // in: path
@ -362,6 +367,7 @@ func RemoveTeamRepository(ctx *context.APIContext) {
// in: path // in: path
// description: id of the team // description: id of the team
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: org // - name: org
// in: path // in: path

View file

@ -69,6 +69,7 @@ func GetHook(ctx *context.APIContext) {
// in: path // in: path
// description: id of the hook to get // description: id of the hook to get
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -104,6 +105,7 @@ func TestHook(ctx *context.APIContext) {
// in: path // in: path
// description: id of the hook to test // description: id of the hook to test
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":
@ -193,6 +195,7 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) {
// in: path // in: path
// description: index of the hook // description: index of the hook
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body // - name: body
// in: body // in: body
@ -227,6 +230,7 @@ func DeleteHook(ctx *context.APIContext) {
// in: path // in: path
// description: id of the hook to delete // description: id of the hook to delete
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":

View file

@ -123,6 +123,7 @@ func GetIssue(ctx *context.APIContext) {
// in: path // in: path
// description: index of the issue to get // description: index of the issue to get
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -254,6 +255,7 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
// in: path // in: path
// description: index of the issue to edit // description: index of the issue to edit
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body // - name: body
// in: body // in: body
@ -377,6 +379,7 @@ func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) {
// in: path // in: path
// description: index of the issue to create or update a deadline on // description: index of the issue to create or update a deadline on
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body // - name: body
// in: body // in: body
@ -387,12 +390,8 @@ func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) {
// "$ref": "#/responses/IssueDeadline" // "$ref": "#/responses/IssueDeadline"
// "403": // "403":
// description: Not repo writer // description: Not repo writer
// schema:
// "$ref": "#/responses/forbidden"
// "404": // "404":
// description: Issue not found // description: Issue not found
// schema:
// "$ref": "#/responses/empty"
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil { if err != nil {

View file

@ -36,6 +36,7 @@ func ListIssueComments(ctx *context.APIContext) {
// in: path // in: path
// description: index of the issue // description: index of the issue
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: since // - name: since
// in: query // in: query
@ -144,6 +145,7 @@ func CreateIssueComment(ctx *context.APIContext, form api.CreateIssueCommentOpti
// in: path // in: path
// description: index of the issue // description: index of the issue
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body // - name: body
// in: body // in: body
@ -193,6 +195,7 @@ func EditIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption)
// in: path // in: path
// description: id of the comment to edit // description: id of the comment to edit
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body // - name: body
// in: body // in: body
@ -234,6 +237,7 @@ func EditIssueCommentDeprecated(ctx *context.APIContext, form api.EditIssueComme
// in: path // in: path
// description: id of the comment to edit // description: id of the comment to edit
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body // - name: body
// in: body // in: body
@ -293,6 +297,7 @@ func DeleteIssueComment(ctx *context.APIContext) {
// in: path // in: path
// description: id of comment to delete // description: id of comment to delete
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":
@ -326,6 +331,7 @@ func DeleteIssueCommentDeprecated(ctx *context.APIContext) {
// in: path // in: path
// description: id of comment to delete // description: id of comment to delete
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":

View file

@ -33,6 +33,7 @@ func ListIssueLabels(ctx *context.APIContext) {
// in: path // in: path
// description: index of the issue // description: index of the issue
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -80,6 +81,7 @@ func AddIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) {
// in: path // in: path
// description: index of the issue // description: index of the issue
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body // - name: body
// in: body // in: body
@ -149,11 +151,13 @@ func DeleteIssueLabel(ctx *context.APIContext) {
// in: path // in: path
// description: index of the issue // description: index of the issue
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: id // - name: id
// in: path // in: path
// description: id of the label to remove // description: id of the label to remove
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":
@ -215,6 +219,7 @@ func ReplaceIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) {
// in: path // in: path
// description: index of the issue // description: index of the issue
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body // - name: body
// in: body // in: body
@ -284,6 +289,7 @@ func ClearIssueLabels(ctx *context.APIContext) {
// in: path // in: path
// description: index of the issue // description: index of the issue
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":

View file

@ -41,6 +41,7 @@ func ListTrackedTimes(ctx *context.APIContext) {
// in: path // in: path
// description: index of the issue // description: index of the issue
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -92,6 +93,7 @@ func AddTime(ctx *context.APIContext, form api.AddTimeOption) {
// in: path // in: path
// description: index of the issue to add tracked time to // description: index of the issue to add tracked time to
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body // - name: body
// in: body // in: body

View file

@ -81,6 +81,7 @@ func GetDeployKey(ctx *context.APIContext) {
// in: path // in: path
// description: id of the key to get // description: id of the key to get
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -191,6 +192,7 @@ func DeleteDeploykey(ctx *context.APIContext) {
// in: path // in: path
// description: id of the key to delete // description: id of the key to delete
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":

View file

@ -69,6 +69,7 @@ func GetLabel(ctx *context.APIContext) {
// in: path // in: path
// description: id of the label to get // description: id of the label to get
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -163,6 +164,7 @@ func EditLabel(ctx *context.APIContext, form api.EditLabelOption) {
// in: path // in: path
// description: id of the label to edit // description: id of the label to edit
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body // - name: body
// in: body // in: body
@ -219,6 +221,7 @@ func DeleteLabel(ctx *context.APIContext) {
// in: path // in: path
// description: id of the label to delete // description: id of the label to delete
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":

View file

@ -70,6 +70,7 @@ func GetMilestone(ctx *context.APIContext) {
// in: path // in: path
// description: id of the milestone // description: id of the milestone
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -156,6 +157,7 @@ func EditMilestone(ctx *context.APIContext, form api.EditMilestoneOption) {
// in: path // in: path
// description: id of the milestone // description: id of the milestone
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body // - name: body
// in: body // in: body
@ -211,6 +213,7 @@ func DeleteMilestone(ctx *context.APIContext) {
// in: path // in: path
// description: id of the milestone to delete // description: id of the milestone to delete
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":

View file

@ -38,6 +38,33 @@ func ListPullRequests(ctx *context.APIContext, form api.ListPullRequestsOptions)
// description: name of the repo // description: name of the repo
// type: string // type: string
// required: true // required: true
// - name: page
// in: query
// description: Page number
// type: integer
// - name: state
// in: query
// description: "State of pull request: open or closed (optional)"
// type: string
// enum: [closed, open, all]
// - name: sort
// in: query
// description: "Type of sort"
// type: string
// enum: [oldest, recentupdate, leastupdate, mostcomment, leastcomment, priority]
// - name: milestone
// in: query
// description: "ID of the milestone"
// type: integer
// format: int64
// - name: labels
// in: query
// description: "Label IDs"
// type: array
// collectionFormat: multi
// items:
// type: integer
// format: int64
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/PullRequestList" // "$ref": "#/responses/PullRequestList"
@ -101,6 +128,7 @@ func GetPullRequest(ctx *context.APIContext) {
// in: path // in: path
// description: index of the pull request to get // description: index of the pull request to get
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -301,6 +329,7 @@ func EditPullRequest(ctx *context.APIContext, form api.EditPullRequestOption) {
// in: path // in: path
// description: index of the pull request to edit // description: index of the pull request to edit
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body // - name: body
// in: body // in: body
@ -430,16 +459,13 @@ func IsPullRequestMerged(ctx *context.APIContext) {
// in: path // in: path
// description: index of the pull request // description: index of the pull request
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":
// description: pull request has been merged // description: pull request has been merged
// schema:
// "$ref": "#/responses/empty"
// "404": // "404":
// description: pull request has not been merged // description: pull request has not been merged
// schema:
// "$ref": "#/responses/empty"
pr, err := models.GetPullRequestByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index")) pr, err := models.GetPullRequestByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil { if err != nil {
if models.IsErrPullRequestNotExist(err) { if models.IsErrPullRequestNotExist(err) {
@ -478,6 +504,7 @@ func MergePullRequest(ctx *context.APIContext, form auth.MergePullRequestForm) {
// in: path // in: path
// description: index of the pull request to merge // description: index of the pull request to merge
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":

View file

@ -33,6 +33,7 @@ func GetRelease(ctx *context.APIContext) {
// in: path // in: path
// description: id of the release to get // description: id of the release to get
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -199,6 +200,7 @@ func EditRelease(ctx *context.APIContext, form api.EditReleaseOption) {
// in: path // in: path
// description: id of the release to edit // description: id of the release to edit
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body // - name: body
// in: body // in: body
@ -278,6 +280,7 @@ func DeleteRelease(ctx *context.APIContext) {
// in: path // in: path
// description: id of the release to delete // description: id of the release to delete
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":

View file

@ -38,11 +38,13 @@ func GetReleaseAttachment(ctx *context.APIContext) {
// in: path // in: path
// description: id of the release // description: id of the release
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: attachment_id // - name: attachment_id
// in: path // in: path
// description: id of the attachment to get // description: id of the attachment to get
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -84,6 +86,7 @@ func ListReleaseAttachments(ctx *context.APIContext) {
// in: path // in: path
// description: id of the release // description: id of the release
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -129,6 +132,7 @@ func CreateReleaseAttachment(ctx *context.APIContext) {
// in: path // in: path
// description: id of the release // description: id of the release
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: name // - name: name
// in: query // in: query
@ -233,11 +237,13 @@ func EditReleaseAttachment(ctx *context.APIContext, form api.EditAttachmentOptio
// in: path // in: path
// description: id of the release // description: id of the release
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: attachment_id // - name: attachment_id
// in: path // in: path
// description: id of the attachment to edit // description: id of the attachment to edit
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: body // - name: body
// in: body // in: body
@ -292,11 +298,13 @@ func DeleteReleaseAttachment(ctx *context.APIContext) {
// in: path // in: path
// description: id of the release // description: id of the release
// type: integer // type: integer
// format: int64
// required: true // required: true
// - name: attachment_id // - name: attachment_id
// in: path // in: path
// description: id of the attachment to delete // description: id of the attachment to delete
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":

View file

@ -53,6 +53,7 @@ func Search(ctx *context.APIContext) {
// in: query // in: query
// description: search only for repos that the user with the given id owns or contributes to // description: search only for repos that the user with the given id owns or contributes to
// type: integer // type: integer
// format: int64
// - name: page // - name: page
// in: query // in: query
// description: page number of results to return (1-based) // description: page number of results to return (1-based)
@ -453,6 +454,7 @@ func GetByID(ctx *context.APIContext) {
// in: path // in: path
// description: id of the repo to get // description: id of the repo to get
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":

View file

@ -60,6 +60,15 @@ func CreateAccessToken(ctx *context.APIContext, form api.CreateAccessTokenOption
// description: username of user // description: username of user
// type: string // type: string
// required: true // required: true
// - name: accessToken
// in: body
// schema:
// type: object
// required:
// - name
// properties:
// name:
// type: string
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/AccessToken" // "$ref": "#/responses/AccessToken"
@ -95,6 +104,7 @@ func DeleteAccessToken(ctx *context.APIContext) {
// in: path // in: path
// description: token to be deleted // description: token to be deleted
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":

View file

@ -80,6 +80,7 @@ func GetGPGKey(ctx *context.APIContext) {
// in: path // in: path
// description: id of key to get // description: id of key to get
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -143,6 +144,7 @@ func DeleteGPGKey(ctx *context.APIContext) {
// in: path // in: path
// description: id of key to delete // description: id of key to delete
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":

View file

@ -101,6 +101,7 @@ func GetPublicKey(ctx *context.APIContext) {
// in: path // in: path
// description: id of key to get // description: id of key to get
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "200": // "200":
@ -172,6 +173,7 @@ func DeletePublicKey(ctx *context.APIContext) {
// in: path // in: path
// description: id of key to delete // description: id of key to delete
// type: integer // type: integer
// format: int64
// required: true // required: true
// responses: // responses:
// "204": // "204":

View file

@ -31,6 +31,7 @@ func Search(ctx *context.APIContext) {
// in: query // in: query
// description: ID of the user to search for // description: ID of the user to search for
// type: integer // type: integer
// format: int64
// - name: limit // - name: limit
// in: query // in: query
// description: maximum number of users to return // description: maximum number of users to return

View file

@ -150,6 +150,13 @@
"name": "username", "name": "username",
"in": "path", "in": "path",
"required": true "required": true
},
{
"name": "key",
"in": "body",
"schema": {
"$ref": "#/definitions/CreateKeyOption"
}
} }
], ],
"responses": { "responses": {
@ -185,6 +192,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the key to delete", "description": "id of the key to delete",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -224,6 +232,14 @@
"name": "username", "name": "username",
"in": "path", "in": "path",
"required": true "required": true
},
{
"name": "organization",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CreateOrgOption"
}
} }
], ],
"responses": { "responses": {
@ -259,6 +275,14 @@
"name": "username", "name": "username",
"in": "path", "in": "path",
"required": true "required": true
},
{
"name": "repository",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CreateRepoOption"
}
} }
], ],
"responses": { "responses": {
@ -488,6 +512,14 @@
"name": "org", "name": "org",
"in": "path", "in": "path",
"required": true "required": true
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CreateHookOption"
}
} }
], ],
"responses": { "responses": {
@ -517,6 +549,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the hook to get", "description": "id of the hook to get",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -548,6 +581,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the hook to delete", "description": "id of the hook to delete",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -582,10 +616,18 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the hook to update", "description": "id of the hook to update",
"name": "id", "name": "id",
"in": "path", "in": "path",
"required": true "required": true
},
{
"name": "body",
"in": "body",
"schema": {
"$ref": "#/definitions/EditHookOption"
}
} }
], ],
"responses": { "responses": {
@ -646,16 +688,10 @@
], ],
"responses": { "responses": {
"204": { "204": {
"description": "user is a member", "description": "user is a member"
"schema": {
"$ref": "#/responses/empty"
}
}, },
"404": { "404": {
"description": "user is not a member", "description": "user is not a member"
"schema": {
"$ref": "#/responses/empty"
}
} }
} }
}, },
@ -686,10 +722,7 @@
], ],
"responses": { "responses": {
"204": { "204": {
"description": "member removed", "description": "member removed"
"schema": {
"$ref": "#/responses/empty"
}
} }
} }
} }
@ -745,16 +778,10 @@
], ],
"responses": { "responses": {
"204": { "204": {
"description": "user is a public member", "description": "user is a public member"
"schema": {
"$ref": "#/responses/empty"
}
}, },
"404": { "404": {
"description": "user is not a public member", "description": "user is not a public member"
"schema": {
"$ref": "#/responses/empty"
}
} }
} }
}, },
@ -785,10 +812,7 @@
], ],
"responses": { "responses": {
"204": { "204": {
"description": "membership publicized", "description": "membership publicized"
"schema": {
"$ref": "#/responses/empty"
}
} }
} }
}, },
@ -958,6 +982,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "search only for repos that the user with the given id owns or contributes to", "description": "search only for repos that the user with the given id owns or contributes to",
"name": "uid", "name": "uid",
"in": "query" "in": "query"
@ -1600,6 +1625,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the hook to get", "description": "id of the hook to get",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -1638,6 +1664,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the hook to delete", "description": "id of the hook to delete",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -1679,6 +1706,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the hook", "description": "index of the hook",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -1726,6 +1754,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the hook to test", "description": "id of the hook to test",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -1894,6 +1923,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of comment to delete", "description": "id of comment to delete",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -1935,6 +1965,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the comment to edit", "description": "id of the comment to edit",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -1982,6 +2013,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the issue", "description": "index of the issue",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -2023,6 +2055,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the issue to add tracked time to", "description": "index of the issue to add tracked time to",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -2076,6 +2109,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the issue to get", "description": "index of the issue to get",
"name": "index", "name": "index",
"in": "path", "in": "path",
@ -2117,6 +2151,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the issue to edit", "description": "index of the issue to edit",
"name": "index", "name": "index",
"in": "path", "in": "path",
@ -2164,6 +2199,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the issue", "description": "index of the issue",
"name": "index", "name": "index",
"in": "path", "in": "path",
@ -2211,6 +2247,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the issue", "description": "index of the issue",
"name": "index", "name": "index",
"in": "path", "in": "path",
@ -2263,6 +2300,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of comment to delete", "description": "id of comment to delete",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -2312,6 +2350,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the comment to edit", "description": "id of the comment to edit",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -2362,6 +2401,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the issue to create or update a deadline on", "description": "index of the issue to create or update a deadline on",
"name": "index", "name": "index",
"in": "path", "in": "path",
@ -2380,16 +2420,10 @@
"$ref": "#/responses/IssueDeadline" "$ref": "#/responses/IssueDeadline"
}, },
"403": { "403": {
"description": "Not repo writer", "description": "Not repo writer"
"schema": {
"$ref": "#/responses/forbidden"
}
}, },
"404": { "404": {
"description": "Issue not found", "description": "Issue not found"
"schema": {
"$ref": "#/responses/empty"
}
} }
} }
} }
@ -2421,6 +2455,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the issue", "description": "index of the issue",
"name": "index", "name": "index",
"in": "path", "in": "path",
@ -2465,6 +2500,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the issue", "description": "index of the issue",
"name": "index", "name": "index",
"in": "path", "in": "path",
@ -2513,6 +2549,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the issue", "description": "index of the issue",
"name": "index", "name": "index",
"in": "path", "in": "path",
@ -2558,6 +2595,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the issue", "description": "index of the issue",
"name": "index", "name": "index",
"in": "path", "in": "path",
@ -2598,6 +2636,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the issue", "description": "index of the issue",
"name": "index", "name": "index",
"in": "path", "in": "path",
@ -2605,6 +2644,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the label to remove", "description": "id of the label to remove",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -2719,6 +2759,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the key to get", "description": "id of the key to get",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -2754,6 +2795,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the key to delete", "description": "id of the key to delete",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -2868,6 +2910,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the label to get", "description": "id of the label to get",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -2903,6 +2946,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the label to delete", "description": "id of the label to delete",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -2944,6 +2988,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the label to edit", "description": "id of the label to edit",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -3065,6 +3110,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the milestone", "description": "id of the milestone",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -3100,6 +3146,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the milestone to delete", "description": "id of the milestone to delete",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -3141,6 +3188,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the milestone", "description": "id of the milestone",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -3218,6 +3266,55 @@
"name": "repo", "name": "repo",
"in": "path", "in": "path",
"required": true "required": true
},
{
"type": "integer",
"description": "Page number",
"name": "page",
"in": "query"
},
{
"enum": [
"closed",
"open",
"all"
],
"type": "string",
"description": "State of pull request: open or closed (optional)",
"name": "state",
"in": "query"
},
{
"enum": [
"oldest",
"recentupdate",
"leastupdate",
"mostcomment",
"leastcomment",
"priority"
],
"type": "string",
"description": "Type of sort",
"name": "sort",
"in": "query"
},
{
"type": "integer",
"format": "int64",
"description": "ID of the milestone",
"name": "milestone",
"in": "query"
},
{
"type": "array",
"items": {
"type": "integer",
"format": "int64"
},
"collectionFormat": "multi",
"description": "Label IDs",
"name": "labels",
"in": "query"
} }
], ],
"responses": { "responses": {
@ -3295,6 +3392,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the pull request to get", "description": "index of the pull request to get",
"name": "index", "name": "index",
"in": "path", "in": "path",
@ -3336,6 +3434,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the pull request to edit", "description": "index of the pull request to edit",
"name": "index", "name": "index",
"in": "path", "in": "path",
@ -3383,6 +3482,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the pull request", "description": "index of the pull request",
"name": "index", "name": "index",
"in": "path", "in": "path",
@ -3391,16 +3491,10 @@
], ],
"responses": { "responses": {
"204": { "204": {
"description": "pull request has been merged", "description": "pull request has been merged"
"schema": {
"$ref": "#/responses/empty"
}
}, },
"404": { "404": {
"description": "pull request has not been merged", "description": "pull request has not been merged"
"schema": {
"$ref": "#/responses/empty"
}
} }
} }
}, },
@ -3430,6 +3524,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "index of the pull request to merge", "description": "index of the pull request to merge",
"name": "index", "name": "index",
"in": "path", "in": "path",
@ -3587,6 +3682,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the release to get", "description": "id of the release to get",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -3622,6 +3718,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the release to delete", "description": "id of the release to delete",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -3663,6 +3760,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the release to edit", "description": "id of the release to edit",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -3710,6 +3808,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the release", "description": "id of the release",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -3751,6 +3850,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the release", "description": "id of the release",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -3804,6 +3904,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the release", "description": "id of the release",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -3811,6 +3912,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the attachment to get", "description": "id of the attachment to get",
"name": "attachment_id", "name": "attachment_id",
"in": "path", "in": "path",
@ -3849,6 +3951,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the release", "description": "id of the release",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -3856,6 +3959,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the attachment to delete", "description": "id of the attachment to delete",
"name": "attachment_id", "name": "attachment_id",
"in": "path", "in": "path",
@ -3897,6 +4001,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the release", "description": "id of the release",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -3904,6 +4009,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the attachment to edit", "description": "id of the attachment to edit",
"name": "attachment_id", "name": "attachment_id",
"in": "path", "in": "path",
@ -4247,6 +4353,7 @@
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the repo to get", "description": "id of the repo to get",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -4273,6 +4380,7 @@
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the team to get", "description": "id of the team to get",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -4294,6 +4402,7 @@
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the team to delete", "description": "id of the team to delete",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -4302,10 +4411,7 @@
], ],
"responses": { "responses": {
"204": { "204": {
"description": "team deleted", "description": "team deleted"
"schema": {
"$ref": "#/responses/empty"
}
} }
} }
}, },
@ -4357,6 +4463,7 @@
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the team", "description": "id of the team",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -4383,6 +4490,7 @@
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the team", "description": "id of the team",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -4414,6 +4522,7 @@
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the team", "description": "id of the team",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -4447,6 +4556,7 @@
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the team", "description": "id of the team",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -4473,6 +4583,7 @@
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the team", "description": "id of the team",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -4512,6 +4623,7 @@
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of the team", "description": "id of the team",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -4809,6 +4921,7 @@
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of key to get", "description": "id of key to get",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -4836,6 +4949,7 @@
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of key to delete", "description": "id of key to delete",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -4912,6 +5026,7 @@
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of key to get", "description": "id of key to get",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -4939,6 +5054,7 @@
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "id of key to delete", "description": "id of key to delete",
"name": "id", "name": "id",
"in": "path", "in": "path",
@ -5205,6 +5321,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "ID of the user to search for", "description": "ID of the user to search for",
"name": "uid", "name": "uid",
"in": "query" "in": "query"
@ -5526,6 +5643,21 @@
"name": "username", "name": "username",
"in": "path", "in": "path",
"required": true "required": true
},
{
"name": "accessToken",
"in": "body",
"schema": {
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "string"
}
}
}
} }
], ],
"responses": { "responses": {
@ -5555,6 +5687,7 @@
}, },
{ {
"type": "integer", "type": "integer",
"format": "int64",
"description": "token to be deleted", "description": "token to be deleted",
"name": "token", "name": "token",
"in": "path", "in": "path",