Per this question jsonschema attribute conditionally required, I can apply conditional required properties. However, it can only depend on the properties on the same level of object. In certain case, I want to one property required depend on its parent object property, is it possible? For the below example:
{
type: 'object',
properties: {
{
os: { type: 'string', enum: ['macOs', 'windows'] },
specs: {
macModel: {
type: 'string',
enum: ['macbook air', 'macbook pro', 'macbook']
},
memory: { type: 'number' }
}
}
}
}
Is it possible to meet this requirement: /spec/macModel is required only when /os equals to macOs?