Within my platform, there is an amusing scenario that I find to be the most effective. I am currently attempting to validate a JSON Schema where an object contains unknown keys with a consistent schema as their values. Each key represents a unique ID and holds data structured in the same way.
To illustrate this concept, consider the following sample code:
let survey_questions = {
"vv4sD32": {
question: "Do you like dogs?",
answers: ["Yes", "No"]
},
"df4sdIU": {
question: "How about cats?",
answers: ["Maybe", "Maybe not"]
},
"cbkle12": {
question: "What do you prefer most?",
answers: ["Dogs", "Cats"]
}
}
In this example, the data represents a survey where each unique key corresponds to a question ID and its value conforms to a specific schema. While I could individually check each question's schema by looping through them, I have encountered nested scenarios of similar structure which could complicate the process. Do you have any suggestions on how to achieve this validation using AJV or another library?
Thank you,
Carlino