Details
-
Type:
Task
-
Status: In Progress (View Workflow)
-
Priority:
Critical
-
Resolution: Unresolved
-
Fix Version/s: 10.10
-
Component/s: JSON
-
Labels:
Description
A great addition to MariaDB would be able to validate JSON schemas. MySQL already have this implemented as follows:
JSON_SCHEMA_VALID(schema,document)
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).
https://dev.mysql.com/doc/refman/8.0/en/json-validation-functions.html#function_json-schema-valid
Since MariaDB is great and it allows the use of UDFs and deterministic functions on constraints something like this would be awesome:
CREATE TABLE t1 (a JSON CHECK JSON_SCHEMA_VALID(schema, a)); |
or
CREATE TABLE t1 ( |
a JSON,
|
CONSTRAINT json_validation CHECK JSON_SCHEMA_VALID(schema, a) |
);
|
The word schema should be replaced by a string representing a valid JSON schema.
Attachments
Issue Links
- duplicates
-
MDEV-25934 JSON-Schema as Contraint on JSON-column
-
- Closed
-
- relates to
-
MDEV-17397 Implement JSON functions available in MySQL 8.0 but not MariaDB
-
- Open
-