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

Function convertOneOrAnyOf

src/JSONSchemaInput.ts:378–387  ·  view source on GitHub ↗
(cases: any, kind: PathElementKind.OneOf | PathElementKind.AnyOf)

Source from the content-addressed store, hash-verified

376 [name, isInferred] = getName(schema, name, isInferred);
377
378 function convertOneOrAnyOf(cases: any, kind: PathElementKind.OneOf | PathElementKind.AnyOf): TypeRef {
379 if (!Array.isArray(cases)) {
380 return panic(`oneOf or anyOf is not an array: ${cases}`);
381 }
382 // FIXME: This cast shouldn't be necessary, but TypeScript forces our hand.
383 const types = cases.map((t, index) =>
384 toType(checkStringMap(t), path.push({ kind, index } as any), name, isInferred)
385 );
386 return unifyTypes(types, name, isInferred);
387 }
388
389 if (schema.$ref !== undefined) {
390 const [ref, refName] = parseRef(schema.$ref);

Callers 1

convertToTypeFunction · 0.85

Calls 5

panicFunction · 0.90
checkStringMapFunction · 0.90
toTypeFunction · 0.85
unifyTypesFunction · 0.85
mapMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…