@@ -30,19 +30,17 @@ export const documentToMeta = (docs: OpenAPIV3.Document) => {
3030
3131 Object . entries ( docs . paths ) . forEach ( ( [ uri , pathItem ] ) => {
3232 methods . forEach ( ( method ) => {
33- if ( pathItem ?. [ method ] ) {
34- const methodItem = pathItem [ method ] ;
35- metas [ method ] . push ( {
36- uri,
37- key :
38- methodItem . operationId ||
39- snakeCase ( `${ method } _${ uri . replaceAll ( ':' , '_by_' ) } ` ) ,
40- query : parseParameters ( docs , pathItem , methodItem , 'query' ) ,
41- params : parseParameters ( docs , pathItem , methodItem , 'path' ) ,
42- ...parseRequestBody ( docs , methodItem ) ,
43- ...parseResponse ( docs , methodItem ) ,
44- } ) ;
45- }
33+ if ( ! pathItem || ! pathItem [ method ] ) return ;
34+ const methodItem = pathItem [ method ] ! ;
35+ metas [ method ] . push ( {
36+ uri,
37+ key :
38+ methodItem . operationId || snakeCase ( `${ method } _${ uri . replaceAll ( ':' , '_by_' ) } ` ) ,
39+ query : parseParameters ( docs , pathItem , methodItem , 'query' ) ,
40+ params : parseParameters ( docs , pathItem , methodItem , 'path' ) ,
41+ ...parseRequestBody ( docs , methodItem ) ,
42+ ...parseResponse ( docs , methodItem ) ,
43+ } ) ;
4644 } ) ;
4745 } ) ;
4846
0 commit comments