diff --git a/__test__/3.0/LDFCore.ts b/__test__/3.0/LDFCore.ts index 8657c63..907a639 100644 --- a/__test__/3.0/LDFCore.ts +++ b/__test__/3.0/LDFCore.ts @@ -2944,12 +2944,26 @@ export interface SwaggerApi { * @summary 文件上传 * @tag File */ - post(url: '/api/File/Upload', options?: SwaggerOptions<{}, {}, {}, FormData>): Promise + post(url: '/api/File/Upload', options?: SwaggerOptions<{}, {}, {}, RuntimeFormData<{ + module?: string | null +} +>>): Promise /** * @summary 图片上传 * @tag File */ - post(url: '/api/File/UploadPic', options?: SwaggerOptions<{}, {}, {}, FormData>): Promise + post(url: '/api/File/UploadPic', options?: SwaggerOptions<{}, {}, {}, RuntimeFormData<{ + module?: string | null + /** + * @format int32 + */ + width?: number | null + /** + * @format int32 + */ + height?: number | null +} +>>): Promise /** * @summary 获取文件(返回byte[]) * @tag File @@ -2965,7 +2979,10 @@ export interface SwaggerApi { * @summary 删除文件 * @tag File */ - post(url: '/api/File/Remove', options?: SwaggerOptions<{}, {}, {}, FormData>): Promise + post(url: '/api/File/Remove', options?: SwaggerOptions<{}, {}, {}, RuntimeFormData<{ + code?: string | null +} +>>): Promise /** * @summary 列表 * @tag LoginLog @@ -3302,10 +3319,6 @@ type IRequestInterceptorFn = (config: IRuntimeRequestOptions) => Promise = (config: IRuntimeRequestOptions, response: Response, data: T) => Promise; type IResponseInterceptorErrorFn = (config: IRuntimeRequestOptions, Error: RuntimeError) => Promise; -export interface IRuntimeForm { - [key: string]: any; -} - export class RequestInterceptor implements IRequestInterceptor { private _fns: IRequestInterceptorFn[] = []; public use(fn: IRequestInterceptorFn) { @@ -3369,7 +3382,7 @@ export class ResponseInterceptor implements IResponseInterceptor { } } -export class RuntimeForm { +export class RuntimeFormData> { constructor(private _form: T) {} public formData(): FormData { const form = new FormData(); @@ -3557,7 +3570,7 @@ export class Runtime implements IRuntime { ? undefined : ["GET", "HEAD"].indexOf(config.method.toUpperCase()) > -1 ? undefined - : config.body instanceof RuntimeForm + : config.body instanceof RuntimeFormData ? config.body.formData() : config.body instanceof FormData ? config.body diff --git a/__test__/3.0/Petstore.ts b/__test__/3.0/Petstore.ts index a879b4d..0131d5b 100644 --- a/__test__/3.0/Petstore.ts +++ b/__test__/3.0/Petstore.ts @@ -272,10 +272,6 @@ type IRequestInterceptorFn = (config: IRuntimeRequestOptions) => Promise = (config: IRuntimeRequestOptions, response: Response, data: T) => Promise; type IResponseInterceptorErrorFn = (config: IRuntimeRequestOptions, Error: RuntimeError) => Promise; -export interface IRuntimeForm { - [key: string]: any; -} - export class RequestInterceptor implements IRequestInterceptor { private _fns: IRequestInterceptorFn[] = []; public use(fn: IRequestInterceptorFn) { @@ -339,7 +335,7 @@ export class ResponseInterceptor implements IResponseInterceptor { } } -export class RuntimeForm { +export class RuntimeFormData> { constructor(private _form: T) {} public formData(): FormData { const form = new FormData(); @@ -527,7 +523,7 @@ export class Runtime implements IRuntime { ? undefined : ["GET", "HEAD"].indexOf(config.method.toUpperCase()) > -1 ? undefined - : config.body instanceof RuntimeForm + : config.body instanceof RuntimeFormData ? config.body.formData() : config.body instanceof FormData ? config.body diff --git a/__test__/3.0/api-auth.ts b/__test__/3.0/api-auth.ts index 66e0b3f..015b4f3 100644 --- a/__test__/3.0/api-auth.ts +++ b/__test__/3.0/api-auth.ts @@ -148,10 +148,6 @@ type IRequestInterceptorFn = (config: IRuntimeRequestOptions) => Promise = (config: IRuntimeRequestOptions, response: Response, data: T) => Promise; type IResponseInterceptorErrorFn = (config: IRuntimeRequestOptions, Error: RuntimeError) => Promise; -export interface IRuntimeForm { - [key: string]: any; -} - export class RequestInterceptor implements IRequestInterceptor { private _fns: IRequestInterceptorFn[] = []; public use(fn: IRequestInterceptorFn) { @@ -215,7 +211,7 @@ export class ResponseInterceptor implements IResponseInterceptor { } } -export class RuntimeForm { +export class RuntimeFormData> { constructor(private _form: T) {} public formData(): FormData { const form = new FormData(); @@ -403,7 +399,7 @@ export class Runtime implements IRuntime { ? undefined : ["GET", "HEAD"].indexOf(config.method.toUpperCase()) > -1 ? undefined - : config.body instanceof RuntimeForm + : config.body instanceof RuntimeFormData ? config.body.formData() : config.body instanceof FormData ? config.body diff --git a/__test__/3.0/api-upms.ts b/__test__/3.0/api-upms.ts index 77187db..83a0b47 100644 --- a/__test__/3.0/api-upms.ts +++ b/__test__/3.0/api-upms.ts @@ -363,10 +363,6 @@ type IRequestInterceptorFn = (config: IRuntimeRequestOptions) => Promise = (config: IRuntimeRequestOptions, response: Response, data: T) => Promise; type IResponseInterceptorErrorFn = (config: IRuntimeRequestOptions, Error: RuntimeError) => Promise; -export interface IRuntimeForm { - [key: string]: any; -} - export class RequestInterceptor implements IRequestInterceptor { private _fns: IRequestInterceptorFn[] = []; public use(fn: IRequestInterceptorFn) { @@ -430,7 +426,7 @@ export class ResponseInterceptor implements IResponseInterceptor { } } -export class RuntimeForm { +export class RuntimeFormData> { constructor(private _form: T) {} public formData(): FormData { const form = new FormData(); @@ -618,7 +614,7 @@ export class Runtime implements IRuntime { ? undefined : ["GET", "HEAD"].indexOf(config.method.toUpperCase()) > -1 ? undefined - : config.body instanceof RuntimeForm + : config.body instanceof RuntimeFormData ? config.body.formData() : config.body instanceof FormData ? config.body diff --git a/__test__/3.0/api-with-examples.ts b/__test__/3.0/api-with-examples.ts index 0175bdb..429e061 100644 --- a/__test__/3.0/api-with-examples.ts +++ b/__test__/3.0/api-with-examples.ts @@ -69,10 +69,6 @@ type IRequestInterceptorFn = (config: IRuntimeRequestOptions) => Promise = (config: IRuntimeRequestOptions, response: Response, data: T) => Promise; type IResponseInterceptorErrorFn = (config: IRuntimeRequestOptions, Error: RuntimeError) => Promise; -export interface IRuntimeForm { - [key: string]: any; -} - export class RequestInterceptor implements IRequestInterceptor { private _fns: IRequestInterceptorFn[] = []; public use(fn: IRequestInterceptorFn) { @@ -136,7 +132,7 @@ export class ResponseInterceptor implements IResponseInterceptor { } } -export class RuntimeForm { +export class RuntimeFormData> { constructor(private _form: T) {} public formData(): FormData { const form = new FormData(); @@ -324,7 +320,7 @@ export class Runtime implements IRuntime { ? undefined : ["GET", "HEAD"].indexOf(config.method.toUpperCase()) > -1 ? undefined - : config.body instanceof RuntimeForm + : config.body instanceof RuntimeFormData ? config.body.formData() : config.body instanceof FormData ? config.body diff --git a/__test__/3.0/callback-example.ts b/__test__/3.0/callback-example.ts index d038867..f59ec76 100644 --- a/__test__/3.0/callback-example.ts +++ b/__test__/3.0/callback-example.ts @@ -65,10 +65,6 @@ type IRequestInterceptorFn = (config: IRuntimeRequestOptions) => Promise = (config: IRuntimeRequestOptions, response: Response, data: T) => Promise; type IResponseInterceptorErrorFn = (config: IRuntimeRequestOptions, Error: RuntimeError) => Promise; -export interface IRuntimeForm { - [key: string]: any; -} - export class RequestInterceptor implements IRequestInterceptor { private _fns: IRequestInterceptorFn[] = []; public use(fn: IRequestInterceptorFn) { @@ -132,7 +128,7 @@ export class ResponseInterceptor implements IResponseInterceptor { } } -export class RuntimeForm { +export class RuntimeFormData> { constructor(private _form: T) {} public formData(): FormData { const form = new FormData(); @@ -320,7 +316,7 @@ export class Runtime implements IRuntime { ? undefined : ["GET", "HEAD"].indexOf(config.method.toUpperCase()) > -1 ? undefined - : config.body instanceof RuntimeForm + : config.body instanceof RuntimeFormData ? config.body.formData() : config.body instanceof FormData ? config.body diff --git a/__test__/3.0/link-example.ts b/__test__/3.0/link-example.ts index e43eecd..0ade8f8 100644 --- a/__test__/3.0/link-example.ts +++ b/__test__/3.0/link-example.ts @@ -86,10 +86,6 @@ type IRequestInterceptorFn = (config: IRuntimeRequestOptions) => Promise = (config: IRuntimeRequestOptions, response: Response, data: T) => Promise; type IResponseInterceptorErrorFn = (config: IRuntimeRequestOptions, Error: RuntimeError) => Promise; -export interface IRuntimeForm { - [key: string]: any; -} - export class RequestInterceptor implements IRequestInterceptor { private _fns: IRequestInterceptorFn[] = []; public use(fn: IRequestInterceptorFn) { @@ -153,7 +149,7 @@ export class ResponseInterceptor implements IResponseInterceptor { } } -export class RuntimeForm { +export class RuntimeFormData> { constructor(private _form: T) {} public formData(): FormData { const form = new FormData(); @@ -341,7 +337,7 @@ export class Runtime implements IRuntime { ? undefined : ["GET", "HEAD"].indexOf(config.method.toUpperCase()) > -1 ? undefined - : config.body instanceof RuntimeForm + : config.body instanceof RuntimeFormData ? config.body.formData() : config.body instanceof FormData ? config.body diff --git a/__test__/3.0/petstore-expanded.ts b/__test__/3.0/petstore-expanded.ts index 6a652b8..b2736d3 100644 --- a/__test__/3.0/petstore-expanded.ts +++ b/__test__/3.0/petstore-expanded.ts @@ -96,10 +96,6 @@ type IRequestInterceptorFn = (config: IRuntimeRequestOptions) => Promise = (config: IRuntimeRequestOptions, response: Response, data: T) => Promise; type IResponseInterceptorErrorFn = (config: IRuntimeRequestOptions, Error: RuntimeError) => Promise; -export interface IRuntimeForm { - [key: string]: any; -} - export class RequestInterceptor implements IRequestInterceptor { private _fns: IRequestInterceptorFn[] = []; public use(fn: IRequestInterceptorFn) { @@ -163,7 +159,7 @@ export class ResponseInterceptor implements IResponseInterceptor { } } -export class RuntimeForm { +export class RuntimeFormData> { constructor(private _form: T) {} public formData(): FormData { const form = new FormData(); @@ -351,7 +347,7 @@ export class Runtime implements IRuntime { ? undefined : ["GET", "HEAD"].indexOf(config.method.toUpperCase()) > -1 ? undefined - : config.body instanceof RuntimeForm + : config.body instanceof RuntimeFormData ? config.body.formData() : config.body instanceof FormData ? config.body diff --git a/__test__/3.0/test.json b/__test__/3.0/test.json new file mode 100644 index 0000000..1315a16 --- /dev/null +++ b/__test__/3.0/test.json @@ -0,0 +1,2970 @@ +{ + "openapi": "3.0.1", + "info": { + "title": "项目文档合并服务", + "description": "项目文档合并服务api文档", + "contact": { + "name": "西岸枫谷商务数据有限公司-定制项目组", + "url": "http://www.example.com/", + "email": "git@digimaple.com" + }, + "version": "v1.0.0" + }, + "servers": [ + { + "url": "http://192.168.4.4:8888/api", + "description": "Generated server url" + } + ], + "paths": { + "/sitemap/{id}": { + "put": { + "tags": [ + "菜单管理" + ], + "summary": "更新", + "description": "编辑菜单", + "operationId": "update", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SitemapDTO" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + }, + "delete": { + "tags": [ + "菜单管理" + ], + "summary": "删除", + "description": "删除菜单, 级联删除子项", + "operationId": "delete", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/sitemap/button/{id}": { + "put": { + "tags": [ + "菜单管理" + ], + "summary": "修改按钮", + "operationId": "updateButton", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ButtonDTO" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/role/{id}": { + "put": { + "tags": [ + "角色管理" + ], + "summary": "修改", + "description": "角色编辑不能修改从属关系,仅提供名称修改", + "operationId": "update_1", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleDTO" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + }, + "delete": { + "tags": [ + "角色管理" + ], + "summary": "删除", + "description": "角色删除是一个危险的操作,不提供批量服务", + "operationId": "delete_1", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/dict/{id}": { + "get": { + "tags": [ + "数据字典" + ], + "summary": "查询选项", + "operationId": "query_8", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DictTreeVO" + } + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + }, + "put": { + "tags": [ + "数据字典" + ], + "summary": "修改", + "operationId": "update_2", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DictDTO" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + }, + "delete": { + "tags": [ + "数据字典" + ], + "summary": "删除", + "description": "同级别排序", + "operationId": "delete_3", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/template": { + "get": { + "tags": [ + "模板管理" + ], + "summary": "查询", + "operationId": "query_1", + "parameters": [ + { + "name": "query", + "in": "query", + "required": true, + "schema": { + "$ref": "#/components/schemas/PageQueryTemplateQuery" + } + } + ], + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PageResultTemplateVO" + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + }, + "post": { + "tags": [ + "模板管理" + ], + "summary": "新增", + "operationId": "add", + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "type": "object", + "properties": { + "file": { + "type": "file", + "format": "binary" + }, + "name": { + "type": "string", + "description": "名称" + }, + "tag": { + "type": "string", + "description": "标签" + }, + "type": { + "type": "string", + "description": "类型1-封面、2——目录、3-分册", + "enum": [ + "1", + "2", + "3" + ] + } + } + } + } + } + }, + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/sitemap": { + "get": { + "tags": [ + "菜单管理" + ], + "summary": "查询", + "description": "系统管理,菜单树结构", + "operationId": "query_2", + "parameters": [ + { + "name": "menu", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": [ + "MENU", + "BUTTON", + "VIEW" + ] + } + } + ], + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SitemapTreeVO" + } + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + }, + "post": { + "tags": [ + "菜单管理" + ], + "summary": "新增", + "description": "添加菜单", + "operationId": "add_1", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SitemapDTO" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/sitemap/{id}/show": { + "post": { + "tags": [ + "菜单管理" + ], + "summary": "显示", + "description": "菜单显示", + "operationId": "show", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/sitemap/{id}/hide": { + "post": { + "tags": [ + "菜单管理" + ], + "summary": "隐藏", + "description": "菜单隐藏", + "operationId": "hide", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/sitemap/move": { + "post": { + "tags": [ + "菜单管理" + ], + "summary": "排序", + "operationId": "move", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MoveDTO" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/sitemap/button": { + "post": { + "tags": [ + "菜单管理" + ], + "summary": "添加按钮", + "operationId": "button", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ButtonDTO" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/sign/docs": { + "get": { + "tags": [ + "文档签批" + ], + "summary": "查询", + "operationId": "list", + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DocsDO" + } + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + }, + "post": { + "tags": [ + "文档签批" + ], + "summary": "新增", + "operationId": "add_2", + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/seal": { + "get": { + "tags": [ + "印章管理" + ], + "summary": "查询", + "operationId": "query_3", + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SealVO" + } + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + }, + "post": { + "tags": [ + "印章管理" + ], + "summary": "录入信息", + "operationId": "save", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SealDTO" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/role": { + "get": { + "tags": [ + "角色管理" + ], + "summary": "查询", + "operationId": "query_4", + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RoleVO" + } + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + }, + "post": { + "tags": [ + "角色管理" + ], + "summary": "新增", + "operationId": "add_3", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RoleDTO" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/role/{id}/authority": { + "get": { + "tags": [ + "角色管理" + ], + "summary": "权限查询", + "operationId": "authority_1", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + }, + "post": { + "tags": [ + "角色管理" + ], + "summary": "权限设置", + "operationId": "authority", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/organization/sync": { + "post": { + "tags": [ + "组织机构" + ], + "summary": "同步数据", + "operationId": "sync", + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/files": { + "post": { + "tags": [ + "文件库" + ], + "summary": "上传", + "operationId": "upload", + "parameters": [ + { + "name": "file", + "in": "query", + "required": true, + "schema": { + "type": "string", + "format": "binary" + } + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "string", + "description": "文件类型(成果-ACHIEVEMENT,模版-TEMPLATE)" + } + } + } + }, + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/FileVO" + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/dict": { + "get": { + "tags": [ + "数据字典" + ], + "summary": "查询分类", + "description": "取得所以的分类", + "operationId": "query_7", + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DictVO" + } + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + }, + "post": { + "tags": [ + "数据字典" + ], + "summary": "新增", + "operationId": "add_4", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DictDTO" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/dict/move": { + "post": { + "tags": [ + "数据字典" + ], + "summary": "排序", + "operationId": "move_1", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MoveDTOString" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/": { + "post": { + "tags": [ + "sign-flow-controller" + ], + "summary": "发起扉页签署", + "operationId": "initSign_1", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SignFlowDTO" + } + } + }, + "required": true + }, + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/user": { + "get": { + "tags": [ + "sign-flow-controller" + ], + "summary": "查询当前用户待签署的数据", + "operationId": "query", + "parameters": [ + { + "name": "query", + "in": "query", + "required": true, + "schema": { + "$ref": "#/components/schemas/PageQuerySignFlowQuery" + } + } + ], + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PageResultSignFlowVO" + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/sso/callback/{type}/{key}": { + "get": { + "tags": [ + "登录集成" + ], + "summary": "登录回调", + "description": "登录回调地址,携带授权码 code", + "operationId": "callback", + "parameters": [ + { + "name": "type", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "oauth2", + "cas" + ] + } + }, + { + "name": "key", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/sso/authorize/{type}/{key}": { + "get": { + "tags": [ + "登录集成" + ], + "summary": "选择登录方式", + "description": "适配oauth2标准接入", + "operationId": "authorize", + "parameters": [ + { + "name": "type", + "in": "path", + "required": true, + "schema": { + "type": "string", + "enum": [ + "oauth2", + "cas" + ] + } + }, + { + "name": "key", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "type": "string" + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/organization": { + "get": { + "tags": [ + "组织机构" + ], + "summary": "查询", + "operationId": "load", + "parameters": [ + { + "name": "type", + "in": "query", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "org", + "dept", + "group", + "post", + "person" + ] + } + } + } + ], + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DeptTreeVO" + } + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/navbar": { + "get": { + "tags": [ + "公共接口" + ], + "summary": "导航条", + "description": "获取当前用户的菜单信息", + "operationId": "navbar", + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/MenuTreeVO" + } + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/log/api": { + "get": { + "tags": [ + "日志管理" + ], + "summary": "查询", + "operationId": "api", + "parameters": [ + { + "name": "query", + "in": "query", + "required": true, + "schema": { + "$ref": "#/components/schemas/PageQueryKeywordQuery" + } + } + ], + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PageResultLogApiDO" + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/files/{id}": { + "get": { + "tags": [ + "文件库" + ], + "summary": "获取文件", + "operationId": "load_1", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "文件id", + "required": true, + "schema": { + "type": "string", + "description": "文件id" + } + } + ], + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/FileSigningUrl" + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + }, + "delete": { + "tags": [ + "文件库" + ], + "summary": "删除", + "operationId": "delete_2", + "parameters": [ + { + "name": "id", + "in": "path", + "description": "文件id", + "required": true, + "schema": { + "type": "string", + "description": "文件id" + } + } + ], + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/directory/{id}/files": { + "get": { + "tags": [ + "项目信息" + ], + "summary": "文件查询", + "operationId": "files", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DirectoryFileVO" + } + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/directory/{id}": { + "get": { + "tags": [ + "项目信息" + ], + "summary": "目录查询", + "operationId": "query_5", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DirectoryVO" + } + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/directory": { + "get": { + "tags": [ + "项目信息" + ], + "summary": "目录查询", + "operationId": "query_6", + "parameters": [], + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DirectoryVO" + } + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/achievement/{id}": { + "get": { + "tags": [ + "成果库" + ], + "summary": "目录树", + "operationId": "directoryTree", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DirectoryTreeVO" + } + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/achievement/{id}/files": { + "get": { + "tags": [ + "成果库" + ], + "summary": "文件列表", + "operationId": "files_1", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "query", + "in": "query", + "required": true, + "schema": { + "$ref": "#/components/schemas/PageQueryFileQuery" + } + } + ], + "responses": { + "200": { + "description": "请求成功!", + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PageResultFileListVO" + } + } + } + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + }, + "/template/{id}": { + "delete": { + "tags": [ + "模板管理" + ], + "summary": "删除", + "operationId": "add_5", + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "请求成功!" + }, + "400": { + "description": "请求失败!请求信息错误" + }, + "401": { + "description": "请求失败!未经过身份认证" + }, + "403": { + "description": "请求失败!拒绝执行此请求" + }, + "404": { + "description": "请求失败!请求信息不存在" + }, + "429": { + "description": "请求失败!请求太频繁" + } + } + } + } + }, + "components": { + "schemas": { + "SitemapDTO": { + "required": [ + "category", + "name" + ], + "type": "object", + "properties": { + "category": { + "type": "string", + "description": "类型", + "example": "ENUM,VIEW", + "enum": [ + "MENU", + "BUTTON", + "VIEW" + ] + }, + "name": { + "maxLength": 50, + "minLength": 1, + "type": "string", + "description": "名称" + }, + "pid": { + "maxLength": 60, + "minLength": 0, + "type": "string", + "description": "上级节点ID" + }, + "icon": { + "maxLength": 255, + "minLength": 0, + "type": "string", + "description": "图标" + }, + "module": { + "maxLength": 255, + "minLength": 0, + "type": "string", + "description": "组件" + }, + "route": { + "maxLength": 255, + "minLength": 0, + "type": "string", + "description": "路由地址" + }, + "params": { + "maxLength": 255, + "minLength": 0, + "type": "string", + "description": "路由参数" + }, + "target": { + "maxLength": 50, + "minLength": 0, + "type": "string", + "description": "打开方式" + }, + "description": { + "maxLength": 255, + "minLength": 0, + "type": "string", + "description": "描述" + } + } + }, + "ButtonDTO": { + "required": [ + "name", + "permission", + "pid", + "show" + ], + "type": "object", + "properties": { + "pid": { + "type": "string", + "description": "上级节点ID" + }, + "name": { + "maxLength": 50, + "minLength": 1, + "type": "string", + "description": "名称" + }, + "permission": { + "maxLength": 255, + "minLength": 1, + "type": "string", + "description": "权限" + }, + "show": { + "type": "boolean", + "description": "显示" + } + } + }, + "RoleDTO": { + "required": [ + "name" + ], + "type": "object", + "properties": { + "name": { + "maxLength": 100, + "minLength": 0, + "type": "string", + "description": "角色" + }, + "description": { + "maxLength": 255, + "minLength": 0, + "type": "string", + "description": "描述" + } + } + }, + "DictDTO": { + "required": [ + "code", + "name" + ], + "type": "object", + "properties": { + "pid": { + "type": "string", + "description": "上级ID" + }, + "code": { + "maxLength": 50, + "minLength": 0, + "type": "string", + "description": "编号" + }, + "name": { + "maxLength": 100, + "minLength": 0, + "type": "string", + "description": "名称" + } + } + }, + "MoveDTO": { + "required": [ + "before", + "movingId", + "targetId" + ], + "type": "object", + "properties": { + "movingId": { + "type": "object", + "description": "移动的 id" + }, + "targetId": { + "type": "object", + "description": "目标 id" + }, + "before": { + "type": "boolean", + "description": "目标节点的上方-true / 下方-false", + "example": false + } + } + }, + "SealDTO": { + "type": "object", + "properties": { + "account": { + "type": "string", + "description": "账号" + }, + "pwd": { + "type": "string", + "description": "密码" + } + } + }, + "FileVO": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "id" + }, + "name": { + "type": "string", + "description": "名称" + } + } + }, + "MoveDTOString": { + "required": [ + "before", + "movingId", + "targetId" + ], + "type": "object", + "properties": { + "movingId": { + "type": "string", + "description": "移动的 id" + }, + "targetId": { + "type": "string", + "description": "目标 id" + }, + "before": { + "type": "boolean", + "description": "目标节点的上方-true / 下方-false", + "example": false + } + } + }, + "Member": { + "type": "object", + "properties": { + "userId": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "description": "待签署的人员列表,二维数组" + }, + "SignFlowDTO": { + "type": "object", + "properties": { + "groupRegisterId": { + "type": "string", + "description": "注册文件ID" + }, + "member": { + "type": "array", + "description": "待签署的人员列表,二维数组", + "items": { + "type": "array", + "description": "待签署的人员列表,二维数组", + "items": { + "$ref": "#/components/schemas/Member" + } + } + } + } + }, + "PageQuerySignFlowQuery": { + "required": [ + "page", + "size" + ], + "type": "object", + "properties": { + "page": { + "type": "integer", + "description": "页码", + "format": "int32", + "example": 1 + }, + "size": { + "type": "integer", + "description": "每页显示数量(最多200条)", + "format": "int32", + "example": 20 + }, + "query": { + "$ref": "#/components/schemas/SignFlowQuery" + } + } + }, + "SignFlowQuery": { + "type": "object", + "description": "查询条件信息" + }, + "PageResultSignFlowVO": { + "type": "object", + "properties": { + "total": { + "type": "integer", + "format": "int64" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SignFlowVO" + } + } + } + }, + "SignFlowVO": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "当前流程节点的ID" + }, + "pid": { + "type": "string", + "description": "整个流程的ID" + }, + "groupRegisterName": { + "type": "string", + "description": "册名" + }, + "groupRegisterSize": { + "type": "string", + "description": "册数" + }, + "projectName": { + "type": "string", + "description": "项目名" + }, + "promoterName": { + "type": "string", + "description": "发起人" + }, + "gmtStart": { + "type": "string", + "description": "发起时间", + "format": "date-time" + }, + "gmtReach": { + "type": "string", + "description": "到达时间", + "format": "date-time" + }, + "status": { + "type": "integer", + "description": "状态", + "format": "int32" + } + } + }, + "PageQueryTemplateQuery": { + "required": [ + "page", + "size" + ], + "type": "object", + "properties": { + "page": { + "type": "integer", + "description": "页码", + "format": "int32", + "example": 1 + }, + "size": { + "type": "integer", + "description": "每页显示数量(最多200条)", + "format": "int32", + "example": 20 + }, + "query": { + "$ref": "#/components/schemas/TemplateQuery" + } + } + }, + "TemplateQuery": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "名称" + }, + "tag": { + "type": "string", + "description": "标签" + }, + "type": { + "type": "integer", + "description": "类型: 1 —— 封面、 2 —— 目录、 3 —— 分册", + "format": "int32" + } + }, + "description": "查询条件信息" + }, + "PageResultTemplateVO": { + "type": "object", + "properties": { + "total": { + "type": "integer", + "format": "int64" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TemplateVO" + } + } + } + }, + "TemplateVO": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string", + "description": "名称" + }, + "tag": { + "type": "string", + "description": "标签" + }, + "type": { + "type": "integer", + "description": "类型: 1 —— 封面、 2 —— 目录、 3 —— 分册", + "format": "int32" + }, + "gmtCreate": { + "type": "string", + "description": "录入时间", + "format": "date-time" + }, + "gmtModified": { + "type": "string", + "description": "更新时间", + "format": "date-time" + } + } + }, + "SitemapTreeVO": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "id" + }, + "category": { + "type": "string", + "description": "分类", + "enum": [ + "MENU", + "BUTTON", + "VIEW" + ] + }, + "name": { + "type": "string", + "description": "名称" + }, + "permission": { + "type": "string", + "description": "权限" + }, + "pid": { + "type": "string", + "description": "上级节点ID" + }, + "icon": { + "type": "string", + "description": "图标" + }, + "module": { + "type": "string", + "description": "组件" + }, + "route": { + "type": "string", + "description": "路由地址" + }, + "params": { + "type": "string", + "description": "路由参数" + }, + "target": { + "type": "string", + "description": "打开方式" + }, + "description": { + "type": "string", + "description": "描述" + }, + "show": { + "type": "boolean", + "description": "显示" + }, + "locked": { + "type": "boolean", + "description": "锁" + }, + "gmtModified": { + "type": "string", + "description": "更新时间", + "format": "date-time" + }, + "children": { + "type": "array", + "description": "子菜单", + "items": { + "$ref": "#/components/schemas/SitemapTreeVO" + } + } + } + }, + "DocsDO": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "bizId": { + "type": "string" + }, + "name": { + "type": "string" + }, + "original": { + "type": "string" + }, + "target": { + "type": "string" + }, + "status": { + "type": "string", + "enum": [ + "WAITING", + "SIGNING", + "SUCCESS", + "FAIL" + ] + }, + "gmtCreate": { + "type": "string", + "format": "date-time" + }, + "gmtModified": { + "type": "string", + "format": "date-time" + } + } + }, + "SealVO": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "类型" + }, + "name": { + "type": "string", + "description": "名称" + }, + "code": { + "type": "string", + "description": "编号" + }, + "img": { + "type": "string", + "description": "图" + }, + "expires": { + "type": "string", + "description": "过期时间" + } + } + }, + "RoleVO": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "id" + }, + "name": { + "type": "string", + "description": "名称" + }, + "locked": { + "type": "boolean", + "description": "锁" + }, + "description": { + "type": "string", + "description": "描述" + }, + "gmtModified": { + "type": "string", + "description": "更新时间", + "format": "date-time" + } + } + }, + "DeptTreeVO": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "id" + }, + "type": { + "type": "string", + "description": "类型", + "enum": [ + "org", + "dept", + "group", + "post", + "person" + ] + }, + "name": { + "type": "string", + "description": "名称" + }, + "children": { + "type": "array", + "description": "下级部门", + "items": { + "$ref": "#/components/schemas/DeptTreeVO" + } + } + } + }, + "MenuTreeVO": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "id" + }, + "permission": { + "type": "string", + "description": "权限" + }, + "category": { + "type": "string", + "description": "类型", + "enum": [ + "MENU", + "BUTTON", + "VIEW" + ] + }, + "name": { + "type": "string", + "description": "名称" + }, + "icon": { + "type": "string", + "description": "图标" + }, + "module": { + "type": "string", + "description": "组件" + }, + "route": { + "type": "string", + "description": "路由地址" + }, + "params": { + "type": "string", + "description": "路由参数" + }, + "target": { + "type": "string", + "description": "打开方式" + }, + "children": { + "type": "array", + "description": "子菜单", + "items": { + "$ref": "#/components/schemas/MenuTreeVO" + } + } + } + }, + "KeywordQuery": { + "type": "object", + "properties": { + "keyword": { + "type": "string", + "description": "关键词" + } + }, + "description": "查询条件信息" + }, + "PageQueryKeywordQuery": { + "required": [ + "page", + "size" + ], + "type": "object", + "properties": { + "page": { + "type": "integer", + "description": "页码", + "format": "int32", + "example": 1 + }, + "size": { + "type": "integer", + "description": "每页显示数量(最多200条)", + "format": "int32", + "example": 20 + }, + "query": { + "$ref": "#/components/schemas/KeywordQuery" + } + } + }, + "LogApiDO": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "ip": { + "type": "string" + }, + "name": { + "type": "string" + }, + "region": { + "type": "string" + }, + "params": { + "type": "string" + }, + "method": { + "type": "string" + }, + "uri": { + "type": "string" + }, + "gmtCreate": { + "type": "string", + "format": "date-time" + } + } + }, + "PageResultLogApiDO": { + "type": "object", + "properties": { + "total": { + "type": "integer", + "format": "int64" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LogApiDO" + } + } + } + }, + "FileSigningUrl": { + "type": "object", + "properties": { + "expires_in": { + "type": "integer", + "format": "int64" + }, + "url": { + "type": "string" + } + } + }, + "DirectoryFileVO": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "id" + }, + "parent": { + "type": "string", + "description": "目录" + }, + "name": { + "type": "string", + "description": "名称" + }, + "length": { + "type": "integer", + "description": "大小", + "format": "int64" + }, + "page": { + "type": "integer", + "description": "页数", + "format": "int32" + }, + "sync": { + "type": "integer", + "description": "同步状态 1(未开始),2(进行中),3(完成),4(错误)", + "format": "int32" + }, + "used": { + "type": "integer", + "description": "组册 1(未使用),2(已使用/已参与组册),3(文件有变动)", + "format": "int32" + }, + "gmtCreate": { + "type": "string", + "description": "创建时间", + "format": "date-time" + }, + "gmtModified": { + "type": "string", + "description": "更新时间", + "format": "date-time" + } + } + }, + "DirectoryVO": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "id" + }, + "name": { + "type": "string", + "description": "名称" + }, + "children": { + "type": "array", + "description": "下级", + "items": { + "$ref": "#/components/schemas/DirectoryVO" + } + } + } + }, + "DictVO": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "主键、唯一标识" + }, + "code": { + "type": "string", + "description": "代码/编号" + }, + "rules": { + "type": "string", + "description": "校验规则" + }, + "hint": { + "type": "string", + "description": "提示" + }, + "name": { + "type": "string", + "description": "名称" + } + } + }, + "DictTreeVO": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "id" + }, + "code": { + "type": "string", + "description": "编号" + }, + "name": { + "type": "string", + "description": "名称" + }, + "children": { + "type": "array", + "description": "下级", + "items": { + "$ref": "#/components/schemas/DictTreeVO" + } + } + } + }, + "DirectoryTreeVO": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "id" + }, + "name": { + "type": "string", + "description": "名称" + }, + "children": { + "type": "array", + "description": "下级", + "items": { + "$ref": "#/components/schemas/DirectoryTreeVO" + } + } + } + }, + "FileQuery": { + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "名称" + }, + "status": { + "type": "string", + "description": "同步状态 NOT_STARTED(未开始),COMPLETE(完成),IN_PROGRESS(进行中),ERROR(错误)", + "enum": [ + "NOT_STARTED", + "COMPLETE", + "IN_PROGRESS", + "ERROR" + ] + } + }, + "description": "查询条件信息" + }, + "PageQueryFileQuery": { + "required": [ + "page", + "size" + ], + "type": "object", + "properties": { + "page": { + "type": "integer", + "description": "页码", + "format": "int32", + "example": 1 + }, + "size": { + "type": "integer", + "description": "每页显示数量(最多200条)", + "format": "int32", + "example": 20 + }, + "query": { + "$ref": "#/components/schemas/FileQuery" + } + } + }, + "FileListVO": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "id" + }, + "directory": { + "type": "string", + "description": "目录" + }, + "length": { + "type": "integer", + "description": "大小", + "format": "int64" + }, + "page": { + "type": "integer", + "description": "页数", + "format": "int32" + }, + "status": { + "type": "string", + "description": "同步状态 NOT_STARTED(未开始),COMPLETE(完成),IN_PROGRESS(进行中),ERROR(错误)", + "enum": [ + "NOT_STARTED", + "COMPLETE", + "IN_PROGRESS", + "ERROR" + ] + }, + "gmtCreate": { + "type": "string", + "description": "创建时间", + "format": "date-time" + }, + "gmtModified": { + "type": "string", + "description": "更新时间", + "format": "date-time" + } + } + }, + "PageResultFileListVO": { + "type": "object", + "properties": { + "total": { + "type": "integer", + "format": "int64" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FileListVO" + } + } + } + } + }, + "securitySchemes": { + "X-Auth-Token": { + "type": "http" + } + } + } +} \ No newline at end of file diff --git a/__test__/3.0/test.ts b/__test__/3.0/test.ts new file mode 100644 index 0000000..4c952f3 --- /dev/null +++ b/__test__/3.0/test.ts @@ -0,0 +1,1364 @@ +// Generate by swagger2ts +export interface SitemapDTO { + /** + * @description 类型 + */ + category: 'MENU' | 'BUTTON' | 'VIEW' + /** + * @description 名称 + */ + name: string + /** + * @description 上级节点ID + */ + pid?: string + /** + * @description 图标 + */ + icon?: string + /** + * @description 组件 + */ + module?: string + /** + * @description 路由地址 + */ + route?: string + /** + * @description 路由参数 + */ + params?: string + /** + * @description 打开方式 + */ + target?: string + /** + * @description 描述 + */ + description?: string +} + +export interface ButtonDTO { + /** + * @description 上级节点ID + */ + pid: string + /** + * @description 名称 + */ + name: string + /** + * @description 权限 + */ + permission: string + /** + * @description 显示 + */ + show: boolean +} + +export interface RoleDTO { + /** + * @description 角色 + */ + name: string + /** + * @description 描述 + */ + description?: string +} + +export interface DictDTO { + /** + * @description 上级ID + */ + pid?: string + /** + * @description 编号 + */ + code: string + /** + * @description 名称 + */ + name: string +} + +export interface MoveDTO { + /** + * @description 移动的 id + */ + movingId: { + [key: string]: unknown + } + /** + * @description 目标 id + */ + targetId: { + [key: string]: unknown + } + /** + * @description 目标节点的上方-true / 下方-false + */ + before: boolean +} + +export interface SealDTO { + /** + * @description 账号 + */ + account?: string + /** + * @description 密码 + */ + pwd?: string +} + +export interface FileVO { + /** + * @description id + */ + id?: string + /** + * @description 名称 + */ + name?: string +} + +export interface MoveDTOString { + /** + * @description 移动的 id + */ + movingId: string + /** + * @description 目标 id + */ + targetId: string + /** + * @description 目标节点的上方-true / 下方-false + */ + before: boolean +} + +/** + * @description 待签署的人员列表,二维数组 + */ +export interface Member { + userId?: string + name?: string +} + +export interface SignFlowDTO { + /** + * @description 注册文件ID + */ + groupRegisterId?: string + /** + * @description 待签署的人员列表,二维数组 + */ + member?: Array> +} + +export interface PageQuerySignFlowQuery { + /** + * @description 页码 + * @format int32 + */ + page: number + /** + * @description 每页显示数量(最多200条) + * @format int32 + */ + size: number + query?: SignFlowQuery +} + +/** + * @description 查询条件信息 + */ +export interface SignFlowQuery { + [key: string]: unknown +} + +export interface PageResultSignFlowVO { + /** + * @format int64 + */ + total?: number + data?: Array +} + +export interface SignFlowVO { + /** + * @description 当前流程节点的ID + */ + id?: string + /** + * @description 整个流程的ID + */ + pid?: string + /** + * @description 册名 + */ + groupRegisterName?: string + /** + * @description 册数 + */ + groupRegisterSize?: string + /** + * @description 项目名 + */ + projectName?: string + /** + * @description 发起人 + */ + promoterName?: string + /** + * @description 发起时间 + * @format date-time + */ + gmtStart?: string + /** + * @description 到达时间 + * @format date-time + */ + gmtReach?: string + /** + * @description 状态 + * @format int32 + */ + status?: number +} + +export interface PageQueryTemplateQuery { + /** + * @description 页码 + * @format int32 + */ + page: number + /** + * @description 每页显示数量(最多200条) + * @format int32 + */ + size: number + query?: TemplateQuery +} + +/** + * @description 查询条件信息 + */ +export interface TemplateQuery { + /** + * @description 名称 + */ + name?: string + /** + * @description 标签 + */ + tag?: string + /** + * @description 类型: 1 —— 封面、 2 —— 目录、 3 —— 分册 + * @format int32 + */ + type?: number +} + +export interface PageResultTemplateVO { + /** + * @format int64 + */ + total?: number + data?: Array +} + +export interface TemplateVO { + id?: string + /** + * @description 名称 + */ + name?: string + /** + * @description 标签 + */ + tag?: string + /** + * @description 类型: 1 —— 封面、 2 —— 目录、 3 —— 分册 + * @format int32 + */ + type?: number + /** + * @description 录入时间 + * @format date-time + */ + gmtCreate?: string + /** + * @description 更新时间 + * @format date-time + */ + gmtModified?: string +} + +export interface SitemapTreeVO { + /** + * @description id + */ + id?: string + /** + * @description 分类 + */ + category?: 'MENU' | 'BUTTON' | 'VIEW' + /** + * @description 名称 + */ + name?: string + /** + * @description 权限 + */ + permission?: string + /** + * @description 上级节点ID + */ + pid?: string + /** + * @description 图标 + */ + icon?: string + /** + * @description 组件 + */ + module?: string + /** + * @description 路由地址 + */ + route?: string + /** + * @description 路由参数 + */ + params?: string + /** + * @description 打开方式 + */ + target?: string + /** + * @description 描述 + */ + description?: string + /** + * @description 显示 + */ + show?: boolean + /** + * @description 锁 + */ + locked?: boolean + /** + * @description 更新时间 + * @format date-time + */ + gmtModified?: string + /** + * @description 子菜单 + */ + children?: Array +} + +export interface DocsDO { + id?: string + bizId?: string + name?: string + original?: string + target?: string + status?: 'WAITING' | 'SIGNING' | 'SUCCESS' | 'FAIL' + /** + * @format date-time + */ + gmtCreate?: string + /** + * @format date-time + */ + gmtModified?: string +} + +export interface SealVO { + /** + * @description 类型 + */ + type?: string + /** + * @description 名称 + */ + name?: string + /** + * @description 编号 + */ + code?: string + /** + * @description 图 + */ + img?: string + /** + * @description 过期时间 + */ + expires?: string +} + +export interface RoleVO { + /** + * @description id + */ + id?: string + /** + * @description 名称 + */ + name?: string + /** + * @description 锁 + */ + locked?: boolean + /** + * @description 描述 + */ + description?: string + /** + * @description 更新时间 + * @format date-time + */ + gmtModified?: string +} + +export interface DeptTreeVO { + /** + * @description id + */ + id?: string + /** + * @description 类型 + */ + type?: 'org' | 'dept' | 'group' | 'post' | 'person' + /** + * @description 名称 + */ + name?: string + /** + * @description 下级部门 + */ + children?: Array +} + +export interface MenuTreeVO { + /** + * @description id + */ + id?: string + /** + * @description 权限 + */ + permission?: string + /** + * @description 类型 + */ + category?: 'MENU' | 'BUTTON' | 'VIEW' + /** + * @description 名称 + */ + name?: string + /** + * @description 图标 + */ + icon?: string + /** + * @description 组件 + */ + module?: string + /** + * @description 路由地址 + */ + route?: string + /** + * @description 路由参数 + */ + params?: string + /** + * @description 打开方式 + */ + target?: string + /** + * @description 子菜单 + */ + children?: Array +} + +/** + * @description 查询条件信息 + */ +export interface KeywordQuery { + /** + * @description 关键词 + */ + keyword?: string +} + +export interface PageQueryKeywordQuery { + /** + * @description 页码 + * @format int32 + */ + page: number + /** + * @description 每页显示数量(最多200条) + * @format int32 + */ + size: number + query?: KeywordQuery +} + +export interface LogApiDO { + id?: string + ip?: string + name?: string + region?: string + params?: string + method?: string + uri?: string + /** + * @format date-time + */ + gmtCreate?: string +} + +export interface PageResultLogApiDO { + /** + * @format int64 + */ + total?: number + data?: Array +} + +export interface FileSigningUrl { + /** + * @format int64 + */ + expires_in?: number + url?: string +} + +export interface DirectoryFileVO { + /** + * @description id + */ + id?: string + /** + * @description 目录 + */ + parent?: string + /** + * @description 名称 + */ + name?: string + /** + * @description 大小 + * @format int64 + */ + length?: number + /** + * @description 页数 + * @format int32 + */ + page?: number + /** + * @description 同步状态 1(未开始),2(进行中),3(完成),4(错误) + * @format int32 + */ + sync?: number + /** + * @description 组册 1(未使用),2(已使用/已参与组册),3(文件有变动) + * @format int32 + */ + used?: number + /** + * @description 创建时间 + * @format date-time + */ + gmtCreate?: string + /** + * @description 更新时间 + * @format date-time + */ + gmtModified?: string +} + +export interface DirectoryVO { + /** + * @description id + */ + id?: string + /** + * @description 名称 + */ + name?: string + /** + * @description 下级 + */ + children?: Array +} + +export interface DictVO { + /** + * @description 主键、唯一标识 + */ + id?: string + /** + * @description 代码/编号 + */ + code?: string + /** + * @description 校验规则 + */ + rules?: string + /** + * @description 提示 + */ + hint?: string + /** + * @description 名称 + */ + name?: string +} + +export interface DictTreeVO { + /** + * @description id + */ + id?: string + /** + * @description 编号 + */ + code?: string + /** + * @description 名称 + */ + name?: string + /** + * @description 下级 + */ + children?: Array +} + +export interface DirectoryTreeVO { + /** + * @description id + */ + id?: string + /** + * @description 名称 + */ + name?: string + /** + * @description 下级 + */ + children?: Array +} + +/** + * @description 查询条件信息 + */ +export interface FileQuery { + /** + * @description 名称 + */ + name?: string + /** + * @description 同步状态 NOT_STARTED(未开始),COMPLETE(完成),IN_PROGRESS(进行中),ERROR(错误) + */ + status?: 'NOT_STARTED' | 'COMPLETE' | 'IN_PROGRESS' | 'ERROR' +} + +export interface PageQueryFileQuery { + /** + * @description 页码 + * @format int32 + */ + page: number + /** + * @description 每页显示数量(最多200条) + * @format int32 + */ + size: number + query?: FileQuery +} + +export interface FileListVO { + /** + * @description id + */ + id?: string + /** + * @description 目录 + */ + directory?: string + /** + * @description 大小 + * @format int64 + */ + length?: number + /** + * @description 页数 + * @format int32 + */ + page?: number + /** + * @description 同步状态 NOT_STARTED(未开始),COMPLETE(完成),IN_PROGRESS(进行中),ERROR(错误) + */ + status?: 'NOT_STARTED' | 'COMPLETE' | 'IN_PROGRESS' | 'ERROR' + /** + * @description 创建时间 + * @format date-time + */ + gmtCreate?: string + /** + * @description 更新时间 + * @format date-time + */ + gmtModified?: string +} + +export interface PageResultFileListVO { + /** + * @format int64 + */ + total?: number + data?: Array +} + + + +/** ===== build-in interface start ===== */ +export type Stringify = string | number | null | undefined | void + +export type SwaggerPath = Record + +export type SwaggerQuery = Record> + +export type SwaggerHeaders = Record + +export type SwaggerCommonOptions = Omit & { timeout?: number } + +export type RequireKeys, K extends keyof T> = Required> & Omit + +export interface SwaggerOptions

