-
Notifications
You must be signed in to change notification settings - Fork 332
Closed
Description
Let's say we have a schema like this one:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://example.com/product.schema.json",
"title": "",
"description": "",
"type": "object",
"properties": {
"mainprop": {
"type": "object",
"oneOf": [
{
"required": [
"property1"
],
"properties": {
"property1": {
"enum": [
"AAA",
"BBB",
"CCC"
],
"type": "string"
}
}
},
{
"required": [
"property2"
],
"properties": {
"property2": {
"type": "number"
}
}
}
]
}
},
"required": [ "mainprop" ]
}So we have one oneOf property that requires either property1 or property2.
{
"mainprop": {
"property1": "INVALID"
}
}This json is incorrect and the validator should return error that the value of property1 is incorrect, but in addition to that it returns an error that property2 is required and missing:
$.mainprop.property1: does not have a value in the enumeration [AAA, BBB, CCC]
$.mainprop.property2: is missing but it is required
It's not correct, because property1 is already present, just incorrect. So the error that property2 is required is unnecessary/incorrect.
I have a fix for that, just have to submit a PR
stevehu and AndreasALoew
Metadata
Metadata
Assignees
Labels
No labels