I have a JSON response that I'm trying to create JSONSchema for
{
"gauges": {
"foo": {
"value": 1234
},
"bar": {
"value": 12.44
}
}
}
It is important to know that objects in an associative array are gaugesdynamically generated, so for many there may be zero. Each object in gaugeswill always have a property valueand will always be a number.
So each one is valid
Example 1
{
"gauges": {
"foo": {
"value": 1234
}
}
}
Example 2
{
"gauges": {
"dave": {
"value": 0.44
},
"tommy": {
"value": 12
},
"steve": {
"value": 99999
}
}
}
Example 3
{
"gauges": {}
}
I looked at the specification, and if it was an array, I know what I can use anyOf, but I'm not sure how to do it or if it is possible.
NB I can not change the JSON format
source
share