* Extract all available endpoints from the loaded spec.
()
| 366 | * Extract all available endpoints from the loaded spec. |
| 367 | */ |
| 368 | private extractEndpoints(): EndpointInfo[] { |
| 369 | const endpoints: EndpointInfo[] = []; |
| 370 | |
| 371 | for (const [path, pathItem] of Object.entries(this.spec!.paths)) { |
| 372 | const methods = ['get', 'post', 'put', 'patch', 'delete'] as const; |
| 373 | |
| 374 | for (const method of methods) { |
| 375 | const operation = pathItem[method]; |
| 376 | if (operation) { |
| 377 | // Merge path-level and operation-level parameters |
| 378 | const pathParams = pathItem.parameters || []; |
| 379 | const opParams = operation.parameters || []; |
| 380 | const allParams = [...pathParams, ...opParams]; |
| 381 | |
| 382 | endpoints.push({ |
| 383 | path, |
| 384 | method: method.toUpperCase(), |
| 385 | summary: operation.summary || pathItem.summary || '', |
| 386 | description: operation.description || pathItem.description || '', |
| 387 | operationId: operation.operationId || '', |
| 388 | tags: operation.tags || [], |
| 389 | parameters: allParams, |
| 390 | requestBody: operation.requestBody, |
| 391 | }); |
| 392 | } |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | return endpoints; |
| 397 | } |
| 398 | |
| 399 | /** |
| 400 | * Resolve a $ref to its actual schema |