Going by the json schema definition json schema definition,
I have been using the jsonschema
python module for validation.
You can specify that an object contain an array of objects of animals for example,
{ 'type':'object',
"properties":{
'pets_list':{
"type":"array",
'items':{
'type':'object',
'properties':{
'name':{"type":"string"},
'mass':{"type":"number"},
'type':{"type":"string"},
}
}
}
}
}
An Example Payload would be
{ 'pets_list':[{'name':'Charles',
'mass':5,
'type':'house mouse' },
{'name':'Garfield',
'mass':30,
'type':'house cat'},
]
}
But what if I wanted to specify what those objects looked like in a slightly different keyed format.
{ 'pets_list':{
'a7e8ad9':{'name':'Charles',
'mass':5,
'type':'house mouse' },
'0a8d938':{'name':'Garfield',
'mass':30,
'type':'house cat'},
}
}
I can't find any way in the spec to do this, since you do not know keys like 'a7e8ad9' in advance.