nickcmaynard / jsonschemalint

JSON Schema Lint. Like you I'm busy, so pull requests will get merged quicker than feature requests are implemented.
https://jsonschemalint.com
MIT License
80 stars 31 forks source link

Cannot validate array elements on indexes > 0 #66

Closed neilyoung closed 3 years ago

neilyoung commented 3 years ago

Hi,

This is most likely my stupidity, but I can't validate my JSON against this schema:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "points": {
      "type": "array",
      "items": [
        {
          "type": "array",
          "items": [
            {
              "type": "array",
              "items": [
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 640,
                  "default": 0
                },
                {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 480,
                  "default": 0
                }
              ],
              "minItems": 2,
              "maxItems": 2
            }
          ],
          "minItems": 3
        }
      ],
      "minItems": 3,
      "maxItems": 3
    }
  },
  "required": ["points"],
  "additionalParameters": "false"
}

Now I'm wondering, why this is considered as valid:

{
    "points": [
        [
            [0, 1],
            [1, 2],
            [3, 4]
        ],
        [

        ],
        [
            [0, 1],
            [1, 2],
            [3, 4],
            [5, 6],
            [7, 8]
        ]
    ]
}

The validation detects

But it does detect it for points[0] only. Any invalid change in the other elements remains undiscovered. What is wrong with the schema?

TIA

neilyoung commented 3 years ago

Disregard. My bad