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

Method loadCustomSpec

packages/cli/src/util/openapi/openapi-cache.ts:111–131  ·  view source on GitHub ↗
(specUrl: string)

Source from the content-addressed store, hash-verified

109 }
110
111 private async loadCustomSpec(specUrl: string): Promise<boolean> {
112 try {
113 assertAllowedSpecUrl(specUrl);
114 output.debug('Fetching OpenAPI spec from ' + specUrl);
115 const spec = this.fetchSpecUrl
116 ? await this.fetchSpecUrl(specUrl)
117 : await this.fetchSpec(specUrl);
118 if (!spec) {
119 this.error = `Could not load OpenAPI spec from ${specUrl}.`;
120 return false;
121 }
122 this.validateSpec(spec, specUrl);
123 this.spec = spec;
124 return Boolean(this.spec);
125 } catch (err) {
126 const message = err instanceof Error ? err.message : String(err);
127 this.error = message;
128 output.debug(`Failed to fetch OpenAPI spec from ${specUrl}: ${message}`);
129 return false;
130 }
131 }
132
133 /**
134 * Load the OpenAPI spec with spinner UI.

Callers 1

loadSpecMethod · 0.95

Calls 4

fetchSpecMethod · 0.95
validateSpecMethod · 0.95
assertAllowedSpecUrlFunction · 0.90
debugMethod · 0.80

Tested by

no test coverage detected