MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / parseHead

Function parseHead

packages/plugins/openapi/src/sdk/split.ts:267–273  ·  view source on GitHub ↗
(structure: SpecStructure)

Source from the content-addressed store, hash-verified

265/** Parse the concatenation of the head ranges into the document head (openapi,
266 * info, servers, tags). Small; safe to materialize whole. */
267export const parseHead = (structure: SpecStructure): Record<string, unknown> => {
268 const text = structure.headRanges.map((r) => structure.text.slice(r.start, r.end)).join("");
269 const parsed = parseYaml(text);
270 return parsed && typeof parsed === "object" && !Array.isArray(parsed)
271 ? (parsed as Record<string, unknown>)
272 : {};
273};
274
275/** Parse the small component subkeys (parameters / requestBodies / responses)
276 * into a `components`-shaped object for `$ref` resolution. */

Calls 1

parseYamlFunction · 0.85

Tested by

no test coverage detected