add some reponse status on api docs (#15399)

Signed-off-by: a1012112796 <1012112796@qq.com>

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: 6543 <6543@obermui.de>
tokarchuk/v1.17
a1012112796 4 years ago committed by GitHub
parent 18efe9a023
commit 63411309fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      routers/api/v1/user/app.go
  2. 18
      templates/swagger/v1_json.tmpl

@ -88,6 +88,8 @@ func CreateAccessToken(ctx *context.APIContext) {
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/AccessToken" // "$ref": "#/responses/AccessToken"
// "400":
// "$ref": "#/responses/error"
form := web.GetForm(ctx).(*api.CreateAccessTokenOption) form := web.GetForm(ctx).(*api.CreateAccessTokenOption)
@ -139,6 +141,8 @@ func DeleteAccessToken(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
// "422": // "422":
// "$ref": "#/responses/error" // "$ref": "#/responses/error"
@ -199,6 +203,8 @@ func CreateOauth2Application(ctx *context.APIContext) {
// responses: // responses:
// "201": // "201":
// "$ref": "#/responses/OAuth2Application" // "$ref": "#/responses/OAuth2Application"
// "400":
// "$ref": "#/responses/error"
data := web.GetForm(ctx).(*api.CreateOAuth2ApplicationOptions) data := web.GetForm(ctx).(*api.CreateOAuth2ApplicationOptions)
@ -272,6 +278,8 @@ func DeleteOauth2Application(ctx *context.APIContext) {
// responses: // responses:
// "204": // "204":
// "$ref": "#/responses/empty" // "$ref": "#/responses/empty"
// "404":
// "$ref": "#/responses/notFound"
appID := ctx.ParamsInt64(":id") appID := ctx.ParamsInt64(":id")
if err := models.DeleteOAuth2Application(appID, ctx.User.ID); err != nil { if err := models.DeleteOAuth2Application(appID, ctx.User.ID); err != nil {
if models.IsErrOAuthApplicationNotFound(err) { if models.IsErrOAuthApplicationNotFound(err) {
@ -302,6 +310,8 @@ func GetOauth2Application(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/OAuth2Application" // "$ref": "#/responses/OAuth2Application"
// "404":
// "$ref": "#/responses/notFound"
appID := ctx.ParamsInt64(":id") appID := ctx.ParamsInt64(":id")
app, err := models.GetOAuth2ApplicationByID(appID) app, err := models.GetOAuth2ApplicationByID(appID)
if err != nil { if err != nil {
@ -340,6 +350,8 @@ func UpdateOauth2Application(ctx *context.APIContext) {
// responses: // responses:
// "200": // "200":
// "$ref": "#/responses/OAuth2Application" // "$ref": "#/responses/OAuth2Application"
// "404":
// "$ref": "#/responses/notFound"
appID := ctx.ParamsInt64(":id") appID := ctx.ParamsInt64(":id")
data := web.GetForm(ctx).(*api.CreateOAuth2ApplicationOptions) data := web.GetForm(ctx).(*api.CreateOAuth2ApplicationOptions)

@ -10068,6 +10068,9 @@
"responses": { "responses": {
"201": { "201": {
"$ref": "#/responses/OAuth2Application" "$ref": "#/responses/OAuth2Application"
},
"400": {
"$ref": "#/responses/error"
} }
} }
} }
@ -10095,6 +10098,9 @@
"responses": { "responses": {
"200": { "200": {
"$ref": "#/responses/OAuth2Application" "$ref": "#/responses/OAuth2Application"
},
"404": {
"$ref": "#/responses/notFound"
} }
} }
}, },
@ -10120,6 +10126,9 @@
"responses": { "responses": {
"204": { "204": {
"$ref": "#/responses/empty" "$ref": "#/responses/empty"
},
"404": {
"$ref": "#/responses/notFound"
} }
} }
}, },
@ -10153,6 +10162,9 @@
"responses": { "responses": {
"200": { "200": {
"$ref": "#/responses/OAuth2Application" "$ref": "#/responses/OAuth2Application"
},
"404": {
"$ref": "#/responses/notFound"
} }
} }
} }
@ -11492,6 +11504,9 @@
"responses": { "responses": {
"201": { "201": {
"$ref": "#/responses/AccessToken" "$ref": "#/responses/AccessToken"
},
"400": {
"$ref": "#/responses/error"
} }
} }
} }
@ -11526,6 +11541,9 @@
"204": { "204": {
"$ref": "#/responses/empty" "$ref": "#/responses/empty"
}, },
"404": {
"$ref": "#/responses/notFound"
},
"422": { "422": {
"$ref": "#/responses/error" "$ref": "#/responses/error"
} }

Loading…
Cancel
Save