@@ -359,47 +359,51 @@ function analyzeOpenApi(oaObj) {
359359      paths . push ( path ) ; 
360360      const  pathItem  =  oaObj . paths [ path ] ; 
361361
362-       Object . keys ( pathItem ) . forEach ( method  =>  { 
363-         methods . add ( method . toUpperCase ( ) ) ; 
364-         const  operation  =  pathItem [ method ] ; 
365-         operations . push ( `${ method . toUpperCase ( ) } ${ path }  ) ; 
366- 
367-         if  ( operation ?. tags  &&  Array . isArray ( operation . tags ) )  { 
368-           operation . tags . forEach ( tag  =>  { 
369-             if  ( tag . startsWith ( 'x-' ) )  { 
370-               flags . add ( tag ) ; 
371-             }  else  { 
372-               tags . add ( tag ) ; 
362+       if  ( pathItem  &&  typeof  pathItem  ===  'object' )  { 
363+         Object . keys ( pathItem ) . forEach ( method  =>  { 
364+           methods . add ( method . toUpperCase ( ) ) ; 
365+           const  operation  =  pathItem [ method ] ; 
366+           operations . push ( `${ method . toUpperCase ( ) } ${ path }  ) ; 
367+ 
368+           if  ( operation  &&  typeof  operation  ===  'object' )  { 
369+             if  ( operation ?. tags  &&  Array . isArray ( operation . tags ) )  { 
370+               operation . tags . forEach ( tag  =>  { 
371+                 if  ( tag . startsWith ( 'x-' ) )  { 
372+                   flags . add ( tag ) ; 
373+                 }  else  { 
374+                   tags . add ( tag ) ; 
375+                 } 
376+               } ) ; 
377+             } 
378+ 
379+             if  ( operation ?. operationId )  { 
380+               operationIds . push ( operation . operationId ) ; 
373381            } 
374-           } ) ; 
375-         } 
376- 
377-         if  ( operation ?. operationId )  { 
378-           operationIds . push ( operation . operationId ) ; 
379-         } 
380- 
381-         if  ( operation ?. requestBody ?. content )  { 
382-           Object . keys ( operation . requestBody . content ) . forEach ( contentType  =>  { 
383-             requestContent . add ( contentType ) ; 
384-           } ) ; 
385-         } 
386- 
387-         if  ( operation ?. responses )  { 
388-           Object . values ( operation . responses ) . forEach ( response  =>  { 
389-             if  ( response ?. content )  { 
390-               Object . keys ( response . content ) . forEach ( contentType  =>  { 
391-                 responseContent . add ( contentType ) ; 
382+ 
383+             if  ( operation ?. requestBody ?. content )  { 
384+               Object . keys ( operation . requestBody . content ) . forEach ( contentType  =>  { 
385+                 requestContent . add ( contentType ) ; 
392386              } ) ; 
393387            } 
394-           } ) ; 
395-         } 
396388
397-         Object . keys ( operation ) . forEach ( key  =>  { 
398-           if  ( key . startsWith ( 'x-' ) )  { 
399-             flagValues . add ( `${ key } ${ operation [ key ] }  ) ; 
389+             if  ( operation ?. responses )  { 
390+               Object . values ( operation . responses ) . forEach ( response  =>  { 
391+                 if  ( response ?. content )  { 
392+                   Object . keys ( response . content ) . forEach ( contentType  =>  { 
393+                     responseContent . add ( contentType ) ; 
394+                   } ) ; 
395+                 } 
396+               } ) ; 
397+             } 
398+ 
399+             Object . keys ( operation ) . forEach ( key  =>  { 
400+               if  ( key . startsWith ( 'x-' ) )  { 
401+                 flagValues . add ( `${ key } ${ operation [ key ] }  ) ; 
402+               } 
403+             } ) ; 
400404          } 
401405        } ) ; 
402-       } ) ; 
406+       } 
403407    } ) ; 
404408  } 
405409
0 commit comments