Skip to content

json-schema-validator/no-invalid

validate object with JSON Schema.

  • ⚙️ This rule is included in "plugin:json-schema-validator/recommended".

📖 Rule Details

This rule validates the file with JSON Schema and reports errors.

🔧 Options

  • schemas ... Define an array of any JSON Schema.
    • fileMatch ... A list of known file names (or globs) that match the schema.
    • schema ... An object that defines a JSON schema. Or the path of the JSON schema file or URL.
  • useSchemastoreCatalog ... If true, it will automatically configure some schemas defined in https://www.schemastore.org/api/json/catalog.json. Default true
  • mergeSchemas ... If true, it will merge all schemas defined in schemas, at the $schema field within files, and the catalogue. If an array is given, it will merge only schemas from the given sources. Default false

This option can also be given a JSON schema file or URL. This is useful for configuring with the /* eslint */ directive comments.

Use with .vue

This rule supports .vue custom blocks.

Example:

You must also install eslint-plugin-vue to enable .vue files validation. See here for details.

To match a custom block, use a glob like this:

The following custom blocks will try to test if it matches with the virtual filenames.

📚 Further reading

🚀 Version

This rule was introduced in eslint-plugin-json-schema-validator v0.1.0

🔍 Implementation