JSON Schema Validation Functions +---------+---------+---------+------+-------+ The source document contains an array of two elements; each of these elements produces two rows. The values of  apath  and  bpath  are the same over the entire result set; this means that they cannot be used to determine whether  lpath  values came from the same or different parents. The value of the ord  column remains the same as the set of records having  top_ord  equal to 1, so these two values are from a single object. The remaining two values are from different objects, since they have different values in the  ord  column. Beginning with MySQL 8.0.17, MySQL supports validation of JSON documents against JSON schemas conforming to Draft 4 of the JSON Schema specification. This can be done using either of the functions detailed in this section, both of which take two arguments, a JSON schema, and a JSON document which is validated against the schema.  JSON_SCHEMA_VALID()  returns true if the document validates against the schema, and false if it does not;  JSON_SCHEMA_VALIDATION_REPORT()  provides a report in JSON format on the validation. Both functions handle null or invalid input as follows: MySQL supports the  required  attribute in JSON schemas to enforce the inclusion of required properties (see the examples in the function descriptions). MySQL supports the  id ,  $schema ,  description , and  type  attributes in JSON schemas but does not require any of these. MySQL does not support external resources in JSON schemas; using the  $ref  keyword causes JSON_SCHEMA_VALID()  to fail with  ER_NOT_SUPPORTED_YET . MySQL supports regular expression patterns in JSON schema, which supports but silently ignores invalid patterns (see the description of  JSON_SCHEMA_VALID()  for an example). These functions are described in detail in the following list: Validates a JSON  document  against a JSON  schema . Both  schema  and  document  are required. The schema must be a valid JSON object; the document must be a valid JSON document. Provided that these conditions are met: If the document validates against the schema, the function returns true (1); otherwise, it returns false (0). In this example, we set a user variable  @schema  to the value of a a JSON schema for geographical coordinates, and another one  @document  to the value of a JSON document containing one such coordinate. We then verify that  @document  validates according to  @schema  by using them as the arguments to  JSON_SCHEMA_VALID() : 2381 mysql>  SET @schema = ’{ ’> "id": "http://json-schema.org/geo", ’>  "$schema": "http://json-schema.org/draft-04/schema#", • JSON_SCHEMA_VALID( schema , document ) •In addition, if the schema is not a valid JSON object, the function returns  ER_INVALID_JSON_TYPE . •If at least one of the arguments is not valid JSON, the function raises an error ( ER_INVALID_TYPE_FOR_JSON ) •If at least one of the arguments is  NULL , the function returns  NULL . 12.18.7 JSON Schema Validation Functions Note