function findRefs()

in tools/src/cycleCheck.ts [18:33]


function findRefs(schema: any, root: SchemaRefNode) {
  if (Array.isArray(schema)) {
    for (const entry of schema) {
      findRefs(entry, root);
    }
  } else if (typeof schema === 'object') {
    for (const key of Object.keys(schema)) {
      findRefs(schema[key], root);
    }

    const foundRef = schema['$ref'];
    if (foundRef && foundRef.indexOf('#/') === 0) {
      root.children[foundRef] = new SchemaRefNode();
    }
  }
}