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

Incorrect result of JSON_SCHEMA_VALID

    XMLWordPrintable

Details

    Description

      Hi,

      I found JSON_SCHEMA_VALID returns an incorrect result for objects validated through additionalProperties or unevaluatedProperties, compared with an equivalent explicit schema.

      This test case can reproduce this:

      SET @obj_value = '{"outer":{"x":"ok"}}';
      SET @obj_schema_ref = '{"type":"object","properties":{"outer":{"type":"object","properties":{"x":{"type":"string"}},"required":["x"]}},"required":["outer"]}';
      SET @schema_additional = '{"type":"object","additionalProperties":{"type":"object","properties":{"x":{"type":"string"}},"required":["x"]}}';
      SET @schema_uneval_props = '{"type":"object","unevaluatedProperties":{"type":"object","properties":{"x":{"type":"string"}},"required":["x"]}}';
       
      SELECT JSON_SCHEMA_VALID(@schema_additional, @obj_value) AS observed,
             JSON_SCHEMA_VALID(@obj_schema_ref, @obj_value) AS reference_result; -- 0, 1
       
      SELECT JSON_SCHEMA_VALID(@schema_uneval_props, @obj_value) AS observed,
             JSON_SCHEMA_VALID(@obj_schema_ref, @obj_value) AS reference_result; -- 0, 1
      

      I can reproduce this with the commit version f6e44c1b7819f9befa3824f07866822288231528 of MariaDB server on github repo.

      Attachments

        Activity

          People

            rucha174 Rucha Deodhar
            ChiZhang Chi Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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