@@ -261,29 +261,40 @@ export default function generateTypesV3(
261
261
262
262
function transformPaths ( paths : OpenAPI3Paths ) : string {
263
263
let output = "" ;
264
- Object . entries ( paths ) . forEach ( ( [ path , methods ] ) => {
264
+ Object . entries ( paths ) . forEach ( ( [ path , pathItem ] ) => {
265
265
output += `"${ path } ": {\n` ;
266
266
267
- Object . entries ( methods ) . forEach ( ( [ method , operation ] ) => {
267
+ Object . entries ( pathItem ) . forEach ( ( [ field , operation ] ) => {
268
268
// skip the parameters "method" for shared parameters - we'll handle it later
269
- if ( method !== "parameters" ) {
269
+ const isMethod = [
270
+ "get" ,
271
+ "put" ,
272
+ "post" ,
273
+ "delete" ,
274
+ "options" ,
275
+ "head" ,
276
+ "patch" ,
277
+ "trace" ,
278
+ ] . includes ( field ) ;
279
+
280
+ if ( isMethod ) {
270
281
operation = operation as OpenAPI3Operation ;
271
282
272
283
if ( operation . operationId ) {
273
- output += `"${ method } ": operations["${ operation . operationId } "];\n` ;
284
+ output += `"${ field } ": operations["${ operation . operationId } "];\n` ;
274
285
operations [ operation . operationId ] = operation ;
275
286
} else {
276
287
if ( operation . description ) output += comment ( operation . description ) ;
277
- output += `"${ method } ": ${ transformOperation (
288
+ output += `"${ field } ": ${ transformOperation (
278
289
operation as OpenAPI3Operation
279
290
) } `;
280
291
}
281
292
}
282
293
} ) ;
283
294
284
- if ( methods . parameters ) {
295
+ if ( pathItem . parameters ) {
285
296
// Handle shared parameters
286
- output += transformParameters ( methods . parameters as Parameter [ ] ) ;
297
+ output += transformParameters ( pathItem . parameters as Parameter [ ] ) ;
287
298
}
288
299
output += `}\n` ;
289
300
} ) ;
0 commit comments