feat : role api 文档

This commit is contained in:
wangzhengkun
2022-06-06 14:29:26 +08:00
parent 07ca05a495
commit 55db904cbe
7 changed files with 689 additions and 1 deletions

View File

@@ -25,6 +25,181 @@ const docTemplate = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/roles": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "List all roles",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"roles"
],
"summary": "List all roles",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/role.Role"
}
}
}
}
},
"post": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Create role",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"roles"
],
"summary": "Create role",
"parameters": [
{
"description": "request",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/role.Role"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/role.Role"
}
}
}
}
},
"/roles/{name}": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Get role by name",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"roles"
],
"summary": "Get role by name",
"parameters": [
{
"type": "string",
"description": "权限名称",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/role.Role"
}
}
}
},
"put": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Update role by name",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"roles"
],
"summary": "Update role by name",
"parameters": [
{
"type": "string",
"description": "角色名称",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/role.Role"
}
}
}
},
"delete": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "Delete role by name",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"roles"
],
"summary": "Delete role by name",
"parameters": [
{
"type": "string",
"description": "角色名称",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/role.Role"
}
}
}
}
},
"/users": {
"get": {
"security": [
@@ -275,6 +450,73 @@ const docTemplate = `{
},
"nickName": {
"type": "string"
},
"roles": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"role.PolicyRule": {
"type": "object",
"properties": {
"resource": {
"type": "array",
"items": {
"type": "string"
}
},
"resourceNames": {
"type": "array",
"items": {
"type": "string"
}
},
"verbs": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"role.Role": {
"type": "object",
"properties": {
"apiVersion": {
"type": "string"
},
"builtIn": {
"type": "boolean"
},
"createAt": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"description": {
"type": "string"
},
"kind": {
"type": "string"
},
"name": {
"type": "string"
},
"rules": {
"type": "array",
"items": {
"$ref": "#/definitions/role.PolicyRule"
}
},
"updateAt": {
"type": "string"
},
"uuid": {
"type": "string"
}
}
},