Open
Description
The lesson on Ensuring Mutual Dependency does not include a test case that clearly shows the difference between mutual dependency
and just using the required
keyword.
The main difference is that with mutual dependency
, a JSON document is still valid if it does not include either of the two related properties. But if instead required
is used on the two properties, the document would be invalid.
As a result, the following schema passes the lesson, even though it shouldn't:
{
"type": "object",
"properties": {
"name": {
"type": "string"
},
"creditCardNumber": {
"type": "string"
},
"address": {
"type": "string"
}
},
"required": [
"name",
"creditCardNumber",
"address"
]
}
The following test case should fix this issue
{
"name": "John Doe"
}
This should be valid with mutual dependency
but would fail if required
was used.
I would like to be assigned to this issue
Metadata
Metadata
Assignees
Labels
No labels