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

JSON_SCHEMA_VALID function returning wrong result for array of objects

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • None
    • None
    • JSON
    • None
    • Unexpected results

    Description

      JSON_SCHEMA_VALID() is returning incorrect result with JSON having array of objects.

      For this schema

      {
        "type": "object",
        "properties": 
        {
          "id": {
            "type": "string",
            "minLength": 1
          },
          "arr_fields": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "field1": {
                  "type": "string"
                },
                "field2": {
                  "type": "number"
                }
              },
              "required": ["field1"]
            }
          }
        }
      }
      

      and the json value

      {
        "id": "zero",
        "arr_fields": [
          {
            "field1": "A",
            "field2": 123
          },
          {
            "field1": "A"
          }
        ]
      }
      

      JSON_SCHEMA_VALID(@schema, @value) returns false. Where as https://www.jsonschemavalidator.net/ as well as MYSQL return true for the same.

      The testcase is similar to the one from https://jira.mariadb.org/browse/MDEV-38033. However, the field1 value in both the objects is same i.e. "A"

      Attachments

        Issue Links

          Activity

            People

              rucha174 Rucha Deodhar
              bsrikanth Srikanth Bondalapati
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.