-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[json] support JSON schema draft-06 #29152
Labels
feature-request
Request for new features or functionality
json
JSON support issues
verification-needed
Verification of issue is requested
verified
Verification succeeded
Milestone
Comments
aeschli
changed the title
JSON validation does not validate const keyword
[json] support const keyword
Jun 21, 2017
aeschli
added
json
JSON support issues
feature-request
Request for new features or functionality
labels
Jun 21, 2017
aeschli
changed the title
[json] support const keyword
[json] support JSON schema draft-06
Oct 12, 2017
aeschli
added a commit
to microsoft/vscode-json-languageservice
that referenced
this issue
Oct 13, 2017
aeschli
added a commit
to microsoft/vscode-json-languageservice
that referenced
this issue
Oct 13, 2017
aeschli
added a commit
to microsoft/vscode-json-languageservice
that referenced
this issue
Oct 13, 2017
aeschli
added a commit
to microsoft/vscode-json-languageservice
that referenced
this issue
Oct 13, 2017
To verify: See http://json-schema.org/draft-06/json-schema-migration-faq.html for additions & changes:
draf06test.schema.json {
"$schema": "http://json-schema.org/draft-06/schema",
"type": "object",
"properties": {
"n": {
"type": "number",
"exclusiveMinimum": 5,
"exclusiveMaximum": 7
},
"p": {
"type": "object",
"propertyNames": {
"pattern": "[1-9]"
}
},
"a": {
"type": "array",
"contains": {
"type": "boolean"
}
},
"foo": {
"type": "string",
"const": "bar",
"description": "It can only be bar"
}
}
} draft06test.json {
"$schema": "./draft06test.schema.json",
"n": 5,
"p": {
"1": true,
"f": false
},
"a": [ 1, 2],
"foo": "bar"
} |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
feature-request
Request for new features or functionality
json
JSON support issues
verification-needed
Verification of issue is requested
verified
Verification succeeded
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 anenum
with a single value.)Steps to Reproduce:
See sample repo https://github.com/itowlson/vscode-json-schema-test and load the extension. Note the contents of schema/foo.schema.json.
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).
In the Extension Development Host, open the file test/test.foo.json.
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.)
The text was updated successfully, but these errors were encountered: