File tree Expand file tree Collapse file tree 3 files changed +25
-10
lines changed
Expand file tree Collapse file tree 3 files changed +25
-10
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ ' openapi-ts-request ' : patch
3+ ---
4+
5+ feat: support extra apifox config
Original file line number Diff line number Diff line change @@ -120,24 +120,30 @@ export type ReadConfigOptions = MutuallyExclusiveWithFallback<
120120> & { fallbackName : string } ;
121121
122122export interface APIFoxBody {
123- scope : {
123+ scope ? : {
124124 type ?: 'ALL' | 'SELECTED_TAGS' ;
125125 includeTags ?: string [ ] ;
126126 excludeTags ?: string [ ] ;
127127 } ;
128128 options ?: {
129- includeApifoxExtensionProperties : boolean ;
130- addFoldersToTags : boolean ;
129+ includeApifoxExtensionProperties ? : boolean ;
130+ addFoldersToTags ? : boolean ;
131131 } ;
132132 oasVersion ?: '2.0' | '3.0' | '3.1' ;
133133 exportFormat ?: 'JSON' | 'YAML' ;
134134 environmentIds ?: string [ ] ;
135135}
136- export interface GetSchemaByApifoxProps {
136+
137+ export interface GetSchemaByApifoxProps
138+ extends Pick < APIFoxBody , 'oasVersion' | 'exportFormat' > ,
139+ Pick <
140+ APIFoxBody [ 'options' ] ,
141+ 'includeApifoxExtensionProperties' | 'addFoldersToTags'
142+ > {
137143 projectId : string ;
144+ apifoxToken : string ;
138145 locale ?: string ;
139146 apifoxVersion ?: string ;
140147 includeTags ?: ( string | RegExp ) [ ] ;
141148 excludeTags ?: string [ ] ;
142- apifoxToken : string ;
143149}
Original file line number Diff line number Diff line change @@ -79,18 +79,22 @@ const getSchemaByApifox = async ({
7979 includeTags,
8080 excludeTags = [ ] ,
8181 apifoxToken,
82+ oasVersion = '3.0' ,
83+ exportFormat = 'JSON' ,
84+ includeApifoxExtensionProperties = false ,
85+ addFoldersToTags = false ,
8286} : GetSchemaByApifoxProps ) : Promise < OpenAPI . Document | null > => {
8387 try {
8488 const body : APIFoxBody = {
8589 scope : {
8690 excludeTags,
8791 } ,
8892 options : {
89- includeApifoxExtensionProperties : false ,
90- addFoldersToTags : false ,
93+ includeApifoxExtensionProperties,
94+ addFoldersToTags,
9195 } ,
92- oasVersion : '3.0' ,
93- exportFormat : 'JSON' ,
96+ oasVersion,
97+ exportFormat,
9498 } ;
9599 const tags = getApifoxIncludeTags ( includeTags ) ;
96100
@@ -103,7 +107,7 @@ const getSchemaByApifox = async ({
103107
104108 const res = await axios . post (
105109 `https://api.apifox.com/v1/projects/${ projectId } /export-openapi?locale=${ locale } ` ,
106- { } ,
110+ body ,
107111 {
108112 headers : {
109113 'X-Apifox-Api-Version' : apifoxVersion ,
You can’t perform that action at this time.
0 commit comments