-
-
Notifications
You must be signed in to change notification settings - Fork 313
Validation meta-schema: Implement "exclusiveMaximum"/"exclusiveMinimum" changes #185
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,22 +46,19 @@ | |
"default": {}, | ||
"multipleOf": { | ||
"type": "number", | ||
"minimum": 0, | ||
"exclusiveMinimum": true | ||
"exclusiveMinimum": 0 | ||
}, | ||
"maximum": { | ||
"type": "number" | ||
}, | ||
"exclusiveMaximum": { | ||
"type": "boolean", | ||
"default": false | ||
"type": ["number", "boolean"] | ||
}, | ||
"minimum": { | ||
"type": "number" | ||
}, | ||
"exclusiveMinimum": { | ||
"type": "boolean", | ||
"default": false | ||
"type": ["number", "boolean"] | ||
}, | ||
"maxLength": { "$ref": "#/definitions/positiveInteger" }, | ||
"minLength": { "$ref": "#/definitions/positiveIntegerDefault0" }, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as previous. |
||
|
@@ -147,9 +144,5 @@ | |
"oneOf": { "$ref": "#/definitions/schemaArray" }, | ||
"not": { "$ref": "#" } | ||
}, | ||
"dependencies": { | ||
"exclusiveMaximum": [ "maximum" ], | ||
"exclusiveMinimum": [ "minimum" ] | ||
}, | ||
"default": {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It could be: "dependencies": {
"exclusiveMaximum": {
"anyOf": [
{
"properties": {
"exclusiveMaximum": { "type": "number" },
"maximum": false
}
},
{
"properties": {
"exclusiveMaximum": { "type": "boolean" },
"maximum": true
}
}
]
}
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And with if/the/else it would look more elegant :) "dependencies": {
"exclusiveMaximum": {
"if": { "properties": { "exclusiveMaximum": { "type": "boolean" } } },
"then": { "required": ["maximum"] },
"else": { "not": { "required": ["maximum"] } }
}
} the else branch requires that "maximum" keyword is absent when "exclusiveMaximum" is present, which can be dropped as a requirement - maybe having them both is ok. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I gotta say, these solutions make me feel a lot better about pushing this forward, and how well JSON Schema is designed in general. |
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has this been removed? It's in the spec document.