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

Fix Swagger JSON autogeneration issues. #4845

Merged
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
4 changes: 4 additions & 0 deletions routers/api/v1/admin/org.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ func CreateOrg(ctx *context.APIContext, form api.CreateOrgOption) {
// description: username of the user that will own the created organization
// type: string
// required: true
// - name: organization
// in: body
// required: true
// schema: { "$ref": "#/definitions/CreateOrgOption" }
// responses:
// "201":
// "$ref": "#/responses/Organization"
Expand Down
4 changes: 4 additions & 0 deletions routers/api/v1/admin/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ func CreateRepo(ctx *context.APIContext, form api.CreateRepoOption) {
// description: username of the user. This user will own the created repository
// type: string
// required: true
// - name: repository
// in: body
// required: true
// schema: { "$ref": "#/definitions/CreateRepoOption" }
// responses:
// "201":
// "$ref": "#/responses/Repository"
Expand Down
5 changes: 5 additions & 0 deletions routers/api/v1/admin/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ func CreatePublicKey(ctx *context.APIContext, form api.CreateKeyOption) {
// description: username of the user
// type: string
// required: true
// - name: key
// in: body
// schema:
// "$ref": "#/definitions/CreateKeyOption"
// responses:
// "201":
// "$ref": "#/responses/PublicKey"
Expand Down Expand Up @@ -259,6 +263,7 @@ func DeleteUserPublicKey(ctx *context.APIContext) {
// in: path
// description: id of the key to delete
// type: integer
// format: int64
// required: true
// responses:
// "204":
Expand Down
12 changes: 12 additions & 0 deletions routers/api/v1/org/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func GetHook(ctx *context.APIContext) {
// in: path
// description: id of the hook to get
// type: integer
// format: int64
// required: true
// responses:
// "200":
Expand Down Expand Up @@ -87,6 +88,11 @@ func CreateHook(ctx *context.APIContext, form api.CreateHookOption) {
// description: name of the organization
// type: string
// required: true
// - name: body
// in: body
// required: true
// schema:
// "$ref": "#/definitions/CreateHookOption"
// responses:
// "201":
// "$ref": "#/responses/Hook"
Expand Down Expand Up @@ -117,7 +123,12 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) {
// in: path
// description: id of the hook to update
// type: integer
// format: int64
// required: true
// - name: body
// in: body
// schema:
// "$ref": "#/definitions/EditHookOption"
// responses:
// "200":
// "$ref": "#/responses/Hook"
Expand All @@ -144,6 +155,7 @@ func DeleteHook(ctx *context.APIContext) {
// in: path
// description: id of the hook to delete
// type: integer
// format: int64
// required: true
// responses:
// "204":
Expand Down
12 changes: 0 additions & 12 deletions routers/api/v1/org/member.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,8 @@ func IsMember(ctx *context.APIContext) {
// responses:
// "204":
// description: user is a member
// schema:
// "$ref": "#/responses/empty"
// "404":
// description: user is not a member
// schema:
// "$ref": "#/responses/empty"
userToCheck := user.GetUserByParams(ctx)
if ctx.Written() {
return
Expand Down Expand Up @@ -172,12 +168,8 @@ func IsPublicMember(ctx *context.APIContext) {
// responses:
// "204":
// description: user is a public member
// schema:
// "$ref": "#/responses/empty"
// "404":
// description: user is not a public member
// schema:
// "$ref": "#/responses/empty"
userToCheck := user.GetUserByParams(ctx)
if ctx.Written() {
return
Expand Down Expand Up @@ -210,8 +202,6 @@ func PublicizeMember(ctx *context.APIContext) {
// responses:
// "204":
// description: membership publicized
// schema:
// "$ref": "#/responses/empty"
userToPublicize := user.GetUserByParams(ctx)
if ctx.Written() {
return
Expand Down Expand Up @@ -286,8 +276,6 @@ func DeleteMember(ctx *context.APIContext) {
// responses:
// "204":
// description: member removed
// schema:
// "$ref": "#/responses/empty"
member := user.GetUserByParams(ctx)
if ctx.Written() {
return
Expand Down
10 changes: 8 additions & 2 deletions routers/api/v1/org/team.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ func GetTeam(ctx *context.APIContext) {
// in: path
// description: id of the team to get
// type: integer
// format: int64
// required: true
// responses:
// "200":
Expand Down Expand Up @@ -144,12 +145,11 @@ func DeleteTeam(ctx *context.APIContext) {
// in: path
// description: id of the team to delete
// type: integer
// format: int64
// required: true
// responses:
// "204":
// description: team deleted
// schema:
// "$ref": "#/responses/empty"
if err := models.DeleteTeam(ctx.Org.Team); err != nil {
ctx.Error(500, "DeleteTeam", err)
return
Expand All @@ -169,6 +169,7 @@ func GetTeamMembers(ctx *context.APIContext) {
// in: path
// description: id of the team
// type: integer
// format: int64
// required: true
// responses:
// "200":
Expand Down Expand Up @@ -205,6 +206,7 @@ func AddTeamMember(ctx *context.APIContext) {
// in: path
// description: id of the team
// type: integer
// format: int64
// required: true
// - name: username
// in: path
Expand Down Expand Up @@ -237,6 +239,7 @@ func RemoveTeamMember(ctx *context.APIContext) {
// in: path
// description: id of the team
// type: integer
// format: int64
// required: true
// - name: username
// in: path
Expand Down Expand Up @@ -270,6 +273,7 @@ func GetTeamRepos(ctx *context.APIContext) {
// in: path
// description: id of the team
// type: integer
// format: int64
// required: true
// responses:
// "200":
Expand Down Expand Up @@ -316,6 +320,7 @@ func AddTeamRepository(ctx *context.APIContext) {
// in: path
// description: id of the team
// type: integer
// format: int64
// required: true
// - name: org
// in: path
Expand Down Expand Up @@ -362,6 +367,7 @@ func RemoveTeamRepository(ctx *context.APIContext) {
// in: path
// description: id of the team
// type: integer
// format: int64
// required: true
// - name: org
// in: path
Expand Down
4 changes: 4 additions & 0 deletions routers/api/v1/repo/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ func GetHook(ctx *context.APIContext) {
// in: path
// description: id of the hook to get
// type: integer
// format: int64
// required: true
// responses:
// "200":
Expand Down Expand Up @@ -104,6 +105,7 @@ func TestHook(ctx *context.APIContext) {
// in: path
// description: id of the hook to test
// type: integer
// format: int64
// required: true
// responses:
// "204":
Expand Down Expand Up @@ -193,6 +195,7 @@ func EditHook(ctx *context.APIContext, form api.EditHookOption) {
// in: path
// description: index of the hook
// type: integer
// format: int64
// required: true
// - name: body
// in: body
Expand Down Expand Up @@ -227,6 +230,7 @@ func DeleteHook(ctx *context.APIContext) {
// in: path
// description: id of the hook to delete
// type: integer
// format: int64
// required: true
// responses:
// "204":
Expand Down
7 changes: 3 additions & 4 deletions routers/api/v1/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ func GetIssue(ctx *context.APIContext) {
// in: path
// description: index of the issue to get
// type: integer
// format: int64
// required: true
// responses:
// "200":
Expand Down Expand Up @@ -254,6 +255,7 @@ func EditIssue(ctx *context.APIContext, form api.EditIssueOption) {
// in: path
// description: index of the issue to edit
// type: integer
// format: int64
// required: true
// - name: body
// in: body
Expand Down Expand Up @@ -377,6 +379,7 @@ func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) {
// in: path
// description: index of the issue to create or update a deadline on
// type: integer
// format: int64
// required: true
// - name: body
// in: body
Expand All @@ -387,12 +390,8 @@ func UpdateIssueDeadline(ctx *context.APIContext, form api.EditDeadlineOption) {
// "$ref": "#/responses/IssueDeadline"
// "403":
// description: Not repo writer
// schema:
// "$ref": "#/responses/forbidden"
// "404":
// description: Issue not found
// schema:
// "$ref": "#/responses/empty"

issue, err := models.GetIssueByIndex(ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions routers/api/v1/repo/issue_comment.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func ListIssueComments(ctx *context.APIContext) {
// in: path
// description: index of the issue
// type: integer
// format: int64
// required: true
// - name: since
// in: query
Expand Down Expand Up @@ -144,6 +145,7 @@ func CreateIssueComment(ctx *context.APIContext, form api.CreateIssueCommentOpti
// in: path
// description: index of the issue
// type: integer
// format: int64
// required: true
// - name: body
// in: body
Expand Down Expand Up @@ -193,6 +195,7 @@ func EditIssueComment(ctx *context.APIContext, form api.EditIssueCommentOption)
// in: path
// description: id of the comment to edit
// type: integer
// format: int64
// required: true
// - name: body
// in: body
Expand Down Expand Up @@ -234,6 +237,7 @@ func EditIssueCommentDeprecated(ctx *context.APIContext, form api.EditIssueComme
// in: path
// description: id of the comment to edit
// type: integer
// format: int64
// required: true
// - name: body
// in: body
Expand Down Expand Up @@ -293,6 +297,7 @@ func DeleteIssueComment(ctx *context.APIContext) {
// in: path
// description: id of comment to delete
// type: integer
// format: int64
// required: true
// responses:
// "204":
Expand Down Expand Up @@ -326,6 +331,7 @@ func DeleteIssueCommentDeprecated(ctx *context.APIContext) {
// in: path
// description: id of comment to delete
// type: integer
// format: int64
// required: true
// responses:
// "204":
Expand Down
6 changes: 6 additions & 0 deletions routers/api/v1/repo/issue_label.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func ListIssueLabels(ctx *context.APIContext) {
// in: path
// description: index of the issue
// type: integer
// format: int64
// required: true
// responses:
// "200":
Expand Down Expand Up @@ -80,6 +81,7 @@ func AddIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) {
// in: path
// description: index of the issue
// type: integer
// format: int64
// required: true
// - name: body
// in: body
Expand Down Expand Up @@ -149,11 +151,13 @@ func DeleteIssueLabel(ctx *context.APIContext) {
// in: path
// description: index of the issue
// type: integer
// format: int64
// required: true
// - name: id
// in: path
// description: id of the label to remove
// type: integer
// format: int64
// required: true
// responses:
// "204":
Expand Down Expand Up @@ -215,6 +219,7 @@ func ReplaceIssueLabels(ctx *context.APIContext, form api.IssueLabelsOption) {
// in: path
// description: index of the issue
// type: integer
// format: int64
// required: true
// - name: body
// in: body
Expand Down Expand Up @@ -284,6 +289,7 @@ func ClearIssueLabels(ctx *context.APIContext) {
// in: path
// description: index of the issue
// type: integer
// format: int64
// required: true
// responses:
// "204":
Expand Down
2 changes: 2 additions & 0 deletions routers/api/v1/repo/issue_tracked_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func ListTrackedTimes(ctx *context.APIContext) {
// in: path
// description: index of the issue
// type: integer
// format: int64
// required: true
// responses:
// "200":
Expand Down Expand Up @@ -92,6 +93,7 @@ func AddTime(ctx *context.APIContext, form api.AddTimeOption) {
// in: path
// description: index of the issue to add tracked time to
// type: integer
// format: int64
// required: true
// - name: body
// in: body
Expand Down
2 changes: 2 additions & 0 deletions routers/api/v1/repo/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func GetDeployKey(ctx *context.APIContext) {
// in: path
// description: id of the key to get
// type: integer
// format: int64
// required: true
// responses:
// "200":
Expand Down Expand Up @@ -191,6 +192,7 @@ func DeleteDeploykey(ctx *context.APIContext) {
// in: path
// description: id of the key to delete
// type: integer
// format: int64
// required: true
// responses:
// "204":
Expand Down
Loading