extends SwaggerCommonOptions { + path?: P + query?: Q + headers?: H + body?: B +} + +/** ===== build-in interface end ===== */ + +export interface SwaggerApi { + /** + * @description 删除菜单, 级联删除子项 + * @summary 删除 + * @tag 菜单管理 + */ + delete(url: '/sitemap/{id}', options: RequireKeys, 'path'>): Promise + /** + * @description 编辑菜单 + * @summary 更新 + * @tag 菜单管理 + */ + put(url: '/sitemap/{id}', options: RequireKeys, 'path'>): Promise + /** + * @summary 修改按钮 + * @tag 菜单管理 + */ + put(url: '/sitemap/button/{id}', options: RequireKeys, 'path'>): Promise + /** + * @description 角色删除是一个危险的操作,不提供批量服务 + * @summary 删除 + * @tag 角色管理 + */ + delete(url: '/role/{id}', options: RequireKeys, 'path'>): Promise + /** + * @description 角色编辑不能修改从属关系,仅提供名称修改 + * @summary 修改 + * @tag 角色管理 + */ + put(url: '/role/{id}', options: RequireKeys, 'path'>): Promise + /** + * @summary 查询选项 + * @tag 数据字典 + */ + get(url: '/dict/{id}', options: RequireKeys, 'path'>): Promise> + /** + * @description 同级别排序 + * @summary 删除 + * @tag 数据字典 + */ + delete(url: '/dict/{id}', options: RequireKeys, 'path'>): Promise + /** + * @summary 修改 + * @tag 数据字典 + */ + put(url: '/dict/{id}', options: RequireKeys, 'path'>): Promise + /** + * @summary 查询 + * @tag 模板管理 + */ + get(url: '/template', options: RequireKeys, 'query'>): Promise + /** + * @summary 新增 + * @tag 模板管理 + */ + post(url: '/template', options?: SwaggerOptions<{}, {}, {}, RuntimeFormData<{ + /** + * @format binary + */ + file?: Blob | Uint8Array + /** + * @description 名称 + */ + name?: string + /** + * @description 标签 + */ + tag?: string + /** + * @description 类型1-封面、2——目录、3-分册 + */ + type?: '1' | '2' | '3' +} +>>): Promise + /** + * @description 系统管理,菜单树结构 + * @summary 查询 + * @tag 菜单管理 + */ + get(url: '/sitemap', options?: SwaggerOptions<{}, {menu?: 'MENU' | 'BUTTON' | 'VIEW'}, {}, unknown>): Promise> + /** + * @description 添加菜单 + * @summary 新增 + * @tag 菜单管理 + */ + post(url: '/sitemap', options?: SwaggerOptions<{}, {}, {}, SitemapDTO>): Promise + /** + * @description 菜单显示 + * @summary 显示 + * @tag 菜单管理 + */ + post(url: '/sitemap/{id}/show', options: RequireKeys, 'path'>): Promise + /** + * @description 菜单隐藏 + * @summary 隐藏 + * @tag 菜单管理 + */ + post(url: '/sitemap/{id}/hide', options: RequireKeys, 'path'>): Promise + /** + * @summary 排序 + * @tag 菜单管理 + */ + post(url: '/sitemap/move', options?: SwaggerOptions<{}, {}, {}, MoveDTO>): Promise + /** + * @summary 添加按钮 + * @tag 菜单管理 + */ + post(url: '/sitemap/button', options?: SwaggerOptions<{}, {}, {}, ButtonDTO>): Promise + /** + * @summary 查询 + * @tag 文档签批 + */ + get(url: '/sign/docs', options?: SwaggerOptions<{}, {}, {}, unknown>): Promise> + /** + * @summary 新增 + * @tag 文档签批 + */ + post(url: '/sign/docs', options?: SwaggerOptions<{}, {}, {}, unknown>): Promise + /** + * @summary 查询 + * @tag 印章管理 + */ + get(url: '/seal', options?: SwaggerOptions<{}, {}, {}, unknown>): Promise> + /** + * @summary 录入信息 + * @tag 印章管理 + */ + post(url: '/seal', options?: SwaggerOptions<{}, {}, {}, SealDTO>): Promise + /** + * @summary 查询 + * @tag 角色管理 + */ + get(url: '/role', options?: SwaggerOptions<{}, {}, {}, unknown>): Promise> + /** + * @summary 新增 + * @tag 角色管理 + */ + post(url: '/role', options?: SwaggerOptions<{}, {}, {}, RoleDTO>): Promise + /** + * @summary 权限查询 + * @tag 角色管理 + */ + get(url: '/role/{id}/authority', options: RequireKeys, 'path'>): Promise> + /** + * @summary 权限设置 + * @tag 角色管理 + */ + post(url: '/role/{id}/authority', options: RequireKeys>, 'path'>): Promise + /** + * @summary 同步数据 + * @tag 组织机构 + */ + post(url: '/organization/sync', options?: SwaggerOptions<{}, {}, {}, unknown>): Promise + /** + * @summary 上传 + * @tag 文件库 + */ + post(url: '/files', options: RequireKeys, 'query'>): Promise + /** + * @description 取得所以的分类 + * @summary 查询分类 + * @tag 数据字典 + */ + get(url: '/dict', options?: SwaggerOptions<{}, {}, {}, unknown>): Promise> + /** + * @summary 新增 + * @tag 数据字典 + */ + post(url: '/dict', options?: SwaggerOptions<{}, {}, {}, DictDTO>): Promise + /** + * @summary 排序 + * @tag 数据字典 + */ + post(url: '/dict/move', options?: SwaggerOptions<{}, {}, {}, MoveDTOString>): Promise + /** + * @summary 发起扉页签署 + * @tag sign-flow-controller + */ + post(url: '/', options?: SwaggerOptions<{}, {}, {}, SignFlowDTO>): Promise + /** + * @summary 查询当前用户待签署的数据 + * @tag sign-flow-controller + */ + get(url: '/user', options: RequireKeys, 'query'>): Promise + /** + * @description 登录回调地址,携带授权码 code + * @summary 登录回调 + * @tag 登录集成 + */ + get(url: '/sso/callback/{type}/{key}', options: RequireKeys, 'path'>): Promise + /** + * @description 适配oauth2标准接入 + * @summary 选择登录方式 + * @tag 登录集成 + */ + get(url: '/sso/authorize/{type}/{key}', options: RequireKeys, 'path'>): Promise + /** + * @summary 查询 + * @tag 组织机构 + */ + get(url: '/organization', options: RequireKeys}, {}, unknown>, 'query'>): Promise> + /** + * @description 获取当前用户的菜单信息 + * @summary 导航条 + * @tag 公共接口 + */ + get(url: '/navbar', options?: SwaggerOptions<{}, {}, {}, unknown>): Promise> + /** + * @summary 查询 + * @tag 日志管理 + */ + get(url: '/log/api', options: RequireKeys, 'query'>): Promise + /** + * @summary 获取文件 + * @tag 文件库 + */ + get(url: '/files/{id}', options: RequireKeys, 'path'>): Promise + /** + * @summary 删除 + * @tag 文件库 + */ + delete(url: '/files/{id}', options: RequireKeys, 'path'>): Promise + /** + * @summary 文件查询 + * @tag 项目信息 + */ + get(url: '/directory/{id}/files', options: RequireKeys, 'path'>): Promise> + /** + * @summary 目录查询 + * @tag 项目信息 + */ + get(url: '/directory/{id}', options: RequireKeys, 'path'>): Promise> + /** + * @summary 目录查询 + * @tag 项目信息 + */ + get(url: '/directory', options?: SwaggerOptions<{}, {}, {}, unknown>): Promise> + /** + * @summary 目录树 + * @tag 成果库 + */ + get(url: '/achievement/{id}', options: RequireKeys, 'path'>): Promise> + /** + * @summary 文件列表 + * @tag 成果库 + */ + get(url: '/achievement/{id}/files', options: RequireKeys, 'path' | 'query'>): Promise + /** + * @summary 删除 + * @tag 模板管理 + */ + delete(url: '/template/{id}', options: RequireKeys, 'path'>): Promise +} + + +// swagger runtime. generate by swagger2ts +interface IRuntimeHeaderMapString { + [key: string]: string | string[]; +} + +interface IRuntimeHeaderConfig { + common: IRuntimeHeaderMapString; + [method: string]: IRuntimeHeaderMapString; +} + +interface IRuntimeRequestCommonOptions extends Omit { + path?: Record; + query?: Record>; + headers?: Record; + body?: any; + timeout?: number; +} + +interface IRuntimeRequestOptions extends IRuntimeRequestCommonOptions { + url: string; + method: Uppercase; +} + +interface IRequestInterceptor { + use(fn: IRequestInterceptorFn): IInterceptorCancelFn; +} + +interface IResponseInterceptor { + use(success: IResponseInterceptorSuccessFn, error: IResponseInterceptorErrorFn): IInterceptorCancelFn; +} + +type IInterceptorCancelFn = () => void; +type IRequestInterceptorFn = (config: IRuntimeRequestOptions) => Promise; +type IResponseInterceptorSuccessFn = (config: IRuntimeRequestOptions, response: Response, data: T) => Promise; +type IResponseInterceptorErrorFn = (config: IRuntimeRequestOptions, Error: RuntimeError) => Promise; + +export class RequestInterceptor implements IRequestInterceptor { + private _fns: IRequestInterceptorFn[] = []; + public use(fn: IRequestInterceptorFn) { + this._fns.push(fn); + + return () => { + const index = this._fns.findIndex((v) => v === fn); + + if (index > -1) { + this._fns.splice(index, 1); + } + }; + } + + async run(config: IRuntimeRequestOptions): Promise { + for (const fn of this._fns) { + config = await fn(config); + } + + return config; + } +} + +export class ResponseInterceptor implements IResponseInterceptor { + private _fnsSuccess: IResponseInterceptorSuccessFn[] = []; + private _fnsError: IResponseInterceptorErrorFn[] = []; + public use(successFn: IResponseInterceptorSuccessFn, errorFn: IResponseInterceptorErrorFn) { + this._fnsSuccess.push(successFn); + this._fnsError.push(errorFn); + + return () => { + const successIndex = this._fnsSuccess.findIndex((v) => v === successFn); + const errorIndex = this._fnsError.findIndex((v) => v === errorFn); + + if (successIndex > -1) { + this._fnsSuccess.splice(successIndex, 1); + } + + if (errorIndex > -1) { + this._fnsError.splice(errorIndex, 1); + } + }; + } + + async runSuccess(config: IRuntimeRequestOptions, response: Response, data: T): Promise { + for (const fn of this._fnsSuccess) { + data = await fn(config, response, data); + } + + return data; + } + + async runError(config: IRuntimeRequestOptions, err: RuntimeError): Promise { + let res!: T; + + for (const fn of this._fnsError) { + res = await fn(config, err); + } + + return res; + } +} + +export class RuntimeFormData> { + constructor(private _form: T) {} + public formData(): FormData { + const form = new FormData(); + + for (const key in this._form) { + if (this._form[key] !== undefined) { + form.append(key, this._form[key]); + } + } + + return form; + } +} + +export class RuntimeError extends Error { + constructor(message: string, private _resp?: Response) { + super(message); + } + + public get response(): Response | undefined { + return this._resp; + } + + static fromResponse(resp: Response) { + return new RuntimeError(resp.statusText, resp); + } + + static fromError(err: Error) { + return new RuntimeError(err.message || "unknown error: " + err); + } +} + +export interface IRuntime { + readonly interceptors: { readonly request: IRequestInterceptor; readonly response: IResponseInterceptor }; + readonly defaults: { readonly timeout: number; readonly headers: IRuntimeHeaderConfig }; + readonly baseURL: string; + domain: string; + prefix: string; + request(config: IRuntimeRequestOptions): Promise; + clone(): IRuntime; +} + +export class Runtime implements IRuntime { + constructor(private _domain: string, private _prefix: string) { + const methods = ["get", "post", "delete", "put", "head", "options", "trace", "patch"]; + + for (const method of methods) { + // @ts-ignore ignore error + this[method] = (url: string, config?: IRuntimeRequestCommonOptions = {}) => { + return this.request({ + method: method.toUpperCase() as Uppercase, + url, + ...config, + }); + }; + } + } + + private _requestInterceptor = new RequestInterceptor(); + private _responseInterceptor = new ResponseInterceptor(); + + private _defaults = { + timeout: 60 * 1000, // 60s, + headers: { + common: { + "Content-Type": "application/json", + }, + } as IRuntimeHeaderConfig, + }; + + public get interceptors() { + const self = this; + return { + get request() { + return self._requestInterceptor as IRequestInterceptor; + }, + get response() { + return self._responseInterceptor as IResponseInterceptor; + }, + }; + } + + public get defaults() { + return this._defaults; + } + + private _timeout(ms: number, promise: Promise) { + return new Promise((resolve, reject) => { + const timer = setTimeout(() => { + reject(new RuntimeError(`timeout of ${ms}ms`)); + }, ms); + + promise + .then((value) => { + clearTimeout(timer); + resolve(value); + }) + .catch((reason) => { + clearTimeout(timer); + reject(reason); + }); + }); + } + + public get baseURL(): string { + const baseUrl = this._domain.replace(/\/$/, "") + (!/^\//.test(this._prefix) ? "/" : "") + this._prefix; + + return baseUrl.replace(/\/$/, ""); + } + + public set domain(domain: string) { + this._domain = domain; + } + + public set prefix(prefix: string) { + this._prefix = prefix; + } + + public async request(config: IRuntimeRequestOptions): Promise { + config = await this._requestInterceptor.run(config); + + const url = new URL(this.baseURL + config.url); + config.headers = config.headers || {}; + + const headersObject: typeof config.headers = Object.create(null); + + const defaults = this.defaults; + + // set default header + for (const key in defaults.headers.common) { + headersObject[key] = defaults.headers.common[key]; + } + + // set header for this method + for (const key in defaults.headers[config.method] || {}) { + headersObject[key] = defaults.headers[config.method][key]; + } + + Object.assign(headersObject, config.headers); + + // set query for this method + if (config.query) { + for (const key in config.query) { + const value = config.query[key]; + if (value !== undefined && value !== null) { + if (Object.prototype.toString.call(value) === "[object Object]") { + url.searchParams.append(key, JSON.stringify(value)); + } else if (Array.isArray(value)) { + value.forEach((v) => url.searchParams.append(key, v)); + } else { + url.searchParams.append(key, value + ""); + } + } + } + } + + // set path for this method + if (config.path) { + for (const key in config.path) { + const t1 = encodeURI("{"); + const t2 = encodeURI("}"); + const reg = new RegExp(`${t1}${key}${t2}`, "g"); + url.pathname = url.pathname.replace(reg, config.path[key]); + } + } + + const headers = new Headers(); + + for (const key in headersObject) { + const value = headersObject[key]; + if (value !== undefined) { + if (Array.isArray(value)) { + headers.delete(key); + value.forEach((v) => headers.append(key, v)); + } else { + headers.set(key, value); + } + } + } + + const timeout = config.timeout || defaults.timeout; + + const body = + config.body === undefined + ? undefined + : ["GET", "HEAD"].indexOf(config.method.toUpperCase()) > -1 + ? undefined + : config.body instanceof RuntimeFormData + ? config.body.formData() + : config.body instanceof FormData + ? config.body + : config.body instanceof Blob + ? config.body + : typeof config.body === "object" + ? JSON.stringify(config.body) + : config.body.toString(); + + // 如果是 FormData, 删除 Content-Type,让浏览器自动设置 + if (body instanceof FormData) { + headers.delete("Content-Type"); + } + + const exec = () => + fetch(url.toString(), { + method: config.method, + body: body, + headers: headers, + + // common options + cache: config.cache, + credentials: config.credentials, + integrity: config.integrity, + keepalive: config.keepalive, + mode: config.mode, + redirect: config.redirect, + referrer: config.referrer, + referrerPolicy: config.referrerPolicy, + signal: config.signal, + window: config.window, + }); + + return (timeout ? this._timeout(timeout, exec()) : exec()) + .then(async (resp) => { + if (!resp.ok) return Promise.reject(RuntimeError.fromResponse(resp)); + const contentType = resp.headers.get("content-type"); + switch (contentType) { + case "application/json": + return { data: await resp.json(), resp }; + case "application/x-www-form-urlencoded": + return { data: await resp.formData(), resp }; + case "application/octet-stream": + return { data: await resp.blob(), resp }; + default: + return { data: await resp.text(), resp }; + } + }) + .then(({ data, resp }) => { + return this._responseInterceptor.runSuccess(config, resp, data); + }) + .catch((err) => { + const runtimeErr = + err instanceof RuntimeError ? err : err instanceof Error ? RuntimeError.fromError(err as unknown as Error) : new RuntimeError(err + ""); + + return this._responseInterceptor.runError(config, runtimeErr); + }); + } + + public clone() { + return new Runtime(this._domain, this._prefix); + } +} + +export type IClient = SwaggerApi & IRuntime +export const api = new Runtime("http://localhost", "/api") as unknown as IClient \ No newline at end of file diff --git a/__test__/3.0/uspto.ts b/__test__/3.0/uspto.ts index bfef039..0eab95a 100644 --- a/__test__/3.0/uspto.ts +++ b/__test__/3.0/uspto.ts @@ -109,10 +109,6 @@ type IRequestInterceptorFn = (config: IRuntimeRequestOptions) => Promise = (config: IRuntimeRequestOptions, response: Response, data: T) => Promise; type IResponseInterceptorErrorFn = (config: IRuntimeRequestOptions, Error: RuntimeError) => Promise; -export interface IRuntimeForm { - [key: string]: any; -} - export class RequestInterceptor implements IRequestInterceptor { private _fns: IRequestInterceptorFn[] = []; public use(fn: IRequestInterceptorFn) { @@ -176,7 +172,7 @@ export class ResponseInterceptor implements IResponseInterceptor { } } -export class RuntimeForm { +export class RuntimeFormData> { constructor(private _form: T) {} public formData(): FormData { const form = new FormData(); @@ -364,7 +360,7 @@ export class Runtime implements IRuntime { ? undefined : ["GET", "HEAD"].indexOf(config.method.toUpperCase()) > -1 ? undefined - : config.body instanceof RuntimeForm + : config.body instanceof RuntimeFormData ? config.body.formData() : config.body instanceof FormData ? config.body diff --git a/__test__/3.1/webhook-example.ts b/__test__/3.1/webhook-example.ts index bba845f..72423c5 100644 --- a/__test__/3.1/webhook-example.ts +++ b/__test__/3.1/webhook-example.ts @@ -65,10 +65,6 @@ type IRequestInterceptorFn = (config: IRuntimeRequestOptions) => Promise = (config: IRuntimeRequestOptions, response: Response, data: T) => Promise; type IResponseInterceptorErrorFn = (config: IRuntimeRequestOptions, Error: RuntimeError) => Promise; -export interface IRuntimeForm { - [key: string]: any; -} - export class RequestInterceptor implements IRequestInterceptor { private _fns: IRequestInterceptorFn[] = []; public use(fn: IRequestInterceptorFn) { @@ -132,7 +128,7 @@ export class ResponseInterceptor implements IResponseInterceptor { } } -export class RuntimeForm { +export class RuntimeFormData> { constructor(private _form: T) {} public formData(): FormData { const form = new FormData(); @@ -320,7 +316,7 @@ export class Runtime implements IRuntime { ? undefined : ["GET", "HEAD"].indexOf(config.method.toUpperCase()) > -1 ? undefined - : config.body instanceof RuntimeForm + : config.body instanceof RuntimeFormData ? config.body.formData() : config.body instanceof FormData ? config.body diff --git a/runtime/fetch.ts b/runtime/fetch.ts index 0e1630d..8ef973d 100644 --- a/runtime/fetch.ts +++ b/runtime/fetch.ts @@ -34,10 +34,6 @@ type IRequestInterceptorFn = (config: IRuntimeRequestOptions) => Promise = (config: IRuntimeRequestOptions, response: Response, data: T) => Promise; type IResponseInterceptorErrorFn = (config: IRuntimeRequestOptions, Error: RuntimeError) => Promise; -export interface IRuntimeForm { - [key: string]: any; -} - export class RequestInterceptor implements IRequestInterceptor { private _fns: IRequestInterceptorFn[] = []; public use(fn: IRequestInterceptorFn) { @@ -101,7 +97,7 @@ export class ResponseInterceptor implements IResponseInterceptor { } } -export class RuntimeForm { +export class RuntimeFormData> { constructor(private _form: T) {} public formData(): FormData { const form = new FormData(); @@ -289,7 +285,7 @@ export class Runtime implements IRuntime { ? undefined : ["GET", "HEAD"].indexOf(config.method.toUpperCase()) > -1 ? undefined - : config.body instanceof RuntimeForm + : config.body instanceof RuntimeFormData ? config.body.formData() : config.body instanceof FormData ? config.body diff --git a/v3/interface/api.ts b/v3/interface/api.ts index d59785c..5dd8f25 100644 --- a/v3/interface/api.ts +++ b/v3/interface/api.ts @@ -128,7 +128,10 @@ export function generatePaths( const g = new DefinitionGenerator(); if (formBody && mediaSchema === formBody) { - g.write("FormData"); + // g.write("FormData"); + g.write("RuntimeFormData<"); + traverse(g, mediaSchema.schema); + g.write(">"); } else { traverse(g, mediaSchema.schema); } @@ -143,7 +146,6 @@ export function generatePaths( const comment = g.createCommentBlock(); - // @ts-expect-error ignore error const op = pathObject[method] as IOperationObject; if (op.description || op.summary) {