feat: add authorize button and defaultValue (#2152)

Signed-off-by: baihhh <2542274498@qq.com>
This commit is contained in:
Baihhh 2023-07-27 23:55:35 +08:00 committed by GitHub
parent ca47af2ee1
commit 5e4ba4f338
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 117 additions and 44 deletions

View File

@ -26,9 +26,10 @@ import (
// @Title GetWebhooks // @Title GetWebhooks
// @Tag Webhook API // @Tag Webhook API
// @Description get webhooks // @Description get webhooks
// @Param owner query string true "The owner of webhooks" // @Param owner query string built-in/admin true "The owner of webhooks"
// @Success 200 {array} object.Webhook The Response object // @Success 200 {array} object.Webhook The Response object
// @router /get-webhooks [get] // @router /get-webhooks [get]
// @Security test_apiKey
func (c *ApiController) GetWebhooks() { func (c *ApiController) GetWebhooks() {
owner := c.Input().Get("owner") owner := c.Input().Get("owner")
limit := c.Input().Get("pageSize") limit := c.Input().Get("pageSize")
@ -71,7 +72,7 @@ func (c *ApiController) GetWebhooks() {
// @Title GetWebhook // @Title GetWebhook
// @Tag Webhook API // @Tag Webhook API
// @Description get webhook // @Description get webhook
// @Param id query string true "The id ( owner/name ) of the webhook" // @Param id query string built-in/admin true "The id ( owner/name ) of the webhook"
// @Success 200 {object} object.Webhook The Response object // @Success 200 {object} object.Webhook The Response object
// @router /get-webhook [get] // @router /get-webhook [get]
func (c *ApiController) GetWebhook() { func (c *ApiController) GetWebhook() {
@ -90,7 +91,7 @@ func (c *ApiController) GetWebhook() {
// @Title UpdateWebhook // @Title UpdateWebhook
// @Tag Webhook API // @Tag Webhook API
// @Description update webhook // @Description update webhook
// @Param id query string true "The id ( owner/name ) of the webhook" // @Param id query string built-in/admin true "The id ( owner/name ) of the webhook"
// @Param body body object.Webhook true "The details of the webhook" // @Param body body object.Webhook true "The details of the webhook"
// @Success 200 {object} controllers.Response The Response object // @Success 200 {object} controllers.Response The Response object
// @router /update-webhook [post] // @router /update-webhook [post]

View File

@ -17,6 +17,10 @@
// @Title Casdoor API // @Title Casdoor API
// @Description Documentation of Casdoor API // @Description Documentation of Casdoor API
// @Contact admin@casbin.org // @Contact admin@casbin.org
// @SecurityDefinition test_apiKey apiKey Authorization header
// @Schemes http,https
// @ExternalDocs Find out more about casdoor
// @ExternalDocsUrl https://casdoor.org/
package routers package routers
import ( import (

View File

@ -9,6 +9,10 @@
} }
}, },
"basePath": "/", "basePath": "/",
"schemes": [
"http",
"https"
],
"paths": { "paths": {
"/.well-known/jwks": { "/.well-known/jwks": {
"get": { "get": {
@ -3682,7 +3686,8 @@
"name": "id", "name": "id",
"description": "The id ( owner/name ) of the webhook", "description": "The id ( owner/name ) of the webhook",
"required": true, "required": true,
"type": "string" "type": "string",
"default": "built-in/admin"
} }
], ],
"responses": { "responses": {
@ -3708,7 +3713,8 @@
"name": "owner", "name": "owner",
"description": "The owner of webhooks", "description": "The owner of webhooks",
"required": true, "required": true,
"type": "string" "type": "string",
"default": "built-in/admin"
} }
], ],
"responses": { "responses": {
@ -3721,7 +3727,12 @@
} }
} }
} }
} },
"security": [
{
"test_apiKey": []
}
]
} }
}, },
"/api/health": { "/api/health": {
@ -5170,7 +5181,8 @@
"name": "id", "name": "id",
"description": "The id ( owner/name ) of the webhook", "description": "The id ( owner/name ) of the webhook",
"required": true, "required": true,
"type": "string" "type": "string",
"default": "built-in/admin"
}, },
{ {
"in": "body", "in": "body",
@ -5419,14 +5431,6 @@
} }
}, },
"definitions": { "definitions": {
"1225.0xc000333110.false": {
"title": "false",
"type": "object"
},
"1260.0xc000333140.false": {
"title": "false",
"type": "object"
},
"LaravelResponse": { "LaravelResponse": {
"title": "LaravelResponse", "title": "LaravelResponse",
"type": "object" "type": "object"
@ -5480,10 +5484,16 @@
"type": "object", "type": "object",
"properties": { "properties": {
"data": { "data": {
"$ref": "#/definitions/1225.0xc000333110.false" "additionalProperties": {
"description": "support string | class | List\u003cclass\u003e and os on",
"type": "string"
}
}, },
"data2": { "data2": {
"$ref": "#/definitions/1260.0xc000333140.false" "additionalProperties": {
"description": "support string | class | List\u003cclass\u003e and os on",
"type": "string"
}
}, },
"msg": { "msg": {
"type": "string" "type": "string"
@ -5525,10 +5535,6 @@
"title": "object", "title": "object",
"type": "object" "type": "object"
}, },
"object.\u0026{197582 0xc000ace360 false}": {
"title": "\u0026{197582 0xc000ace360 false}",
"type": "object"
},
"object.AccountItem": { "object.AccountItem": {
"title": "AccountItem", "title": "AccountItem",
"type": "object", "type": "object",
@ -5722,7 +5728,7 @@
"title": "CasbinRequest", "title": "CasbinRequest",
"type": "array", "type": "array",
"items": { "items": {
"$ref": "#/definitions/object.\u0026{197582 0xc000ace360 false}" "$ref": "#/definitions/object.CasbinRequest"
} }
}, },
"object.Cert": { "object.Cert": {
@ -7765,15 +7771,21 @@
"type": "object", "type": "object",
"properties": { "properties": {
"contentType": { "contentType": {
"type": "string" "default": "application/json",
"type": "string",
"example": "application/json"
}, },
"createdTime": { "createdTime": {
"type": "string" "default": "2023-07-27T17:09:12+08:00",
"type": "string",
"example": "2023-07-27T17:09:12+08:00"
}, },
"events": { "events": {
"type": "array", "type": "array",
"items": { "items": {
"type": "string" "type": "string",
"default": "test",
"example": "test"
} }
}, },
"headers": { "headers": {
@ -7783,25 +7795,39 @@
} }
}, },
"isEnabled": { "isEnabled": {
"type": "boolean" "default": true,
"type": "boolean",
"example": true
}, },
"isUserExtended": { "isUserExtended": {
"type": "boolean" "default": true,
"type": "boolean",
"example": true
}, },
"method": { "method": {
"type": "string" "default": "POST",
"type": "string",
"example": "POST"
}, },
"name": { "name": {
"type": "string" "default": "test",
"type": "string",
"example": "test"
}, },
"organization": { "organization": {
"type": "string" "default": "built-in",
"type": "string",
"example": "built-in"
}, },
"owner": { "owner": {
"type": "string" "default": "built-in",
"type": "string",
"example": "built-in"
}, },
"url": { "url": {
"type": "string" "default": "https://example.com/callback",
"type": "string",
"example": "https://example.com/callback"
} }
} }
}, },
@ -7866,5 +7892,16 @@
"title": "Engine", "title": "Engine",
"type": "object" "type": "object"
} }
},
"securityDefinitions": {
"test_apiKey": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
},
"externalDocs": {
"description": "Find out more about casdoor",
"url": "https://casdoor.org/"
} }
} }

