Skip to content

strictKeywords true causes array items false schema to incorrectly validate non-empty array #1270

@mfulton26

Description

@mfulton26

What version of Ajv are you using? Does the issue happen if you use the latest version?

6.12.4 (latest)

Ajv options object

{ strictKeywords: true }

JSON Schema

{ "type": "array", "items": false }

Sample data

[1]

Your code

const Ajv = require("ajv");

const ajv = new Ajv({ strictKeywords: true });

ajv.validate({ type: "array", items: false }, [1]);

console.log(ajv.errors);

Validation result, data AFTER validation, error messages

null

What results did you expect?

same validation error as when strictKeywords is false or "log"

[
  {
    "keyword": "false schema",
    "dataPath": "[0]",
    "schemaPath": "#/items/false schema",
    "params": {},
    "message": "boolean schema is false"
  }
]

Are you going to resolve the issue?

Am I going to submit a PR? Not planning on it. Am I good with closing the issue after feedback? Yes.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions