File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' openapi-ts-request ' : patch
3+ ---
4+
5+ perf: support apifox config branchId, moduleId
Original file line number Diff line number Diff line change @@ -285,6 +285,8 @@ openapi -i ./spec.json -o ./apis
285285| exportFormat | string | specify the format of the exported OpenAPI file, can have values such as 'JSON' or 'YAML' | 'JSON' |
286286| includeApifoxExtensionProperties | boolean | specify whether to include the OpenAPI specification extension fields ` x-apifox ` | false |
287287| addFoldersToTags | boolean | specify whether to include the directory name of the interface in the tag field | false |
288+ | branchId | number | branch id | false |
289+ | moduleId | number | module id | false |
288290
289291## JSON Schemas
290292
Original file line number Diff line number Diff line change @@ -287,6 +287,8 @@ openapi --i ./spec.json --o ./apis
287287| exportFormat | string | 指定导出的 OpenAPI 文件的格式,可以有值如 'JSON' 或 'YAML' | 'JSON' |
288288| includeApifoxExtensionProperties | boolean | 指定是否包含 Apifox 的 OpenAPI 规范扩展字段 ` x-apifox ` | false |
289289| addFoldersToTags | boolean | 指定是否在标签字段中包含接口的目录名称 | false |
290+ | branchId | number | 分支ID | false |
291+ | moduleId | number | 模块ID | false |
290292
291293## JSON Schemas
292294
Original file line number Diff line number Diff line change @@ -270,7 +270,9 @@ else if (isNodeProject) {
270270 local : " zh-CN" ,
271271 selectedTags : [" user" , " order" ],
272272 oasVersion : " 3.0" ,
273- exportFormat : " JSON"
273+ exportFormat : " JSON" ,
274+ branchId : 123 , // Optional: branch id
275+ moduleId : 456 // Optional: module id
274276 },
275277 serversPath : " ./src/apis" ,
276278 isGenReactQuery : true ,
Original file line number Diff line number Diff line change @@ -132,18 +132,16 @@ export interface APIFoxBody {
132132 oasVersion ?: '2.0' | '3.0' | '3.1' ;
133133 exportFormat ?: 'JSON' | 'YAML' ;
134134 environmentIds ?: string [ ] ;
135+ branchId ?: number ;
136+ moduleId ?: number ;
135137}
136138
137- export interface GetSchemaByApifoxProps
138- extends Pick < APIFoxBody , 'oasVersion' | 'exportFormat' > ,
139- Pick <
140- APIFoxBody [ 'options' ] ,
141- 'includeApifoxExtensionProperties' | 'addFoldersToTags'
142- > {
139+ export type GetSchemaByApifoxProps = {
143140 projectId : string ;
144141 apifoxToken : string ;
145142 locale ?: string ;
146143 apifoxVersion ?: string ;
147144 selectedTags ?: string [ ] ;
148145 excludedByTags ?: string [ ] ;
149- }
146+ } & Pick < APIFoxBody , 'oasVersion' | 'exportFormat' | 'branchId' | 'moduleId' > &
147+ APIFoxBody [ 'options' ] ;
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ const getSchemaByApifox = async ({
5252 exportFormat = 'JSON' ,
5353 includeApifoxExtensionProperties = false ,
5454 addFoldersToTags = false ,
55+ branchId,
56+ moduleId,
5557} : GetSchemaByApifoxProps ) : Promise < OpenAPI . Document | null > => {
5658 try {
5759 const body : APIFoxBody = {
@@ -65,6 +67,15 @@ const getSchemaByApifox = async ({
6567 oasVersion,
6668 exportFormat,
6769 } ;
70+
71+ if ( branchId !== undefined ) {
72+ body . branchId = branchId ;
73+ }
74+
75+ if ( moduleId !== undefined ) {
76+ body . moduleId = moduleId ;
77+ }
78+
6879 const tags = ! isEmpty ( selectedTags ) ? selectedTags : '*' ;
6980
7081 if ( tags === '*' ) {
You can’t perform that action at this time.
0 commit comments