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

Function indexSchemas

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

Source from the content-addressed store, hash-verified

308 * key, which matches the trailing segment of a `#/components/schemas/<name>`
309 * reference. */
310export const indexSchemas = (structure: SpecStructure): ReadonlyMap<string, ByteRange> => {
311 const index = new Map<string, ByteRange>();
312 for (const range of structure.schemas) {
313 const line = lineAt(structure.text, range.start, range.end);
314 if (!line) continue;
315 const name = keyNameAt(structure.text, range.start, line.lineEnd);
316 if (name) index.set(name, range);
317 }
318 return index;
319};
320
321/** Decode a `#/components/schemas/<segment>` name segment. Schema names are raw
322 * YAML keys, so only JSON-pointer tilde escaping can appear (no `%`-encoding

Callers

nothing calls this directly

Calls 3

lineAtFunction · 0.85
keyNameAtFunction · 0.85
setMethod · 0.80

Tested by

no test coverage detected