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

Function makeMap

src/JSONSchemaInput.ts:300–314  ·  view source on GitHub ↗
(path: Ref, name: string, additional: StringMap)

Source from the content-addressed store, hash-verified

298 }
299
300 function makeMap(path: Ref, name: string, additional: StringMap): TypeRef {
301 let valuesType: TypeRef | undefined = undefined;
302 let mustSet = false;
303 const result = typeBuilder.getLazyMapType(() => {
304 mustSet = true;
305 return valuesType;
306 });
307 setTypeForPath(path, result);
308 path = path.push({ kind: PathElementKind.AdditionalProperty });
309 valuesType = toType(additional, path, pluralize.singular(name), true);
310 if (mustSet) {
311 (result.deref() as MapType).setValues(valuesType);
312 }
313 return result;
314 }
315
316 function fromTypeName(schema: StringMap, path: Ref, inferredName: string, typeName: string): TypeRef {
317 const [name, isInferred] = getName(schema, inferredName, true);

Callers 1

fromTypeNameFunction · 0.85

Calls 4

setTypeForPathFunction · 0.85
toTypeFunction · 0.85
getLazyMapTypeMethod · 0.80
setValuesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…