MCPcopy Create free account
hub / github.com/EvilFreelancer/openapi-to-cli / loadFromSource

Method loadFromSource

src/openapi-loader.ts:59–67  ·  view source on GitHub ↗
(source: string)

Source from the content-addressed store, hash-verified

57 }
58
59 private async loadFromSource(source: string): Promise<unknown> {
60 if (source.startsWith("http://") || source.startsWith("https://")) {
61 const response = await axios.get(source, { responseType: "text" });
62 return this.parseSpec(response.data, source);
63 }
64
65 const raw = this.fs.readFileSync(source, "utf-8");
66 return this.parseSpec(raw, source);
67 }
68
69 private async loadDocument(source: string, rawDocCache: Map<string, unknown>): Promise<unknown> {
70 if (rawDocCache.has(source)) {

Callers 1

loadDocumentMethod · 0.95

Calls 2

parseSpecMethod · 0.95
readFileSyncMethod · 0.65

Tested by

no test coverage detected