MCPcopy Create free account
hub / github.com/hey-api/hey-api / bundleMany

Method bundleMany

packages/json-schema-ref-parser/src/index.ts:135–162  ·  view source on GitHub ↗

* Bundles multiple roots (files/URLs/objects) into a single schema by creating a synthetic root * that references each input, resolving all externals, and then hoisting via the existing bundler.

({
    arrayBuffer,
    fetch,
    pathOrUrlOrSchemas,
    resolvedInputs,
  }: {
    arrayBuffer?: ArrayBuffer[];
    fetch?: RequestInit;
    pathOrUrlOrSchemas: Array<JSONSchema | string | unknown>;
    resolvedInputs?: ResolvedInput[];
  })

Source from the content-addressed store, hash-verified

133 * that references each input, resolving all externals, and then hoisting via the existing bundler.
134 */
135 public async bundleMany({
136 arrayBuffer,
137 fetch,
138 pathOrUrlOrSchemas,
139 resolvedInputs,
140 }: {
141 arrayBuffer?: ArrayBuffer[];
142 fetch?: RequestInit;
143 pathOrUrlOrSchemas: Array<JSONSchema | string | unknown>;
144 resolvedInputs?: ResolvedInput[];
145 }): Promise<JSONSchema> {
146 await this.parseMany({ arrayBuffer, fetch, pathOrUrlOrSchemas, resolvedInputs });
147 this.mergeMany();
148
149 await resolveExternal(this, this.options);
150 const errors = JSONParserErrorGroup.getParserErrors(this);
151 if (errors.length) {
152 throw new JSONParserErrorGroup(this);
153 }
154 _bundle(this, this.options);
155 // Merged root is ready for bundling
156
157 const errors2 = JSONParserErrorGroup.getParserErrors(this);
158 if (errors2.length) {
159 throw new JSONParserErrorGroup(this);
160 }
161 return this.schema!;
162 }
163
164 /**
165 * Parses the given JSON schema.

Callers 3

createClientFunction · 0.95
createClientFunction · 0.95
bundle.test.tsFile · 0.80

Calls 4

parseManyMethod · 0.95
mergeManyMethod · 0.95
resolveExternalFunction · 0.90
getParserErrorsMethod · 0.80

Tested by

no test coverage detected