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.
In my workspace, if I put
$schemato2019-09, and setexclusiveMinimumandexclusiveMaximumwith abooleanis 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-09is going to be accepted, while the first example withdraft-07throws an error as expected:Incorrect type. Expected "number".As I can see in jsonParser.ts is going to accept both
numberandbooleanon2019-09which is incorrect while It is showing an expected error ondraft-09.2019-09 draft specefication mention this: