MCPcopy Create free account
hub / github.com/vercel/vercel / extractEndpoints

Method extractEndpoints

packages/cli/src/util/openapi/openapi-cache.ts:368–397  ·  view source on GitHub ↗

* Extract all available endpoints from the loaded spec.

()

Source from the content-addressed store, hash-verified

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

Callers 1

getEndpointsMethod · 0.95

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected