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<
120
120
> & { fallbackName : string } ;
121
121
122
122
export interface APIFoxBody {
123
- scope : {
123
+ scope ? : {
124
124
type ?: 'ALL' | 'SELECTED_TAGS' ;
125
125
includeTags ?: string [ ] ;
126
126
excludeTags ?: string [ ] ;
127
127
} ;
128
128
options ?: {
129
- includeApifoxExtensionProperties : boolean ;
130
- addFoldersToTags : boolean ;
129
+ includeApifoxExtensionProperties ? : boolean ;
130
+ addFoldersToTags ? : boolean ;
131
131
} ;
132
132
oasVersion ?: '2.0' | '3.0' | '3.1' ;
133
133
exportFormat ?: 'JSON' | 'YAML' ;
134
134
environmentIds ?: string [ ] ;
135
135
}
136
- export interface GetSchemaByApifoxProps {
136
+
137
+ export interface GetSchemaByApifoxProps
138
+ extends Pick < APIFoxBody , 'oasVersion' | 'exportFormat' > ,
139
+ Pick <
140
+ APIFoxBody [ 'options' ] ,
141
+ 'includeApifoxExtensionProperties' | 'addFoldersToTags'
142
+ > {
137
143
projectId : string ;
144
+ apifoxToken : string ;
138
145
locale ?: string ;
139
146
apifoxVersion ?: string ;
140
147
includeTags ?: ( string | RegExp ) [ ] ;
141
148
excludeTags ?: string [ ] ;
142
- apifoxToken : string ;
143
149
}
Original file line number Diff line number Diff line change @@ -79,18 +79,22 @@ const getSchemaByApifox = async ({
79
79
includeTags,
80
80
excludeTags = [ ] ,
81
81
apifoxToken,
82
+ oasVersion = '3.0' ,
83
+ exportFormat = 'JSON' ,
84
+ includeApifoxExtensionProperties = false ,
85
+ addFoldersToTags = false ,
82
86
} : GetSchemaByApifoxProps ) : Promise < OpenAPI . Document | null > => {
83
87
try {
84
88
const body : APIFoxBody = {
85
89
scope : {
86
90
excludeTags,
87
91
} ,
88
92
options : {
89
- includeApifoxExtensionProperties : false ,
90
- addFoldersToTags : false ,
93
+ includeApifoxExtensionProperties,
94
+ addFoldersToTags,
91
95
} ,
92
- oasVersion : '3.0' ,
93
- exportFormat : 'JSON' ,
96
+ oasVersion,
97
+ exportFormat,
94
98
} ;
95
99
const tags = getApifoxIncludeTags ( includeTags ) ;
96
100
@@ -103,7 +107,7 @@ const getSchemaByApifox = async ({
103
107
104
108
const res = await axios . post (
105
109
`https://api.apifox.com/v1/projects/${ projectId } /export-openapi?locale=${ locale } ` ,
106
- { } ,
110
+ body ,
107
111
{
108
112
headers : {
109
113
'X-Apifox-Api-Version' : apifoxVersion ,
You can’t perform that action at this time.
0 commit comments