microsoft / microsoft/vscode-json-languageservice
draft/2019-09: exclusiveMinimum and exclusiveMaximum must be numbers
@aeschli is already working on this.
Since Aug 26, 2020.
- Dominant language
- TypeScript
- Stars
- 326
- Forks
- 145
- Avg merge
- 22h 10m
- Merged PRs (30d)
- 9
Description
In my workspace, if I put $schema to 2019-09, and set exclusiveMinimum and exclusiveMaximum with a boolean is not throwing any error.
Considering these two examples:
A JSON Schema based on draft-07
{
"$id": "https://example.com/my-schema",
"$schema": "https://json-schema.org/draft-07/schema",
"properties": {
"test": {
"type": "number",
"minimum": 0,
"exclusiveMinimum": true,
"maximum": 100,
"exclusiveMaximum": true
}
}
}
And a JSON Schema based on lastest version draft 2019-09
{
"$id": "https://example.com/my-schema",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"properties": {
"test": {
"type": "number",
"minimum": 0,
"exclusiveMinimum": true,
"maximum": 100,
"exclusiveMaximum": true
}
}
}
The example with draft 2019-09 is going to be accepted, while the first example with draft-07 throws an error as expected:
Incorrect type. Expected "number".
As I can see in jsonParser.ts is going to accept both number and boolean on 2019-09 which is incorrect while It is showing an expected error on draft-09.
2019-09 draft specefication mention this:
6.2.3. exclusiveMaximum
The value of "exclusiveMaximum" MUST be number, representing an exclusive upper limit for a numeric instance.
6.2.5. exclusiveMinimum
The value of "exclusiveMinimum" MUST be number, representing an exclusive lower limit for a numeric instance.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.