I have recently discovered the if-then-else keywords that are available in JSON Schema 07.
I'd like to use these keywords to change the type of a property dependent upon the answer of another property.
Essentially I'd like to do:
"if": {
"properties" : {
"QuestionA": {"enum": ["CorrectAnswer"]}
}
},
"then": {
"QuestionB": //Change type of question B from null to string
}
}
The whole point of doing this is so that when a question depends on the answer of a previous question being correct, then that question cannot be answered until the first question is asked correctly.
If I first set the second question's type to null, no answer can be given. Once the first question has been answered, the type of the second question is changed to string and the second question can be answered.
Is this achievable in JSON Schema using if then else?