@@ -277,10 +277,10 @@ const getContentTypes = (requestInfo, extraContentTypes) =>
277277 ) ;
278278
279279const 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 " ,
284284} ;
285285
286286const getContentKind = ( contentTypes ) => {
@@ -289,14 +289,14 @@ const getContentKind = (contentTypes) => {
289289 }
290290
291291 if ( contentTypes . includes ( "application/x-www-form-urlencoded" ) ) {
292- return CONTENT_KIND . QUERY ;
292+ return CONTENT_KIND . URL_ENCODED ;
293293 }
294294
295295 if ( contentTypes . includes ( "multipart/form-data" ) ) {
296296 return CONTENT_KIND . FORM_DATA ;
297297 }
298298
299- return CONTENT_KIND . UNKNOWN ;
299+ return CONTENT_KIND . OTHER ;
300300} ;
301301
302302const getRequestBodyInfo = ( routeInfo , routeParams , parsedSchemas ) => {
@@ -442,31 +442,22 @@ const parseRoutes = ({ usageSchema, parsedSchemas, moduleNameIndex, extractReque
442442 : null ;
443443
444444 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 ,
470461 requestParams : {
471462 name : pathArgs . some ( ( pathArg ) => pathArg . name === "params" )
472463 ? "requestParams"
@@ -533,7 +524,7 @@ const parseRoutes = ({ usageSchema, parsedSchemas, moduleNameIndex, extractReque
533524 query : specificArgs . query ,
534525 path : route . replace ( / { / g, "${" ) ,
535526 formData : requestBodyInfo . contentKind === CONTENT_KIND . FORM_DATA ,
536- isQueryBody : requestBodyInfo . contentKind === CONTENT_KIND . QUERY ,
527+ isQueryBody : requestBodyInfo . contentKind === CONTENT_KIND . URL_ENCODED ,
537528 security : hasSecurity ,
538529 method : method ,
539530 payload : specificArgs . body ,
0 commit comments