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

Function parseEntry

packages/plugins/openapi/src/sdk/split.ts:253–263  ·  view source on GitHub ↗
(
  text: string,
  range: ByteRange,
  indent: number,
)

Source from the content-addressed store, hash-verified

251 * parsed body, or null when the fragment does not parse to a single-key map.
252 */
253export const parseEntry = (
254 text: string,
255 range: ByteRange,
256 indent: number,
257): readonly [string, unknown] | null => {
258 const parsed = parseYaml(dedent(text.slice(range.start, range.end), indent));
259 if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
260 const entries = Object.entries(parsed as Record<string, unknown>);
261 if (entries.length !== 1) return null;
262 return entries[0]!;
263};
264
265/** Parse the concatenation of the head ranges into the document head (openapi,
266 * info, servers, tags). Small; safe to materialize whole. */

Callers 8

streamSelectedScopesFunction · 0.90
keptPathItemFunction · 0.90
buildDefsJsonStreamingFunction · 0.90
keptIdentityFixturePathsFunction · 0.85
keptOperationIdsFunction · 0.85
keptPathItemFunction · 0.85
collectReferencedSchemasFunction · 0.85

Calls 2

parseYamlFunction · 0.85
dedentFunction · 0.70

Tested by 4

keptIdentityFixturePathsFunction · 0.68
keptOperationIdsFunction · 0.68
keptPathItemFunction · 0.68