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

JSON_SCHEMA_VALID function returning wrong result

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 12.1.1
    • None
    • JSON
    • 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": "B"
          }
        ]
      }
      

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

      Attachments

        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.