@@ -18,6 +18,7 @@ import {
18
18
ContextSpecs ,
19
19
GeneratorVerbOptions ,
20
20
GeneratorVerbsOptions ,
21
+ NormalizedInputOptions ,
21
22
NormalizedOperationOptions ,
22
23
NormalizedOutputOptions ,
23
24
NormalizedOverrideOutput ,
@@ -188,17 +189,19 @@ const generateVerbOptions = async ({
188
189
189
190
export const generateVerbsOptions = ( {
190
191
verbs,
192
+ input,
191
193
output,
192
194
route,
193
195
context,
194
196
} : {
195
197
verbs : PathItemObject ;
198
+ input : NormalizedInputOptions ;
196
199
output : NormalizedOutputOptions ;
197
200
route : string ;
198
201
context : ContextSpecs ;
199
202
} ) : Promise < GeneratorVerbsOptions > =>
200
203
asyncReduce (
201
- Object . entries ( verbs ) ,
204
+ filteredVerbs ( verbs , input . filters ) ,
202
205
async ( acc , [ verb , operation ] : [ string , OperationObject ] ) => {
203
206
if ( isVerb ( verb ) ) {
204
207
const verbOptions = await generateVerbOptions ( {
@@ -217,3 +220,18 @@ export const generateVerbsOptions = ({
217
220
} ,
218
221
[ ] as GeneratorVerbsOptions ,
219
222
) ;
223
+
224
+ const filteredVerbs = (
225
+ verbs : PathItemObject ,
226
+ filters : NormalizedInputOptions [ 'filters' ] ,
227
+ ) => {
228
+ if ( filters === undefined || filters . tags === undefined ) {
229
+ return Object . entries ( verbs ) ;
230
+ }
231
+
232
+ return Object . entries ( verbs ) . filter (
233
+ ( [ _verb , operation ] : [ string , OperationObject ] ) => {
234
+ return operation . tags ?. some ( ( tag ) => filters . tags ?. includes ( tag ) ) ;
235
+ } ,
236
+ ) ;
237
+ } ;
1 commit comments
vercel[bot] commentedon Apr 8, 2023
Successfully deployed to the following URLs:
orval – ./
orval-anymaniax.vercel.app
www.orval.dev
orval-git-master-anymaniax.vercel.app
orval.vercel.app
orval.dev