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

Function printOperationHelpForTagCommand

packages/cli/src/commands/api/index.ts:218–247  ·  view source on GitHub ↗
(
  client: Client,
  flags: ParsedFlags,
  tag: string,
  operationId: string
)

Source from the content-addressed store, hash-verified

216}
217
218export async function printOperationHelpForTagCommand(
219 client: Client,
220 flags: ParsedFlags,
221 tag: string,
222 operationId: string
223): Promise<number> {
224 const openApi = createOpenApiCache(client, flags['--spec-url']);
225 const loaded = await openApi.loadWithSpinner(flags['--refresh'] ?? false);
226 if (!loaded) {
227 output.error(openApi.loadError ?? 'Could not load API specification');
228 return 1;
229 }
230
231 const allEndpoints = openApi.getEndpoints();
232 const resolved = resolveEndpointByTagAndOperationId(
233 allEndpoints,
234 tag,
235 operationId
236 );
237
238 if (!resolved.ok) {
239 printTagOperationResolveError(resolved, allEndpoints);
240 return 1;
241 }
242
243 const ep = resolved.endpoint;
244 const bodyFields = openApi.getBodyFields(ep);
245 printOperationHelpDetails(ep, bodyFields, tag);
246 return 2;
247}
248
249function printOperationHelpDetails(
250 ep: EndpointInfo,

Callers 1

tryOpenApiFallbackFunction · 0.90

Calls 8

createOpenApiCacheFunction · 0.90
loadWithSpinnerMethod · 0.80
errorMethod · 0.80
getEndpointsMethod · 0.80
getBodyFieldsMethod · 0.80

Tested by

no test coverage detected