@@ -277,10 +277,10 @@ const getContentTypes = (requestInfo, extraContentTypes) =>
277
277
) ;
278
278
279
279
const CONTENT_KIND = {
280
- JSON : "json " ,
281
- QUERY : "query " ,
282
- FORM_DATA : "formData " ,
283
- UNKNOWN : "unknown " ,
280
+ JSON : "JSON " ,
281
+ URL_ENCODED : "URL_ENCODED " ,
282
+ FORM_DATA : "FORM_DATA " ,
283
+ OTHER : "OTHER " ,
284
284
} ;
285
285
286
286
const getContentKind = ( contentTypes ) => {
@@ -289,14 +289,14 @@ const getContentKind = (contentTypes) => {
289
289
}
290
290
291
291
if ( contentTypes . includes ( "application/x-www-form-urlencoded" ) ) {
292
- return CONTENT_KIND . QUERY ;
292
+ return CONTENT_KIND . URL_ENCODED ;
293
293
}
294
294
295
295
if ( contentTypes . includes ( "multipart/form-data" ) ) {
296
296
return CONTENT_KIND . FORM_DATA ;
297
297
}
298
298
299
- return CONTENT_KIND . UNKNOWN ;
299
+ return CONTENT_KIND . OTHER ;
300
300
} ;
301
301
302
302
const getRequestBodyInfo = ( routeInfo , routeParams , parsedSchemas ) => {
@@ -442,31 +442,22 @@ const parseRoutes = ({ usageSchema, parsedSchemas, moduleNameIndex, extractReque
442
442
: null ;
443
443
444
444
const specificArgs = {
445
- query :
446
- queryType || requestBodyInfo . contentKind === CONTENT_KIND . QUERY
447
- ? {
448
- name : pathArgs . some ( ( pathArg ) => pathArg . name === "query" )
449
- ? "queryParams"
450
- : "query" ,
451
- optional :
452
- requestBodyInfo . contentKind === CONTENT_KIND . QUERY
453
- ? ! requestBodyInfo . required &&
454
- ( ! queryType || parseSchema ( queryObjectSchema , null ) . allFieldsAreOptional )
455
- : parseSchema ( queryObjectSchema , null ) . allFieldsAreOptional ,
456
- type :
457
- requestBodyInfo . contentKind === CONTENT_KIND . QUERY
458
- ? _ . compact ( [ queryType , requestBodyInfo . type ] ) . join ( " & " )
459
- : queryType ,
460
- }
461
- : void 0 ,
462
- body :
463
- requestBodyInfo . contentKind !== CONTENT_KIND . QUERY && requestBodyInfo . type
464
- ? {
465
- name : requestBodyInfo . paramName ,
466
- optional : ! requestBodyInfo . required ,
467
- type : requestBodyInfo . type ,
468
- }
469
- : void 0 ,
445
+ query : queryType
446
+ ? {
447
+ name : pathArgs . some ( ( pathArg ) => pathArg . name === "query" )
448
+ ? "queryParams"
449
+ : "query" ,
450
+ optional : parseSchema ( queryObjectSchema , null ) . allFieldsAreOptional ,
451
+ type : queryType ,
452
+ }
453
+ : void 0 ,
454
+ body : requestBodyInfo . type
455
+ ? {
456
+ name : requestBodyInfo . paramName ,
457
+ optional : ! requestBodyInfo . required ,
458
+ type : requestBodyInfo . type ,
459
+ }
460
+ : void 0 ,
470
461
requestParams : {
471
462
name : pathArgs . some ( ( pathArg ) => pathArg . name === "params" )
472
463
? "requestParams"
@@ -533,7 +524,7 @@ const parseRoutes = ({ usageSchema, parsedSchemas, moduleNameIndex, extractReque
533
524
query : specificArgs . query ,
534
525
path : route . replace ( / { / g, "${" ) ,
535
526
formData : requestBodyInfo . contentKind === CONTENT_KIND . FORM_DATA ,
536
- isQueryBody : requestBodyInfo . contentKind === CONTENT_KIND . QUERY ,
527
+ isQueryBody : requestBodyInfo . contentKind === CONTENT_KIND . URL_ENCODED ,
537
528
security : hasSecurity ,
538
529
method : method ,
539
530
payload : specificArgs . body ,
0 commit comments