Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-27128

Implement JSON Schema Validation FUNCTION

    XMLWordPrintable

Details

    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

          There are no Sub-Tasks for this issue.

          Activity

            People

              rucha174 Rucha Deodhar
              rubenferreira7575 Rúben Ferreira
              Votes:
              4 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.