mirror of
https://github.com/go-gitea/gitea
synced 2024-12-25 01:54:26 +00:00
[API] GetCombinedCommitStatusByRef always return json & swagger doc fixes (#14047)
* Fix swagger docs * always return json
This commit is contained in:
parent
df11075389
commit
96d41287e5
@ -244,7 +244,7 @@ type combinedCommitStatus struct {
|
||||
|
||||
// GetCombinedCommitStatusByRef returns the combined status for any given commit hash
|
||||
func GetCombinedCommitStatusByRef(ctx *context.APIContext) {
|
||||
// swagger:operation GET /repos/{owner}/{repo}/commits/{ref}/statuses repository repoGetCombinedStatusByRef
|
||||
// swagger:operation GET /repos/{owner}/{repo}/commits/{ref}/status repository repoGetCombinedStatusByRef
|
||||
// ---
|
||||
// summary: Get a commit's combined status, by branch/tag/commit reference
|
||||
// produces:
|
||||
@ -272,7 +272,7 @@ func GetCombinedCommitStatusByRef(ctx *context.APIContext) {
|
||||
// required: false
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Status"
|
||||
// "$ref": "#/responses/CombinedStatus"
|
||||
// "400":
|
||||
// "$ref": "#/responses/error"
|
||||
|
||||
@ -292,7 +292,7 @@ func GetCombinedCommitStatusByRef(ctx *context.APIContext) {
|
||||
}
|
||||
|
||||
if len(statuses) == 0 {
|
||||
ctx.Status(http.StatusOK)
|
||||
ctx.JSON(http.StatusOK, &api.CombinedStatus{})
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -309,3 +309,10 @@ type swaggerLanguageStatistics struct {
|
||||
// in: body
|
||||
Body map[string]int64 `json:"body"`
|
||||
}
|
||||
|
||||
// CombinedStatus
|
||||
// swagger:response CombinedStatus
|
||||
type swaggerCombinedStatus struct {
|
||||
// in: body
|
||||
Body api.CombinedStatus `json:"body"`
|
||||
}
|
||||
|
@ -2829,7 +2829,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/commits/{ref}/statuses": {
|
||||
"/repos/{owner}/{repo}/commits/{ref}/status": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
@ -2870,7 +2870,88 @@
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/Status"
|
||||
"$ref": "#/responses/CombinedStatus"
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/responses/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/commits/{ref}/statuses": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"repository"
|
||||
],
|
||||
"summary": "Get a commit's statuses, by branch/tag/commit reference",
|
||||
"operationId": "repoListStatusesByRef",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "owner of the repo",
|
||||
"name": "owner",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "name of the repo",
|
||||
"name": "repo",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "name of branch/tag/commit",
|
||||
"name": "ref",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"oldest",
|
||||
"recentupdate",
|
||||
"leastupdate",
|
||||
"leastindex",
|
||||
"highestindex"
|
||||
],
|
||||
"type": "string",
|
||||
"description": "type of sort",
|
||||
"name": "sort",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"pending",
|
||||
"success",
|
||||
"error",
|
||||
"failure",
|
||||
"warning"
|
||||
],
|
||||
"type": "string",
|
||||
"description": "type of state",
|
||||
"name": "state",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "page number of results to return (1-based)",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "page size of results",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/StatusList"
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/responses/error"
|
||||
@ -11240,6 +11321,43 @@
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"CombinedStatus": {
|
||||
"description": "CombinedStatus holds the combined state of several statuses for a single commit",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"commit_url": {
|
||||
"type": "string",
|
||||
"x-go-name": "CommitURL"
|
||||
},
|
||||
"repository": {
|
||||
"$ref": "#/definitions/Repository"
|
||||
},
|
||||
"sha": {
|
||||
"type": "string",
|
||||
"x-go-name": "SHA"
|
||||
},
|
||||
"state": {
|
||||
"$ref": "#/definitions/StatusState"
|
||||
},
|
||||
"statuses": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Status"
|
||||
},
|
||||
"x-go-name": "Statuses"
|
||||
},
|
||||
"total_count": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "TotalCount"
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"x-go-name": "URL"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"Comment": {
|
||||
"description": "Comment represents a comment on a commit or issue",
|
||||
"type": "object",
|
||||
@ -15532,6 +15650,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"CombinedStatus": {
|
||||
"description": "CombinedStatus",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/CombinedStatus"
|
||||
}
|
||||
},
|
||||
"Comment": {
|
||||
"description": "Comment",
|
||||
"schema": {
|
||||
|
Loading…
Reference in New Issue
Block a user