forked from forgejo/forgejo
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.
This commit is contained in:
parent
8ecdc93f8b
commit
aaeec2a392
46 changed files with 750 additions and 0 deletions
|
@ -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)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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":
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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":
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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{
|
||||
|
|
|
@ -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":
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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"),
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue