File tree Expand file tree Collapse file tree 2 files changed +52
-9
lines changed Expand file tree Collapse file tree 2 files changed +52
-9
lines changed Original file line number Diff line number Diff line change @@ -26,12 +26,8 @@ pnpm add foca-openapi
2626import { defineConfig } from ' foca-openapi' ;
2727
2828export default defineConfig ({
29- // 可以是本地路径,也可以是远程地址。格式为json或者yaml
29+ // 可以是本地路径,也可以是远程地址
3030 path: ' http://domain.com/openapi.json' ,
31- // 只包含指定的路由,支持字符串或者正则表达式
32- // includeUriPrefix: ['/admin'],
33- // 只包含指定的标签
34- // includeTag: ['admin', 'public'],
3531});
3632```
3733
@@ -96,3 +92,48 @@ import { OpenapiClientFoo, OpenapiClientBar } from 'foca-openapi';
9692export const fooClient = new OpenapiClientFoo (adapter1 );
9793export const barClient = new OpenapiClientBar (adapter2 );
9894```
95+
96+ # 参数
97+
98+ ### path
99+
100+ 类型:` string ` <br >
101+
102+ openapi本地或者远程文件,支持格式:` yaml | json `
103+
104+ ### includeUriPrefix
105+
106+ 类型:` string | string[] | RegExp | RegExp[] `
107+
108+ 过滤指定路由前缀的接口
109+
110+ ### includeTag
111+
112+ 类型:` string | string[] `
113+
114+ 过滤指定标签
115+
116+ ### projectName
117+
118+ 类型:` string `
119+
120+ 项目名称,提供多个openapi路径时必须填写。比如项目名为` demo ` ,则导出的类为` OpenapiClientDemo `
121+
122+ ### classMode
123+
124+ 类型:` 'method' | 'uri' ` <br >
125+ 默认值:` 'method' `
126+
127+ 类的生成方式。
128+
129+ - ` method ` ,仅生成 ** get|post|put|patch|delete** 几个方法,uri作为第一个参数传入
130+ - ` uri ` ,把 method+uri 拼接成一个方法,比如 ** POST /users/{id}** 会变成 ** postUsersById()**
131+
132+ ### tagToGroup
133+
134+ 类型:` boolean ` <br >
135+ 默认值:` true `
136+
137+ 根据Tag生成不同的分组,以类似 ** client.user.getUsers()** 这种方式调用。仅在 ` classMode=uri ` 场景下生效。
138+
139+ 如果没有提供tags,则默认合并到` default ` 分组
Original file line number Diff line number Diff line change 11export interface OpenapiClientConfig {
22 /**
3- * openapi本地或者远程文件
3+ * openapi本地或者远程文件,支持格式:`yaml | json`
44 */
55 path : string ;
66 /**
@@ -25,12 +25,14 @@ export interface OpenapiClientConfig {
2525 projectName ?: string ;
2626 /**
2727 * 类的生成方式。默认值:`method`
28- * - `method`,仅生成 ` get|post|put|patch|delete` 几个方法,uri作为第一个参数传入
29- * - `uri`,把 method+uri 拼接成一个方法,比如 ` POST /users/{id}` 会变成 ` postUsersById()`
28+ * - `method`,仅生成 ** get|post|put|patch|delete** 几个方法,uri作为第一个参数传入
29+ * - `uri`,把 method+uri 拼接成一个方法,比如 ** POST /users/{id}** 会变成 ** postUsersById()**
3030 */
3131 classMode ?: 'method' | 'uri' ;
3232 /**
33- * 根据Tag生成不同的分组,以类似`client.user.getUsers()`这种方式调用。仅在 `classMode=uri` 场景下生效。默认值:`true`
33+ * 根据Tag生成不同的分组,以类似 **client.user.getUsers()** 这种方式调用。仅在 `classMode=uri` 场景下生效。默认值:`true`
34+ *
35+ * 如果没有提供tags,则默认合并到`default`分组
3436 */
3537 tagToGroup ?: boolean ;
3638}
You can’t perform that action at this time.
0 commit comments