content_image/833335.jpg
• reason : A human-readable string containing the reason for the failure 

• schema-location : A JSON pointer URI fragment identifier indicating where in the JSON schema the validation failed (see Note following this list) 

• document-location : A JSON pointer URI fragment identifier indicating where in the JSON document the validation failed (see Note following this list) 

• schema-failed-keyword : A string containing the name of the keyword or property in the JSON schema that was violated 

<img src='content_image/833335.jpg'>

## Note 

JSON pointer URI fragment identifiers are defined in RFC 6901 - JavaScript Object Notation (JSON) Pointer. (These are not  the same as the JSON path notation used by JSON_EXTRACT()  and other MySQL JSON functions.) In this notation, #  represents the entire document, and #/myprop  represents the portion of the document included in the top-level property named myprop . See the specification just cited and the examples shown later in this section for more information. 

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_VALIDATION_REORT() : 

mysql> SET @schema = ’{ ’> "id": "http://json-schema.org/geo", ’> "$schema": "http://json-schema.org/draft-04/schema#", ’> "description": "A geographical coordinate", ’> "type": "object", ’> "properties": { ’> "latitude": { ’> "type": "number", ’> "minimum": -90, ’> "maximum": 90 ’> }, ’> "longitude": { ’> "type": "number", ’> "minimum": -180, ’> "maximum": 180 ’> } ’> }, ’> "required": ["latitude", "longitude"] ’> }’; Query OK, 0 rows affected (0.01 sec) mysql> SET @document = ’{ ’> "latitude": 63.444697, ’> "longitude": 10.445118 ’> }’; Query OK, 0 rows affected (0.00 sec) mysql> SELECT JSON_SCHEMA_VALIDATION_REPORT(@schema, @document); +---------------------------------------------------+ | JSON_SCHEMA_VALIDATION_REPORT(@schema, @document) | +---------------------------------------------------+ | {"valid": true} | +---------------------------------------------------+ 

