JSON Schema validation - possible to only validate .json files in a dir, not subdir?

I have a repo layout with a directory of json files, and a custom JSON Schema in a subdir which I would like to use to validate them:

- config\file1.json
- config\file2.json
- config\schema\myConfigSchema.json

I cannot find a way to configure the JSON Schema Mappings to validate file1.json & file2.json, without it also attempting to validate myConfigSchema.json as it's own custom format (not as JSON schema format)

Using either of:

  • a "File path pattern" of `config\*.json`
  • a  "Directory" of `config`

both result in unwanted validation of `myConfigSchema.json` as it's own format, and it being annotated with many errors.

If an extra mapping is added of `config\schema\myConfigSchema.json` as "JSON schema v6"; an error is given "There are several JSON schemas mapped to this file"

Is this a bug/limitation, or is there some way to workaround?

3 comments
Comment actions Permalink

forgot to mention, I'm using:

WebStorm 2018.3
Build #WS-183.4284.130, built on November 19, 2018
Windows 10

0
Comment actions Permalink

You can use "File", like:

This, of course, would require adding all .json files explicitly...

In the next update, where https://youtrack.jetbrains.com/issue/WEB-35493 is fixed, you won't have such issues, as schema with"$schema" property won't be mapped to itself

0
Comment actions Permalink

Unfortunately we have many files, and more get created, so listing them individually isn't practical.

Good to hear it already has a fix, and we'll wait for the update.

 

Thanks for your help

0

Please sign in to leave a comment.