src/error-handling.js
// Schema must contain an id or $id key to give it a graphQL type name, and top-level schema must be object type
Schema must contain an id or $id key to give it a graphQL type name, and top-level schema must be object type
Schema must contain an id or $id key to give it a graphQL type name and top - level schema must be object type
function validateTopLevelId (typeName, schema) {
  if (!typeName) {
    const err = new Error(`JSON-Schema must have a key 'id' or '$id' to identify the top-level schema`);
    err.subLocation = `JSON schema starting with ${JSON.stringify(schema).substring(0, 25)}...`;
    throw err;
  }
  if (schema.type !== 'object') {
    const err = new Error(`Top-level type must be 'object', not '${schema.type}'`);
    err.subLocation = `JSON schema starting with ${JSON.stringify(schema).substring(0, 25)}...`;
    throw err;
  }
}
function validateTopLevelId ( typeName , schema ) { if ( ! typeName ) { const err = new Error ( ` ` ) ; err . subLocation = ` ${ JSON . stringify ( schema ) . substring ( 0 , 25 ) } ` ; throw err ; } if ( schema . type !== 'object' ) { const err = new Error ( ` ${ schema . type } ` ) ; err . subLocation = ` ${ JSON . stringify ( schema ) . substring ( 0 , 25 ) } ` ; throw err ; } }
Schema must contain an id or $id key to give it a graphQL type name, and top-level schema must be object type
Schema must contain an id or $id key to give it a graphQL type name and top - level schema must be object type