Skip to content

[json] support JSON schema draft-06 #29152

Closed
@itowlson

Description

@itowlson

JSON Schema draft-06 includes a const keyword to indicate that a property must be a specific value (http://json-schema.org/latest/json-schema-validation.html#rfc.section.6.24). VS Code does not report a problem if the property does not match the value. (It does work if you use an enum with a single value.)


Steps to Reproduce:

  1. See sample repo https://github.com/itowlson/vscode-json-schema-test and load the extension. Note the contents of schema/foo.schema.json.

  2. Run this extension in the Extension Development Host (or create a new extension and add the jsonValidation section and foo.schema.json file from the sample repo).

  3. In the Extension Development Host, open the file test/test.foo.json.

  4. View the "apiVersion" element. Expected: A warning squiggly, and hover message along the lines of "Value is not accepted. Valid value: ''2017-01-01.1.0'" (basing this on the enum message - I'm sure you can word it better). Actual: no warning.

(The "apiVersionWorkaround" element works correctly - I included it only so you could compare the const behaviour to the single-value enum behaviour.)


  • VSCode Version: Code 1.13.1 (379d2ef, 2017-06-14T18:21:47.485Z)
  • OS Version: Windows_NT ia32 10.0.14393
  • Extensions:
Extension Author Version
jshint dbaeumer 0.10.15
vscode-eslint dbaeumer 1.2.11
mdhelper joshbax 0.0.9

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalityjsonJSON support issuesverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions