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

Function toType

src/JSONSchemaInput.ts:412–423  ·  view source on GitHub ↗
(schema: StringMap, path: Ref, name: string, isInferred: boolean)

Source from the content-addressed store, hash-verified

410 }
411
412 function toType(schema: StringMap, path: Ref, name: string, isInferred: boolean): TypeRef {
413 // FIXME: This fromJS thing is ugly and inefficient. Schemas aren't
414 // big, so it most likely doesn't matter.
415 const immutablePath = makeImmutablePath(path);
416 const maybeType = typeForPath.get(immutablePath);
417 if (maybeType !== undefined) {
418 return maybeType;
419 }
420 const result = convertToType(schema, path, name, isInferred);
421 setTypeForPath(immutablePath, result);
422 return result;
423 }
424
425 const rootPathElement: PathElement = { kind: PathElementKind.Root };
426 const rootType = toType(root, List<PathElement>([rootPathElement]), topLevelName, false);

Callers 6

makeClassFunction · 0.85
makeMapFunction · 0.85
fromTypeNameFunction · 0.85
convertOneOrAnyOfFunction · 0.85
convertToTypeFunction · 0.85
schemaToTypeFunction · 0.85

Calls 3

makeImmutablePathFunction · 0.85
convertToTypeFunction · 0.85
setTypeForPathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…