@@ -341,13 +341,15 @@ export const generatePaths = (routes: SwaggerRouteInfo[], templates: BlueprintAc
341
341
342
342
addSelectQueryParam : ( ) => {
343
343
if ( isParam ( 'query' , 'select' ) ) return ;
344
+ const attributes = route . model ! . attributes || { } ;
345
+ const csv = reduce ( attributes , ( acc , a , n ) => ( ( a . meta ?. swagger ?. exclude === true ) ? acc : [ ...acc , n ] ) , [ ] as string [ ] ) ;
344
346
pathEntry . parameters . push ( {
345
347
in : 'query' ,
346
348
name : 'select' ,
347
349
required : false ,
348
350
schema : {
349
351
type : 'string' ,
350
- example : [ ... keys ( route . model ! . attributes || { } ) ] . join ( ',' ) ,
352
+ example : csv . join ( ',' ) ,
351
353
} ,
352
354
description : 'The attributes to include in the result, specified as a comma-delimited list.'
353
355
+ ' By default, all attributes are selected.'
@@ -358,13 +360,15 @@ export const generatePaths = (routes: SwaggerRouteInfo[], templates: BlueprintAc
358
360
359
361
addOmitQueryParam : ( ) => {
360
362
if ( isParam ( 'query' , 'omit' ) ) return ;
363
+ const attributes = route . model ! . attributes || { } ;
364
+ const csv = reduce ( attributes , ( acc , a , n ) => ( ( a . meta ?. swagger ?. exclude === true ) ? acc : [ ...acc , n ] ) , [ ] as string [ ] ) ;
361
365
pathEntry . parameters . push ( {
362
366
in : 'query' ,
363
367
name : 'omit' ,
364
368
required : false ,
365
369
schema : {
366
370
type : 'string' ,
367
- example : [ ... keys ( route . model ! . attributes || { } ) ] . join ( ',' ) ,
371
+ example : csv . join ( ',' ) ,
368
372
} ,
369
373
description : 'The attributes to exclude from the result, specified as a comma-delimited list.'
370
374
+ ' Cannot be used in conjuction with `select`.'
0 commit comments