Мой пример JSON, который я пытаюсь преобразовать в схему:
{
"nodeID": "5f9f5dbe0c3ab520c2b44bb0",
"type": "block",
"coords": [
517.2814214277396,
769.7697271579176
],
"data": {
"name": "Block",
"color": "standard",
"steps": [
"5f9f5dbe0c3ab520c2b44bb1"
]
}
}
и я преобразовал его в эту схему
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"nodeID": {
"type": "string"
},
"type": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"intent": {
"type": "string"
},
"diagramID": {
"type": "string"
},
"mappings": {
"type": "array",
"items": {}
},
"next": {
"type": "null"
},
"ports": {
"type": "array",
"items": {}
}
},
"required": [
"name",
"intent",
"diagramID",
"mappings",
"next",
"ports"
]
}
},
"required": [
"nodeID",
"type",
"data"
]
}
В примере JSON вы можете увидеть тип = блок. Как в схеме я могу убедиться, что при проверке JSON обязательно проверяется, что ключ типа == block?
Спасибо! :)