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

Implement JSON Schema Validation FUNCTION

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

          Activity

            rucha174 Rucha Deodhar added a comment - - edited lstartseva Thanks for the comment. You're right. I've fixed it as part of below patch 1) https://github.com/MariaDB/server/commit/357c208d67fa90b79da013c6cb7fae044af8c1b6 2), 3) and 4): https://github.com/MariaDB/server/commit/0058ac37d31767686cea2816f17b30fe59b6f60d

            Comments on slack.
            After these addressed i'm ok with making the preview out of this.

            holyfoot Alexey Botchkov added a comment - Comments on slack. After these addressed i'm ok with making the preview out of this.
            rucha174 Rucha Deodhar added a comment -

            ( Reassigned after working on review 2 for final check )

            rucha174 Rucha Deodhar added a comment - ( Reassigned after working on review 2 for final check )

            commit 70a7de2aed7677ef9e0a14f5734150cbc58023ae
            comments on slack.
            With at least keyword_map= &empty_map fix i'm ok with the patch to preview.

            holyfoot Alexey Botchkov added a comment - commit 70a7de2aed7677ef9e0a14f5734150cbc58023ae comments on slack. With at least keyword_map= &empty_map fix i'm ok with the patch to preview.

            ok to push

            ramesh Ramesh Sivaraman added a comment - ok to push

            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.