MCPcopy Index your code
hub / github.com/glideapps/quicktype / lookupRef

Function lookupRef

src/JSONSchemaInput.ts:240–266  ·  view source on GitHub ↗
(local: StringMap, localPath: Ref, ref: Ref)

Source from the content-addressed store, hash-verified

238 }
239
240 function lookupRef(local: StringMap, localPath: Ref, ref: Ref): [StringMap, Ref] {
241 const first = ref.first();
242 if (first === undefined) {
243 return [local, localPath];
244 }
245 const rest = ref.rest();
246 if (first.kind === PathElementKind.Root) {
247 return lookupRef(root, List([first]), ref.rest());
248 }
249 localPath = localPath.push(first);
250 switch (first.kind) {
251 case PathElementKind.Definition:
252 return lookupRef(lookupDefinition(local, first.name), localPath, rest);
253 case PathElementKind.OneOf:
254 return lookupRef(indexArray(local.oneOf, first.index), localPath, rest);
255 case PathElementKind.AnyOf:
256 return lookupRef(indexArray(local.anyOf, first.index), localPath, rest);
257 case PathElementKind.Property:
258 return lookupRef(lookupProperty(local, first.name), localPath, rest);
259 case PathElementKind.AdditionalProperty:
260 return lookupRef(checkStringMap(local.additionalProperties), localPath, rest);
261 case PathElementKind.Items:
262 return lookupRef(checkStringMap(local.items), localPath, rest);
263 default:
264 return assertNever(first);
265 }
266 }
267
268 function makeClass(
269 schema: StringMap,

Callers 1

convertToTypeFunction · 0.85

Calls 5

checkStringMapFunction · 0.90
assertNeverFunction · 0.90
lookupDefinitionFunction · 0.85
indexArrayFunction · 0.85
lookupPropertyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…