summaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorJakobDev <jakobdev@gmx.de>2023-09-13 04:37:54 +0200
committerGitHub <noreply@github.com>2023-09-13 10:37:54 +0800
commitaaeec2a3925c8e45c14179a3e6260b92e53197d2 (patch)
tree09fb0d741cf32adb316e4eedabc0e30fc604f89d /routers/api
parent8ecdc93f8b04f2d2e2e26bedb25fde045f0aff64 (diff)
downloadgitea-aaeec2a3925c8e45c14179a3e6260b92e53197d2.tar.gz
gitea-aaeec2a3925c8e45c14179a3e6260b92e53197d2.zip
Add missing 404 response to Swagger (#27038)
Most middleware throw a 404 in case something is not found e.g. a Repo that is not existing. But most API endpoints don't include the 404 response in their documentation. This PR changes this.
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/org/action.go2
-rw-r--r--routers/api/v1/org/avatar.go4
-rw-r--r--routers/api/v1/org/hook.go10
-rw-r--r--routers/api/v1/org/label.go10
-rw-r--r--routers/api/v1/org/member.go10
-rw-r--r--routers/api/v1/org/org.go10
-rw-r--r--routers/api/v1/org/team.go20
-rw-r--r--routers/api/v1/packages/package.go2
-rw-r--r--routers/api/v1/repo/avatar.go4
-rw-r--r--routers/api/v1/repo/blob.go2
-rw-r--r--routers/api/v1/repo/collaborators.go10
-rw-r--r--routers/api/v1/repo/fork.go4
-rw-r--r--routers/api/v1/repo/git_hook.go2
-rw-r--r--routers/api/v1/repo/hook.go8
-rw-r--r--routers/api/v1/repo/issue.go4
-rw-r--r--routers/api/v1/repo/issue_comment.go8
-rw-r--r--routers/api/v1/repo/issue_dependency.go8
-rw-r--r--routers/api/v1/repo/issue_label.go8
-rw-r--r--routers/api/v1/repo/issue_pin.go6
-rw-r--r--routers/api/v1/repo/issue_reaction.go12
-rw-r--r--routers/api/v1/repo/issue_tracked_time.go10
-rw-r--r--routers/api/v1/repo/key.go8
-rw-r--r--routers/api/v1/repo/label.go10
-rw-r--r--routers/api/v1/repo/milestone.go10
-rw-r--r--routers/api/v1/repo/mirror.go10
-rw-r--r--routers/api/v1/repo/patch.go2
-rw-r--r--routers/api/v1/repo/pull.go8
-rw-r--r--routers/api/v1/repo/pull_review.go4
-rw-r--r--routers/api/v1/repo/release.go2
-rw-r--r--routers/api/v1/repo/release_attachment.go10
-rw-r--r--routers/api/v1/repo/repo.go16
-rw-r--r--routers/api/v1/repo/star.go2
-rw-r--r--routers/api/v1/repo/status.go8
-rw-r--r--routers/api/v1/repo/subscriber.go2
-rw-r--r--routers/api/v1/repo/tag.go4
-rw-r--r--routers/api/v1/repo/teams.go6
-rw-r--r--routers/api/v1/repo/topic.go10
-rw-r--r--routers/api/v1/repo/tree.go2
-rw-r--r--routers/api/v1/repo/wiki.go4
-rw-r--r--routers/api/v1/user/follower.go8
-rw-r--r--routers/api/v1/user/gpg_key.go2
-rw-r--r--routers/api/v1/user/key.go2
-rw-r--r--routers/api/v1/user/repo.go4
-rw-r--r--routers/api/v1/user/star.go6
-rw-r--r--routers/api/v1/user/watch.go6
45 files changed, 300 insertions, 0 deletions
diff --git a/routers/api/v1/org/action.go b/routers/api/v1/org/action.go
index e50a77f362..5af6125773 100644
--- a/routers/api/v1/org/action.go
+++ b/routers/api/v1/org/action.go
@@ -40,6 +40,8 @@ func ListActionsSecrets(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/SecretList"
+ // "404":
+ // "$ref": "#/responses/notFound"
opts := &secret_model.FindSecretsOptions{
OwnerID: ctx.Org.Organization.ID,
diff --git a/routers/api/v1/org/avatar.go b/routers/api/v1/org/avatar.go
index b3cb0b81a6..a7b5008525 100644
--- a/routers/api/v1/org/avatar.go
+++ b/routers/api/v1/org/avatar.go
@@ -33,6 +33,8 @@ func UpdateAvatar(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.UpdateUserAvatarOption)
content, err := base64.StdEncoding.DecodeString(form.Image)
@@ -65,6 +67,8 @@ func DeleteAvatar(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
err := user_service.DeleteAvatar(ctx.Org.Organization.AsUser())
if err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err)
diff --git a/routers/api/v1/org/hook.go b/routers/api/v1/org/hook.go
index a6ea618a7d..3c3f058b5d 100644
--- a/routers/api/v1/org/hook.go
+++ b/routers/api/v1/org/hook.go
@@ -37,6 +37,8 @@ func ListHooks(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/HookList"
+ // "404":
+ // "$ref": "#/responses/notFound"
utils.ListOwnerHooks(
ctx,
@@ -66,6 +68,8 @@ func GetHook(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Hook"
+ // "404":
+ // "$ref": "#/responses/notFound"
hook, err := utils.GetOwnerHook(ctx, ctx.ContextUser.ID, ctx.ParamsInt64("id"))
if err != nil {
@@ -103,6 +107,8 @@ func CreateHook(ctx *context.APIContext) {
// responses:
// "201":
// "$ref": "#/responses/Hook"
+ // "404":
+ // "$ref": "#/responses/notFound"
utils.AddOwnerHook(
ctx,
@@ -139,6 +145,8 @@ func EditHook(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Hook"
+ // "404":
+ // "$ref": "#/responses/notFound"
utils.EditOwnerHook(
ctx,
@@ -170,6 +178,8 @@ func DeleteHook(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
utils.DeleteOwnerHook(
ctx,
diff --git a/routers/api/v1/org/label.go b/routers/api/v1/org/label.go
index 9ef28d4db9..2dd4505a91 100644
--- a/routers/api/v1/org/label.go
+++ b/routers/api/v1/org/label.go
@@ -41,6 +41,8 @@ func ListLabels(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/LabelList"
+ // "404":
+ // "$ref": "#/responses/notFound"
labels, err := issues_model.GetLabelsByOrgID(ctx, ctx.Org.Organization.ID, ctx.FormString("sort"), utils.GetListOptions(ctx))
if err != nil {
@@ -80,6 +82,8 @@ func CreateLabel(ctx *context.APIContext) {
// responses:
// "201":
// "$ref": "#/responses/Label"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/validationError"
form := web.GetForm(ctx).(*api.CreateLabelOption)
@@ -128,6 +132,8 @@ func GetLabel(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Label"
+ // "404":
+ // "$ref": "#/responses/notFound"
var (
label *issues_model.Label
@@ -179,6 +185,8 @@ func EditLabel(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Label"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/validationError"
form := web.GetForm(ctx).(*api.EditLabelOption)
@@ -238,6 +246,8 @@ func DeleteLabel(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
if err := issues_model.DeleteLabel(ctx.Org.Organization.ID, ctx.ParamsInt64(":id")); err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteLabel", err)
diff --git a/routers/api/v1/org/member.go b/routers/api/v1/org/member.go
index e4afd7f3c6..e5ea584d5d 100644
--- a/routers/api/v1/org/member.go
+++ b/routers/api/v1/org/member.go
@@ -70,6 +70,8 @@ func ListMembers(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/UserList"
+ // "404":
+ // "$ref": "#/responses/notFound"
publicOnly := true
if ctx.Doer != nil {
@@ -107,6 +109,8 @@ func ListPublicMembers(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/UserList"
+ // "404":
+ // "$ref": "#/responses/notFound"
listMembers(ctx, true)
}
@@ -225,6 +229,8 @@ func PublicizeMember(ctx *context.APIContext) {
// description: membership publicized
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
userToPublicize := user.GetUserByParams(ctx)
if ctx.Written() {
@@ -265,6 +271,8 @@ func ConcealMember(ctx *context.APIContext) {
// "$ref": "#/responses/empty"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
userToConceal := user.GetUserByParams(ctx)
if ctx.Written() {
@@ -303,6 +311,8 @@ func DeleteMember(ctx *context.APIContext) {
// responses:
// "204":
// description: member removed
+ // "404":
+ // "$ref": "#/responses/notFound"
member := user.GetUserByParams(ctx)
if ctx.Written() {
diff --git a/routers/api/v1/org/org.go b/routers/api/v1/org/org.go
index b0666c87f8..0216b62352 100644
--- a/routers/api/v1/org/org.go
+++ b/routers/api/v1/org/org.go
@@ -70,6 +70,8 @@ func ListMyOrgs(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/OrganizationList"
+ // "404":
+ // "$ref": "#/responses/notFound"
listUserOrgs(ctx, ctx.Doer)
}
@@ -98,6 +100,8 @@ func ListUserOrgs(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/OrganizationList"
+ // "404":
+ // "$ref": "#/responses/notFound"
listUserOrgs(ctx, ctx.ContextUser)
}
@@ -295,6 +299,8 @@ func Get(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Organization"
+ // "404":
+ // "$ref": "#/responses/notFound"
if !organization.HasOrgOrUserVisible(ctx, ctx.Org.Organization.AsUser(), ctx.Doer) {
ctx.NotFound("HasOrgOrUserVisible", nil)
@@ -334,6 +340,8 @@ func Edit(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Organization"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditOrgOption)
org := ctx.Org.Organization
org.FullName = form.FullName
@@ -374,6 +382,8 @@ func Delete(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
if err := org.DeleteOrganization(ctx.Org.Organization); err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteOrganization", err)
diff --git a/routers/api/v1/org/team.go b/routers/api/v1/org/team.go
index 4b52fb8987..abb5381a70 100644
--- a/routers/api/v1/org/team.go
+++ b/routers/api/v1/org/team.go
@@ -50,6 +50,8 @@ func ListTeams(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/TeamList"
+ // "404":
+ // "$ref": "#/responses/notFound"
teams, count, err := organization.SearchTeam(&organization.SearchTeamOptions{
ListOptions: utils.GetListOptions(ctx),
@@ -126,6 +128,8 @@ func GetTeam(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Team"
+ // "404":
+ // "$ref": "#/responses/notFound"
apiTeam, err := convert.ToTeam(ctx, ctx.Org.Team, true)
if err != nil {
@@ -204,6 +208,8 @@ func CreateTeam(ctx *context.APIContext) {
// responses:
// "201":
// "$ref": "#/responses/Team"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/validationError"
form := web.GetForm(ctx).(*api.CreateTeamOption)
@@ -272,6 +278,8 @@ func EditTeam(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Team"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditTeamOption)
team := ctx.Org.Team
@@ -350,6 +358,8 @@ func DeleteTeam(ctx *context.APIContext) {
// responses:
// "204":
// description: team deleted
+ // "404":
+ // "$ref": "#/responses/notFound"
if err := models.DeleteTeam(ctx.Org.Team); err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteTeam", err)
@@ -383,6 +393,8 @@ func GetTeamMembers(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/UserList"
+ // "404":
+ // "$ref": "#/responses/notFound"
isMember, err := organization.IsOrganizationMember(ctx, ctx.Org.Team.OrgID, ctx.Doer.ID)
if err != nil {
@@ -550,6 +562,8 @@ func GetTeamRepos(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/RepositoryList"
+ // "404":
+ // "$ref": "#/responses/notFound"
team := ctx.Org.Team
teamRepos, err := organization.GetTeamRepositories(ctx, &organization.SearchTeamRepoOptions{
@@ -665,6 +679,8 @@ func AddTeamRepository(ctx *context.APIContext) {
// "$ref": "#/responses/empty"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
repo := getRepositoryByParams(ctx)
if ctx.Written() {
@@ -715,6 +731,8 @@ func RemoveTeamRepository(ctx *context.APIContext) {
// "$ref": "#/responses/empty"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
repo := getRepositoryByParams(ctx)
if ctx.Written() {
@@ -775,6 +793,8 @@ func SearchTeam(ctx *context.APIContext) {
// type: array
// items:
// "$ref": "#/definitions/Team"
+ // "404":
+ // "$ref": "#/responses/notFound"
listOptions := utils.GetListOptions(ctx)
diff --git a/routers/api/v1/packages/package.go b/routers/api/v1/packages/package.go
index 5129c7d4f0..53724179a2 100644
--- a/routers/api/v1/packages/package.go
+++ b/routers/api/v1/packages/package.go
@@ -48,6 +48,8 @@ func ListPackages(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/PackageList"
+ // "404":
+ // "$ref": "#/responses/notFound"
listOptions := utils.GetListOptions(ctx)
diff --git a/routers/api/v1/repo/avatar.go b/routers/api/v1/repo/avatar.go
index 48bd143d0c..1b661955f0 100644
--- a/routers/api/v1/repo/avatar.go
+++ b/routers/api/v1/repo/avatar.go
@@ -38,6 +38,8 @@ func UpdateAvatar(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.UpdateRepoAvatarOption)
content, err := base64.StdEncoding.DecodeString(form.Image)
@@ -75,6 +77,8 @@ func DeleteAvatar(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
err := repo_service.DeleteAvatar(ctx, ctx.Repo.Repository)
if err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteAvatar", err)
diff --git a/routers/api/v1/repo/blob.go b/routers/api/v1/repo/blob.go
index d0004f0686..26605bba03 100644
--- a/routers/api/v1/repo/blob.go
+++ b/routers/api/v1/repo/blob.go
@@ -38,6 +38,8 @@ func GetBlob(ctx *context.APIContext) {
// "$ref": "#/responses/GitBlobResponse"
// "400":
// "$ref": "#/responses/error"
+ // "404":
+ // "$ref": "#/responses/notFound"
sha := ctx.Params("sha")
if len(sha) == 0 {
diff --git a/routers/api/v1/repo/collaborators.go b/routers/api/v1/repo/collaborators.go
index 66e7577a4b..4be43d46ad 100644
--- a/routers/api/v1/repo/collaborators.go
+++ b/routers/api/v1/repo/collaborators.go
@@ -50,6 +50,8 @@ func ListCollaborators(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/UserList"
+ // "404":
+ // "$ref": "#/responses/notFound"
count, err := repo_model.CountCollaborators(ctx.Repo.Repository.ID)
if err != nil {
@@ -154,6 +156,8 @@ func AddCollaborator(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/validationError"
@@ -215,6 +219,8 @@ func DeleteCollaborator(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/validationError"
@@ -311,6 +317,8 @@ func GetReviewers(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/UserList"
+ // "404":
+ // "$ref": "#/responses/notFound"
reviewers, err := repo_model.GetReviewers(ctx, ctx.Repo.Repository, ctx.Doer.ID, 0)
if err != nil {
@@ -341,6 +349,8 @@ func GetAssignees(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/UserList"
+ // "404":
+ // "$ref": "#/responses/notFound"
assignees, err := repo_model.GetRepoAssignees(ctx, ctx.Repo.Repository)
if err != nil {
diff --git a/routers/api/v1/repo/fork.go b/routers/api/v1/repo/fork.go
index f75153ab2d..7ae4356204 100644
--- a/routers/api/v1/repo/fork.go
+++ b/routers/api/v1/repo/fork.go
@@ -52,6 +52,8 @@ func ListForks(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/RepositoryList"
+ // "404":
+ // "$ref": "#/responses/notFound"
forks, err := repo_model.GetForks(ctx.Repo.Repository, utils.GetListOptions(ctx))
if err != nil {
@@ -99,6 +101,8 @@ func CreateFork(ctx *context.APIContext) {
// "$ref": "#/responses/Repository"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "409":
// description: The repository with the same name already exists.
// "422":
diff --git a/routers/api/v1/repo/git_hook.go b/routers/api/v1/repo/git_hook.go
index 40bd355428..7e471e263b 100644
--- a/routers/api/v1/repo/git_hook.go
+++ b/routers/api/v1/repo/git_hook.go
@@ -34,6 +34,8 @@ func ListGitHooks(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/GitHookList"
+ // "404":
+ // "$ref": "#/responses/notFound"
hooks, err := ctx.Repo.GitRepo.Hooks()
if err != nil {
diff --git a/routers/api/v1/repo/hook.go b/routers/api/v1/repo/hook.go
index d0b77b5687..e0f99b48fd 100644
--- a/routers/api/v1/repo/hook.go
+++ b/routers/api/v1/repo/hook.go
@@ -50,6 +50,8 @@ func ListHooks(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/HookList"
+ // "404":
+ // "$ref": "#/responses/notFound"
opts := &webhook.ListWebhookOptions{
ListOptions: utils.GetListOptions(ctx),
@@ -157,6 +159,8 @@ func TestHook(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
if ctx.Repo.Commit == nil {
// if repo does not have any commits, then don't send a webhook
@@ -224,6 +228,8 @@ func CreateHook(ctx *context.APIContext) {
// responses:
// "201":
// "$ref": "#/responses/Hook"
+ // "404":
+ // "$ref": "#/responses/notFound"
utils.AddRepoHook(ctx, web.GetForm(ctx).(*api.CreateHookOption))
}
@@ -259,6 +265,8 @@ func EditHook(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Hook"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditHookOption)
hookID := ctx.ParamsInt64(":id")
utils.EditRepoHook(ctx, form, hookID)
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index 2fad55df3d..c6248bacec 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -388,6 +388,8 @@ func ListIssues(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/IssueList"
+ // "404":
+ // "$ref": "#/responses/notFound"
before, since, err := context.GetQueryBeforeSince(ctx.Base)
if err != nil {
ctx.Error(http.StatusUnprocessableEntity, "GetQueryBeforeSince", err)
@@ -623,6 +625,8 @@ func CreateIssue(ctx *context.APIContext) {
// "$ref": "#/responses/Issue"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "412":
// "$ref": "#/responses/error"
// "422":
diff --git a/routers/api/v1/repo/issue_comment.go b/routers/api/v1/repo/issue_comment.go
index 1f8e16147f..c9179e69db 100644
--- a/routers/api/v1/repo/issue_comment.go
+++ b/routers/api/v1/repo/issue_comment.go
@@ -58,6 +58,8 @@ func ListIssueComments(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/CommentList"
+ // "404":
+ // "$ref": "#/responses/notFound"
before, since, err := context.GetQueryBeforeSince(ctx.Base)
if err != nil {
@@ -155,6 +157,8 @@ func ListIssueCommentsAndTimeline(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/TimelineList"
+ // "404":
+ // "$ref": "#/responses/notFound"
before, since, err := context.GetQueryBeforeSince(ctx.Base)
if err != nil {
@@ -258,6 +262,8 @@ func ListRepoIssueComments(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/CommentList"
+ // "404":
+ // "$ref": "#/responses/notFound"
before, since, err := context.GetQueryBeforeSince(ctx.Base)
if err != nil {
@@ -350,6 +356,8 @@ func CreateIssueComment(ctx *context.APIContext) {
// "$ref": "#/responses/Comment"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.CreateIssueCommentOption)
issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
diff --git a/routers/api/v1/repo/issue_dependency.go b/routers/api/v1/repo/issue_dependency.go
index b0eb208a32..5ea3836da1 100644
--- a/routers/api/v1/repo/issue_dependency.go
+++ b/routers/api/v1/repo/issue_dependency.go
@@ -52,6 +52,8 @@ func GetIssueDependencies(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/IssueList"
+ // "404":
+ // "$ref": "#/responses/notFound"
// If this issue's repository does not enable dependencies then there can be no dependencies by default
if !ctx.Repo.Repository.IsDependenciesEnabled(ctx) {
@@ -242,6 +244,8 @@ func RemoveIssueDependency(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Issue"
+ // "404":
+ // "$ref": "#/responses/notFound"
// We want to make <:index> depend on <Form>, i.e. <:index> is the target
target := getParamsIssue(ctx)
@@ -303,6 +307,8 @@ func GetIssueBlocks(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/IssueList"
+ // "404":
+ // "$ref": "#/responses/notFound"
// We need to list the issues that DEPEND on this issue not the other way round
// Therefore whether dependencies are enabled or not in this repository is potentially irrelevant.
@@ -458,6 +464,8 @@ func RemoveIssueBlocking(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Issue"
+ // "404":
+ // "$ref": "#/responses/notFound"
dependency := getParamsIssue(ctx)
if ctx.Written() {
diff --git a/routers/api/v1/repo/issue_label.go b/routers/api/v1/repo/issue_label.go
index a2814a03db..b050a397f2 100644
--- a/routers/api/v1/repo/issue_label.go
+++ b/routers/api/v1/repo/issue_label.go
@@ -98,6 +98,8 @@ func AddIssueLabels(ctx *context.APIContext) {
// "$ref": "#/responses/LabelList"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.IssueLabelsOption)
issue, labels, err := prepareForReplaceOrAdd(ctx, *form)
@@ -154,6 +156,8 @@ func DeleteIssueLabel(ctx *context.APIContext) {
// "$ref": "#/responses/empty"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/validationError"
@@ -225,6 +229,8 @@ func ReplaceIssueLabels(ctx *context.APIContext) {
// "$ref": "#/responses/LabelList"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.IssueLabelsOption)
issue, labels, err := prepareForReplaceOrAdd(ctx, *form)
if err != nil {
@@ -274,6 +280,8 @@ func ClearIssueLabels(ctx *context.APIContext) {
// "$ref": "#/responses/empty"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
diff --git a/routers/api/v1/repo/issue_pin.go b/routers/api/v1/repo/issue_pin.go
index 6876739083..d9b1bcc894 100644
--- a/routers/api/v1/repo/issue_pin.go
+++ b/routers/api/v1/repo/issue_pin.go
@@ -199,6 +199,8 @@ func ListPinnedIssues(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/IssueList"
+ // "404":
+ // "$ref": "#/responses/notFound"
issues, err := issues_model.GetPinnedIssues(ctx, ctx.Repo.Repository.ID, false)
if err != nil {
ctx.Error(http.StatusInternalServerError, "LoadPinnedIssues", err)
@@ -229,6 +231,8 @@ func ListPinnedPullRequests(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/PullRequestList"
+ // "404":
+ // "$ref": "#/responses/notFound"
issues, err := issues_model.GetPinnedIssues(ctx, ctx.Repo.Repository.ID, true)
if err != nil {
ctx.Error(http.StatusInternalServerError, "LoadPinnedPullRequests", err)
@@ -290,6 +294,8 @@ func AreNewIssuePinsAllowed(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/RepoNewIssuePinsAllowed"
+ // "404":
+ // "$ref": "#/responses/notFound"
pinsAllowed := api.NewIssuePinsAllowed{}
var err error
diff --git a/routers/api/v1/repo/issue_reaction.go b/routers/api/v1/repo/issue_reaction.go
index 49e5a74aa3..5210d4cced 100644
--- a/routers/api/v1/repo/issue_reaction.go
+++ b/routers/api/v1/repo/issue_reaction.go
@@ -46,6 +46,8 @@ func GetIssueCommentReactions(ctx *context.APIContext) {
// "$ref": "#/responses/ReactionList"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
comment, err := issues_model.GetCommentByID(ctx, ctx.ParamsInt64(":id"))
if err != nil {
@@ -126,6 +128,8 @@ func PostIssueCommentReaction(ctx *context.APIContext) {
// "$ref": "#/responses/Reaction"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditReactionOption)
@@ -167,6 +171,8 @@ func DeleteIssueCommentReaction(ctx *context.APIContext) {
// "$ref": "#/responses/empty"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditReactionOption)
@@ -268,6 +274,8 @@ func GetIssueReactions(ctx *context.APIContext) {
// "$ref": "#/responses/ReactionList"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
issue, err := issues_model.GetIssueWithAttrsByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
@@ -345,6 +353,8 @@ func PostIssueReaction(ctx *context.APIContext) {
// "$ref": "#/responses/Reaction"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditReactionOption)
changeIssueReaction(ctx, *form, true)
}
@@ -384,6 +394,8 @@ func DeleteIssueReaction(ctx *context.APIContext) {
// "$ref": "#/responses/empty"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditReactionOption)
changeIssueReaction(ctx, *form, false)
}
diff --git a/routers/api/v1/repo/issue_tracked_time.go b/routers/api/v1/repo/issue_tracked_time.go
index 3286a7c82e..ecbc5cf00f 100644
--- a/routers/api/v1/repo/issue_tracked_time.go
+++ b/routers/api/v1/repo/issue_tracked_time.go
@@ -178,6 +178,8 @@ func AddTime(ctx *context.APIContext) {
// "$ref": "#/responses/error"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.AddTimeOption)
issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
@@ -259,6 +261,8 @@ func ResetIssueTime(ctx *context.APIContext) {
// "$ref": "#/responses/error"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
@@ -330,6 +334,8 @@ func DeleteTime(ctx *context.APIContext) {
// "$ref": "#/responses/error"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
issue, err := issues_model.GetIssueByIndex(ctx, ctx.Repo.Repository.ID, ctx.ParamsInt64(":index"))
if err != nil {
@@ -409,6 +415,8 @@ func ListTrackedTimesByUser(ctx *context.APIContext) {
// "$ref": "#/responses/error"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
ctx.Error(http.StatusBadRequest, "", "time tracking disabled")
@@ -497,6 +505,8 @@ func ListTrackedTimesByRepository(ctx *context.APIContext) {
// "$ref": "#/responses/error"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
if !ctx.Repo.Repository.IsTimetrackerEnabled(ctx) {
ctx.Error(http.StatusBadRequest, "", "time tracking disabled")
diff --git a/routers/api/v1/repo/key.go b/routers/api/v1/repo/key.go
index 824880880a..b7d820d1d8 100644
--- a/routers/api/v1/repo/key.go
+++ b/routers/api/v1/repo/key.go
@@ -80,6 +80,8 @@ func ListDeployKeys(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/DeployKeyList"
+ // "404":
+ // "$ref": "#/responses/notFound"
opts := &asymkey_model.ListDeployKeysOptions{
ListOptions: utils.GetListOptions(ctx),
@@ -144,6 +146,8 @@ func GetDeployKey(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/DeployKey"
+ // "404":
+ // "$ref": "#/responses/notFound"
key, err := asymkey_model.GetDeployKeyByID(ctx, ctx.ParamsInt64(":id"))
if err != nil {
@@ -222,6 +226,8 @@ func CreateDeployKey(ctx *context.APIContext) {
// responses:
// "201":
// "$ref": "#/responses/DeployKey"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/validationError"
@@ -270,6 +276,8 @@ func DeleteDeploykey(ctx *context.APIContext) {
// "$ref": "#/responses/empty"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
if err := asymkey_service.DeleteDeployKey(ctx.Doer, ctx.ParamsInt64(":id")); err != nil {
if asymkey_model.IsErrKeyAccessDenied(err) {
diff --git a/routers/api/v1/repo/label.go b/routers/api/v1/repo/label.go
index fc9a16b58a..e93c72a9f5 100644
--- a/routers/api/v1/repo/label.go
+++ b/routers/api/v1/repo/label.go
@@ -46,6 +46,8 @@ func ListLabels(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/LabelList"
+ // "404":
+ // "$ref": "#/responses/notFound"
labels, err := issues_model.GetLabelsByRepoID(ctx, ctx.Repo.Repository.ID, ctx.FormString("sort"), utils.GetListOptions(ctx))
if err != nil {
@@ -90,6 +92,8 @@ func GetLabel(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Label"
+ // "404":
+ // "$ref": "#/responses/notFound"
var (
l *issues_model.Label
@@ -140,6 +144,8 @@ func CreateLabel(ctx *context.APIContext) {
// responses:
// "201":
// "$ref": "#/responses/Label"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/validationError"
@@ -200,6 +206,8 @@ func EditLabel(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Label"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/validationError"
@@ -265,6 +273,8 @@ func DeleteLabel(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
if err := issues_model.DeleteLabel(ctx.Repo.Repository.ID, ctx.ParamsInt64(":id")); err != nil {
ctx.Error(http.StatusInternalServerError, "DeleteLabel", err)
diff --git a/routers/api/v1/repo/milestone.go b/routers/api/v1/repo/milestone.go
index b77fe8aca8..fff9493a23 100644
--- a/routers/api/v1/repo/milestone.go
+++ b/routers/api/v1/repo/milestone.go
@@ -55,6 +55,8 @@ func ListMilestones(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/MilestoneList"
+ // "404":
+ // "$ref": "#/responses/notFound"
milestones, total, err := issues_model.GetMilestones(issues_model.GetMilestonesOption{
ListOptions: utils.GetListOptions(ctx),
@@ -102,6 +104,8 @@ func GetMilestone(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Milestone"
+ // "404":
+ // "$ref": "#/responses/notFound"
milestone := getMilestoneByIDOrName(ctx)
if ctx.Written() {
@@ -138,6 +142,8 @@ func CreateMilestone(ctx *context.APIContext) {
// responses:
// "201":
// "$ref": "#/responses/Milestone"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.CreateMilestoneOption)
if form.Deadline == nil {
@@ -196,6 +202,8 @@ func EditMilestone(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Milestone"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditMilestoneOption)
milestone := getMilestoneByIDOrName(ctx)
if ctx.Written() {
@@ -248,6 +256,8 @@ func DeleteMilestone(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
m := getMilestoneByIDOrName(ctx)
if ctx.Written() {
diff --git a/routers/api/v1/repo/mirror.go b/routers/api/v1/repo/mirror.go
index 60f1bfe0d3..12542c808f 100644
--- a/routers/api/v1/repo/mirror.go
+++ b/routers/api/v1/repo/mirror.go
@@ -48,6 +48,8 @@ func MirrorSync(ctx *context.APIContext) {
// "$ref": "#/responses/empty"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
repo := ctx.Repo.Repository
@@ -99,6 +101,8 @@ func PushMirrorSync(ctx *context.APIContext) {
// "$ref": "#/responses/error"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
if !setting.Mirror.Enabled {
ctx.Error(http.StatusBadRequest, "PushMirrorSync", "Mirror feature is disabled")
@@ -154,6 +158,8 @@ func ListPushMirrors(ctx *context.APIContext) {
// "$ref": "#/responses/error"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
if !setting.Mirror.Enabled {
ctx.Error(http.StatusBadRequest, "GetPushMirrorsByRepoID", "Mirror feature is disabled")
@@ -211,6 +217,8 @@ func GetPushMirrorByName(ctx *context.APIContext) {
// "$ref": "#/responses/error"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
if !setting.Mirror.Enabled {
ctx.Error(http.StatusBadRequest, "GetPushMirrorByRemoteName", "Mirror feature is disabled")
@@ -263,6 +271,8 @@ func AddPushMirror(ctx *context.APIContext) {
// "$ref": "#/responses/forbidden"
// "400":
// "$ref": "#/responses/error"
+ // "404":
+ // "$ref": "#/responses/notFound"
if !setting.Mirror.Enabled {
ctx.Error(http.StatusBadRequest, "AddPushMirror", "Mirror feature is disabled")
diff --git a/routers/api/v1/repo/patch.go b/routers/api/v1/repo/patch.go
index d2f055355d..080908ab7e 100644
--- a/routers/api/v1/repo/patch.go
+++ b/routers/api/v1/repo/patch.go
@@ -45,6 +45,8 @@ func ApplyDiffPatch(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/FileResponse"
+ // "404":
+ // "$ref": "#/responses/notFound"
apiOpts := web.GetForm(ctx).(*api.ApplyDiffPatchFileOptions)
opts := &files.ApplyDiffPatchOptions{
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index f0b958c4cd..01ce754c74 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -92,6 +92,8 @@ func ListPullRequests(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/PullRequestList"
+ // "404":
+ // "$ref": "#/responses/notFound"
listOptions := utils.GetListOptions(ctx)
@@ -274,6 +276,8 @@ func CreatePullRequest(ctx *context.APIContext) {
// responses:
// "201":
// "$ref": "#/responses/PullRequest"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "409":
// "$ref": "#/responses/error"
// "422":
@@ -463,6 +467,8 @@ func EditPullRequest(ctx *context.APIContext) {
// "$ref": "#/responses/PullRequest"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "409":
// "$ref": "#/responses/error"
// "412":
@@ -729,6 +735,8 @@ func MergePullRequest(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "405":
// "$ref": "#/responses/empty"
// "409":
diff --git a/routers/api/v1/repo/pull_review.go b/routers/api/v1/repo/pull_review.go
index a568cd565a..82cbb3e763 100644
--- a/routers/api/v1/repo/pull_review.go
+++ b/routers/api/v1/repo/pull_review.go
@@ -819,6 +819,8 @@ func DismissPullReview(ctx *context.APIContext) {
// "$ref": "#/responses/PullReview"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/validationError"
opts := web.GetForm(ctx).(*api.DismissPullReviewOptions)
@@ -860,6 +862,8 @@ func UnDismissPullReview(ctx *context.APIContext) {
// "$ref": "#/responses/PullReview"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/validationError"
dismissReview(ctx, "", false, false)
diff --git a/routers/api/v1/repo/release.go b/routers/api/v1/repo/release.go
index af7199d1d6..be9c0cd00a 100644
--- a/routers/api/v1/repo/release.go
+++ b/routers/api/v1/repo/release.go
@@ -150,6 +150,8 @@ func ListReleases(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/ReleaseList"
+ // "404":
+ // "$ref": "#/responses/notFound"
listOptions := utils.GetListOptions(ctx)
if listOptions.PageSize == 0 && ctx.FormInt("per_page") != 0 {
listOptions.PageSize = ctx.FormInt("per_page")
diff --git a/routers/api/v1/repo/release_attachment.go b/routers/api/v1/repo/release_attachment.go
index a7d73acceb..9571c8ebb9 100644
--- a/routers/api/v1/repo/release_attachment.go
+++ b/routers/api/v1/repo/release_attachment.go
@@ -50,6 +50,8 @@ func GetReleaseAttachment(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Attachment"
+ // "404":
+ // "$ref": "#/responses/notFound"
releaseID := ctx.ParamsInt64(":id")
attachID := ctx.ParamsInt64(":attachment_id")
@@ -98,6 +100,8 @@ func ListReleaseAttachments(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/AttachmentList"
+ // "404":
+ // "$ref": "#/responses/notFound"
releaseID := ctx.ParamsInt64(":id")
release, err := repo_model.GetReleaseByID(ctx, releaseID)
@@ -161,6 +165,8 @@ func CreateReleaseAttachment(ctx *context.APIContext) {
// "$ref": "#/responses/Attachment"
// "400":
// "$ref": "#/responses/error"
+ // "404":
+ // "$ref": "#/responses/notFound"
// Check if attachments are enabled
if !setting.Attachment.Enabled {
@@ -251,6 +257,8 @@ func EditReleaseAttachment(ctx *context.APIContext) {
// responses:
// "201":
// "$ref": "#/responses/Attachment"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.EditAttachmentOptions)
@@ -315,6 +323,8 @@ func DeleteReleaseAttachment(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
// Check if release exists an load release
releaseID := ctx.ParamsInt64(":id")
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go
index e86743d55a..e06fc2df66 100644
--- a/routers/api/v1/repo/repo.go
+++ b/routers/api/v1/repo/repo.go
@@ -451,6 +451,8 @@ func CreateOrgRepoDeprecated(ctx *context.APIContext) {
// "$ref": "#/responses/validationError"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
CreateOrgRepo(ctx)
}
@@ -533,6 +535,8 @@ func Get(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Repository"
+ // "404":
+ // "$ref": "#/responses/notFound"
if err := ctx.Repo.Repository.LoadAttributes(ctx); err != nil {
ctx.Error(http.StatusInternalServerError, "Repository.LoadAttributes", err)
@@ -559,6 +563,8 @@ func GetByID(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/Repository"
+ // "404":
+ // "$ref": "#/responses/notFound"
repo, err := repo_model.GetRepositoryByID(ctx, ctx.ParamsInt64(":id"))
if err != nil {
@@ -609,6 +615,8 @@ func Edit(ctx *context.APIContext) {
// "$ref": "#/responses/Repository"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/validationError"
@@ -1100,6 +1108,8 @@ func Delete(ctx *context.APIContext) {
// "$ref": "#/responses/empty"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
owner := ctx.Repo.Owner
repo := ctx.Repo.Repository
@@ -1147,6 +1157,8 @@ func GetIssueTemplates(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/IssueTemplates"
+ // "404":
+ // "$ref": "#/responses/notFound"
ret, err := issue.GetTemplatesFromDefaultBranch(ctx.Repo.Repository, ctx.Repo.GitRepo)
if err != nil {
ctx.Error(http.StatusInternalServerError, "GetTemplatesFromDefaultBranch", err)
@@ -1176,6 +1188,8 @@ func GetIssueConfig(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/RepoIssueConfig"
+ // "404":
+ // "$ref": "#/responses/notFound"
issueConfig, _ := issue.GetTemplateConfigFromDefaultBranch(ctx.Repo.Repository, ctx.Repo.GitRepo)
ctx.JSON(http.StatusOK, issueConfig)
}
@@ -1201,6 +1215,8 @@ func ValidateIssueConfig(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/RepoIssueConfigValidation"
+ // "404":
+ // "$ref": "#/responses/notFound"
_, err := issue.GetTemplateConfigFromDefaultBranch(ctx.Repo.Repository, ctx.Repo.GitRepo)
if err == nil {
diff --git a/routers/api/v1/repo/star.go b/routers/api/v1/repo/star.go
index e4cf0ffab6..fccc76b518 100644
--- a/routers/api/v1/repo/star.go
+++ b/routers/api/v1/repo/star.go
@@ -42,6 +42,8 @@ func ListStargazers(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/UserList"
+ // "404":
+ // "$ref": "#/responses/notFound"
stargazers, err := repo_model.GetStargazers(ctx.Repo.Repository, utils.GetListOptions(ctx))
if err != nil {
diff --git a/routers/api/v1/repo/status.go b/routers/api/v1/repo/status.go
index 028e3083c6..926d91ca81 100644
--- a/routers/api/v1/repo/status.go
+++ b/routers/api/v1/repo/status.go
@@ -48,6 +48,8 @@ func NewCommitStatus(ctx *context.APIContext) {
// "$ref": "#/responses/CommitStatus"
// "400":
// "$ref": "#/responses/error"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.CreateStatusOption)
sha := ctx.Params("sha")
@@ -117,6 +119,8 @@ func GetCommitStatuses(ctx *context.APIContext) {
// "$ref": "#/responses/CommitStatusList"
// "400":
// "$ref": "#/responses/error"
+ // "404":
+ // "$ref": "#/responses/notFound"
getCommitStatuses(ctx, ctx.Params("sha"))
}
@@ -169,6 +173,8 @@ func GetCommitStatusesByRef(ctx *context.APIContext) {
// "$ref": "#/responses/CommitStatusList"
// "400":
// "$ref": "#/responses/error"
+ // "404":
+ // "$ref": "#/responses/notFound"
filter := utils.ResolveRefOrSha(ctx, ctx.Params("ref"))
if ctx.Written() {
@@ -245,6 +251,8 @@ func GetCombinedCommitStatusByRef(ctx *context.APIContext) {
// "$ref": "#/responses/CombinedStatus"
// "400":
// "$ref": "#/responses/error"
+ // "404":
+ // "$ref": "#/responses/notFound"
sha := utils.ResolveRefOrSha(ctx, ctx.Params("ref"))
if ctx.Written() {
diff --git a/routers/api/v1/repo/subscriber.go b/routers/api/v1/repo/subscriber.go
index 613fbee409..61d9470707 100644
--- a/routers/api/v1/repo/subscriber.go
+++ b/routers/api/v1/repo/subscriber.go
@@ -42,6 +42,8 @@ func ListSubscribers(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/UserList"
+ // "404":
+ // "$ref": "#/responses/notFound"
subscribers, err := repo_model.GetRepoWatchers(ctx.Repo.Repository.ID, utils.GetListOptions(ctx))
if err != nil {
diff --git a/routers/api/v1/repo/tag.go b/routers/api/v1/repo/tag.go
index b28b6b0b91..0c0a73698f 100644
--- a/routers/api/v1/repo/tag.go
+++ b/routers/api/v1/repo/tag.go
@@ -47,6 +47,8 @@ func ListTags(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/TagList"
+ // "404":
+ // "$ref": "#/responses/notFound"
listOpts := utils.GetListOptions(ctx)
@@ -93,6 +95,8 @@ func GetAnnotatedTag(ctx *context.APIContext) {
// "$ref": "#/responses/AnnotatedTag"
// "400":
// "$ref": "#/responses/error"
+ // "404":
+ // "$ref": "#/responses/notFound"
sha := ctx.Params("sha")
if len(sha) == 0 {
diff --git a/routers/api/v1/repo/teams.go b/routers/api/v1/repo/teams.go
index d1be619cac..2887e89603 100644
--- a/routers/api/v1/repo/teams.go
+++ b/routers/api/v1/repo/teams.go
@@ -35,6 +35,8 @@ func ListTeams(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/TeamList"
+ // "404":
+ // "$ref": "#/responses/notFound"
if !ctx.Repo.Owner.IsOrganization() {
ctx.Error(http.StatusMethodNotAllowed, "noOrg", "repo is not owned by an organization")
@@ -140,6 +142,8 @@ func AddTeam(ctx *context.APIContext) {
// "$ref": "#/responses/validationError"
// "405":
// "$ref": "#/responses/error"
+ // "404":
+ // "$ref": "#/responses/notFound"
changeRepoTeam(ctx, true)
}
@@ -174,6 +178,8 @@ func DeleteTeam(ctx *context.APIContext) {
// "$ref": "#/responses/validationError"
// "405":
// "$ref": "#/responses/error"
+ // "404":
+ // "$ref": "#/responses/notFound"
changeRepoTeam(ctx, false)
}
diff --git a/routers/api/v1/repo/topic.go b/routers/api/v1/repo/topic.go
index 8bf3012d48..c0c05154c4 100644
--- a/routers/api/v1/repo/topic.go
+++ b/routers/api/v1/repo/topic.go
@@ -45,6 +45,8 @@ func ListTopics(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/TopicNames"
+ // "404":
+ // "$ref": "#/responses/notFound"
opts := &repo_model.FindTopicOptions{
ListOptions: utils.GetListOptions(ctx),
@@ -93,6 +95,8 @@ func UpdateTopics(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/invalidTopicsError"
@@ -152,6 +156,8 @@ func AddTopic(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/invalidTopicsError"
@@ -217,6 +223,8 @@ func DeleteTopic(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
// "422":
// "$ref": "#/responses/invalidTopicsError"
@@ -271,6 +279,8 @@ func TopicSearch(ctx *context.APIContext) {
// "$ref": "#/responses/TopicListResponse"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
opts := &repo_model.FindTopicOptions{
Keyword: ctx.FormString("q"),
diff --git a/routers/api/v1/repo/tree.go b/routers/api/v1/repo/tree.go
index 9df96204cb..f63100b6ea 100644
--- a/routers/api/v1/repo/tree.go
+++ b/routers/api/v1/repo/tree.go
@@ -53,6 +53,8 @@ func GetTree(ctx *context.APIContext) {
// "$ref": "#/responses/GitTreeResponse"
// "400":
// "$ref": "#/responses/error"
+ // "404":
+ // "$ref": "#/responses/notFound"
sha := ctx.Params(":sha")
if len(sha) == 0 {
diff --git a/routers/api/v1/repo/wiki.go b/routers/api/v1/repo/wiki.go
index 1fd1b91936..4ea3fbd11d 100644
--- a/routers/api/v1/repo/wiki.go
+++ b/routers/api/v1/repo/wiki.go
@@ -50,6 +50,8 @@ func NewWikiPage(ctx *context.APIContext) {
// "$ref": "#/responses/error"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.CreateWikiPageOptions)
@@ -124,6 +126,8 @@ func EditWikiPage(ctx *context.APIContext) {
// "$ref": "#/responses/error"
// "403":
// "$ref": "#/responses/forbidden"
+ // "404":
+ // "$ref": "#/responses/notFound"
form := web.GetForm(ctx).(*api.CreateWikiPageOptions)
diff --git a/routers/api/v1/user/follower.go b/routers/api/v1/user/follower.go
index bc03b22ea7..1aa906ccb1 100644
--- a/routers/api/v1/user/follower.go
+++ b/routers/api/v1/user/follower.go
@@ -80,6 +80,8 @@ func ListFollowers(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/UserList"
+ // "404":
+ // "$ref": "#/responses/notFound"
listUserFollowers(ctx, ctx.ContextUser)
}
@@ -142,6 +144,8 @@ func ListFollowing(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/UserList"
+ // "404":
+ // "$ref": "#/responses/notFound"
listUserFollowing(ctx, ctx.ContextUser)
}
@@ -217,6 +221,8 @@ func Follow(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
if err := user_model.FollowUser(ctx.Doer.ID, ctx.ContextUser.ID); err != nil {
ctx.Error(http.StatusInternalServerError, "FollowUser", err)
@@ -239,6 +245,8 @@ func Unfollow(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
if err := user_model.UnfollowUser(ctx.Doer.ID, ctx.ContextUser.ID); err != nil {
ctx.Error(http.StatusInternalServerError, "UnfollowUser", err)
diff --git a/routers/api/v1/user/gpg_key.go b/routers/api/v1/user/gpg_key.go
index 84327cc92a..4aebbaf314 100644
--- a/routers/api/v1/user/gpg_key.go
+++ b/routers/api/v1/user/gpg_key.go
@@ -63,6 +63,8 @@ func ListGPGKeys(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/GPGKeyList"
+ // "404":
+ // "$ref": "#/responses/notFound"
listGPGKeys(ctx, ctx.ContextUser.ID, utils.GetListOptions(ctx))
}
diff --git a/routers/api/v1/user/key.go b/routers/api/v1/user/key.go
index 6c04d0943a..21cc560847 100644
--- a/routers/api/v1/user/key.go
+++ b/routers/api/v1/user/key.go
@@ -150,6 +150,8 @@ func ListPublicKeys(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/PublicKeyList"
+ // "404":
+ // "$ref": "#/responses/notFound"
listPublicKeys(ctx, ctx.ContextUser)
}
diff --git a/routers/api/v1/user/repo.go b/routers/api/v1/user/repo.go
index 86af8cb440..26ebf89746 100644
--- a/routers/api/v1/user/repo.go
+++ b/routers/api/v1/user/repo.go
@@ -78,6 +78,8 @@ func ListUserRepos(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/RepositoryList"
+ // "404":
+ // "$ref": "#/responses/notFound"
private := ctx.IsSigned
listUserRepos(ctx, ctx.ContextUser, private)
@@ -160,6 +162,8 @@ func ListOrgRepos(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/RepositoryList"
+ // "404":
+ // "$ref": "#/responses/notFound"
listUserRepos(ctx, ctx.Org.Organization.AsUser(), ctx.IsSigned)
}
diff --git a/routers/api/v1/user/star.go b/routers/api/v1/user/star.go
index 9399ad2b4d..09f799cc6a 100644
--- a/routers/api/v1/user/star.go
+++ b/routers/api/v1/user/star.go
@@ -61,6 +61,8 @@ func GetStarredRepos(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/RepositoryList"
+ // "404":
+ // "$ref": "#/responses/notFound"
private := ctx.ContextUser.ID == ctx.Doer.ID
repos, err := getStarredRepos(ctx, ctx.ContextUser, private, utils.GetListOptions(ctx))
@@ -150,6 +152,8 @@ func Star(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
err := repo_model.StarRepo(ctx.Doer.ID, ctx.Repo.Repository.ID, true)
if err != nil {
@@ -178,6 +182,8 @@ func Unstar(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
err := repo_model.StarRepo(ctx.Doer.ID, ctx.Repo.Repository.ID, false)
if err != nil {
diff --git a/routers/api/v1/user/watch.go b/routers/api/v1/user/watch.go
index 172d9d5cc5..b5899baa93 100644
--- a/routers/api/v1/user/watch.go
+++ b/routers/api/v1/user/watch.go
@@ -59,6 +59,8 @@ func GetWatchedRepos(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/RepositoryList"
+ // "404":
+ // "$ref": "#/responses/notFound"
private := ctx.ContextUser.ID == ctx.Doer.ID
repos, total, err := getWatchedRepos(ctx, ctx.ContextUser, private, utils.GetListOptions(ctx))
@@ -155,6 +157,8 @@ func Watch(ctx *context.APIContext) {
// responses:
// "200":
// "$ref": "#/responses/WatchInfo"
+ // "404":
+ // "$ref": "#/responses/notFound"
err := repo_model.WatchRepo(ctx, ctx.Doer.ID, ctx.Repo.Repository.ID, true)
if err != nil {
@@ -190,6 +194,8 @@ func Unwatch(ctx *context.APIContext) {
// responses:
// "204":
// "$ref": "#/responses/empty"
+ // "404":
+ // "$ref": "#/responses/notFound"
err := repo_model.WatchRepo(ctx, ctx.Doer.ID, ctx.Repo.Repository.ID, false)
if err != nil {