0
"data": {
"type": "systems",
"attributes": {
"display_name": "Meals",
"is_generic": false,
"interaction_object": "BlahBlah"
},
"relationships": {
"account": {
"data": {
"type": "accounts",
"id": 204
}
},
"venue": {
"data": {
"type": "venues",
"id": 187
}
}
}
}
請幫助。 :)根據物業價值有調理麻煩。 我需要驗證JSON根據簡單的條件:
- 如果
attributes.is_generic === false
>帳戶和地點性能應出現在關係屬性 - 如果
attributes.is_generic === true
>唯一場所應該是事先本
謝謝。
了基本架構準備:
type: 'object',
properties: {
data: {
properties: {
type: { type: 'string' },
attributes: {
properties: {
display_name: { type: 'string' },
is_generic: { type: 'boolean' },
interaction_object: { type: 'string' },
},
required: ['display_name', 'is_generic', 'interaction_object']
},
relationships: {
properties: {
account: {
properties: {
data: {
properties: {
type: { type: 'string' },
id: { type: 'number' },
},
required: [ 'type', 'id'],
}
},
required: ['data'],
},
venue: {
properties: {
data: {
properties: {
type: { type: 'string' },
id: { type: 'number' },
},
required: [ 'type', 'id'],
}
},
required: ['data'],
},
},
required: ['venue', 'account']
}
},
required: ['attributes', 'relationships']
}
},
required: ['data'],
additionalProperties: false,
謝謝大家幫忙