"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
}
}
}
}
}
Please help. :) have troubles with conditioning according to property value. I need to validate JSON according to simple condition:
- if
attributes.is_generic === false
> account and venue properties should be present in relationship property - if
attributes.is_generic === true
> only venue should be present
Thank in advance.
got basic schema ready:
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,
thank you for help