Skip to content

false flag validation error messages for array with allOf #1163

Open
@himanagaudaykiran

Description

@himanagaudaykiran

JSON Schema

{
  "categories": {
    "type": "array",
    "items": {
      "type": "object",
      "allOf": [
        {
          "type": "object",
          "properties": {
            "categoryName": {
              "type": "string"
            },
            "confA": {
              "type": "array",
              "items": {
                "test": {
                  "type": "string"
                }
              }
            }
          },
          "required": [
            "categoryName",
            "confA"
          ]
        },
        {
          "$ref": "#/definitions/Partial<Record<\"confB\"|\"confC\"|\"confD\">>"
        }
      ]
    }
  },
  "Partial<Record<\"confB\"|\"confC\"|\"confD\">>": {
    "type": "object",
    "properties": {
      "confB": {
        "type": "array",
        "items": {
          "test": {
            "type": "string"
          }
        }
      },
      "confC": {
        "type": "array",
        "items": {
          "test": {
            "type": "string"
          }
        }
      },
      "confD": {
        "type": "array",
        "items": {
          "test": {
            "type": "string"
          }
        }
      }
    }
  }
}

JSON Data

{
  "categories": [
    {
      "categoryName": "test",
      "confA": [
        {
          "test": "data"
        }
      ]
    },
    {
      "confB": [
        {
          "test": "dataB"
        }
      ]
    }
  ]
}

when validated with network nt validator given errors:

$.categories[1]: required property 'confA' not found
$.categories[1]: required property 'categoryName' not found

But the json is valid one and also validated against ajv schema validator

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions