module.exports = function isEntitySchema (schema) {
  debug(schema);

  return isSchema(schema, {
    draft: "4-no-id-format",
  }) === true;
};
Beispiel #2
0
module.exports = function schemaHasRef (schema) {
  // ensure schema
  isSchema(schema, { throw: true });

  // if array of items, recurse into items schema
  if (schema.type === 'array' && schema.items) {
    return schemaHasRef(schema.items);
  }
  // if schema composed of many schemas, recurse into each and combine with OR
  if (schema.allOf || schema.anyOf || schema.oneOf) {
    return (schema.allOf || schema.anyOf || schema.oneOf).some(schemaHasRef);
  }

  // if has reference, it is relation!
  if (schema.$ref) {
    return true;
  }
  // must not be relation
  return false;
};
Beispiel #3
0
module.exports = function jsonldContext (schema) {
  // ensure schema
  isSchema(schema, { throw: true });

  return schemaToContext(schema);
};