View File

@ -6,6 +6,9 @@ info:
contact: contact:
email: admin@casbin.org email: admin@casbin.org
basePath: / basePath: /
schemes:
- http
- https
paths: paths:
/.well-known/jwks: /.well-known/jwks:
get: get:
@ -2401,6 +2404,7 @@ paths:
description: The id ( owner/name ) of the webhook description: The id ( owner/name ) of the webhook
required: true required: true
type: string type: string
default: built-in/admin
responses: responses:
"200": "200":
description: The Response object description: The Response object
@ -2418,6 +2422,7 @@ paths:
description: The owner of webhooks description: The owner of webhooks
required: true required: true
type: string type: string
default: built-in/admin
responses: responses:
"200": "200":
description: The Response object description: The Response object
@ -2425,6 +2430,8 @@ paths:
type: array type: array
items: items:
$ref: '#/definitions/object.Webhook' $ref: '#/definitions/object.Webhook'
security:
- test_apiKey: []
/api/health: /api/health:
get: get:
tags: tags:
@ -3381,6 +3388,7 @@ paths:
description: The id ( owner/name ) of the webhook description: The id ( owner/name ) of the webhook
required: true required: true
type: string type: string
default: built-in/admin
- in: body - in: body
name: body name: body
description: The details of the webhook description: The details of the webhook
@ -3541,12 +3549,6 @@ paths:
schema: schema:
$ref: '#/definitions/controllers.Response' $ref: '#/definitions/controllers.Response'
definitions: definitions:
1225.0xc000333110.false:
title: "false"
type: object
1260.0xc000333140.false:
title: "false"
type: object
LaravelResponse: LaravelResponse:
title: LaravelResponse title: LaravelResponse
type: object type: object
@ -3586,9 +3588,13 @@ definitions:
type: object type: object
properties: properties:
data: data:
$ref: '#/definitions/1225.0xc000333110.false' additionalProperties:
description: support string | class | List<class> and os on
type: string
data2: data2:
$ref: '#/definitions/1260.0xc000333140.false' additionalProperties:
description: support string | class | List<class> and os on
type: string
msg: msg:
type: string type: string
name: name:
@ -3615,9 +3621,6 @@ definitions:
object: object:
title: object title: object
type: object type: object
object.&{197582 0xc000ace360 false}:
title: '&{197582 0xc000ace360 false}'
type: object
object.AccountItem: object.AccountItem:
title: AccountItem title: AccountItem
type: object type: object
@ -3749,7 +3752,7 @@ definitions:
title: CasbinRequest title: CasbinRequest
type: array type: array
items: items:
$ref: '#/definitions/object.&{197582 0xc000ace360 false}' $ref: '#/definitions/object.CasbinRequest'
object.Cert: object.Cert:
title: Cert title: Cert
type: object type: object
@ -5123,31 +5126,51 @@ definitions:
type: object type: object
properties: properties:
contentType: contentType:
default: application/json
type: string type: string
example: application/json
createdTime: createdTime:
default: "2023-07-27T17:09:12+08:00"
type: string type: string
example: "2023-07-27T17:09:12+08:00"
events: events:
default: '[ddd]'
type: array type: array
items: items:
type: string type: string
headers: headers:
default: '[]'
type: array type: array
items: items:
$ref: '#/definitions/object.Header' $ref: '#/definitions/object.Header'
isEnabled: isEnabled:
default: true
type: boolean type: boolean
example: true
isUserExtended: isUserExtended:
default: true
type: boolean type: boolean
example: true
method: method:
default: POST
type: string type: string
example: POST
name: name:
default: test
type: string type: string
example: test
organization: organization:
default: built-in
type: string type: string
example: built-in
owner: owner:
default: built-in
type: string type: string
example: built-in
url: url:
default: https://example.com/callback
type: string type: string
example: https://example.com/callback
protocol.CredentialAssertion: protocol.CredentialAssertion:
title: CredentialAssertion title: CredentialAssertion
type: object type: object
@ -5192,3 +5215,11 @@ definitions:
xorm.Engine: xorm.Engine:
title: Engine title: Engine
type: object type: object
securityDefinitions:
test_apiKey:
type: apiKey
name: Authorization
in: header
externalDocs:
description: Find out more about casdoor
url: https://casdoor.org/