我有一个
JSON模式
{
'description': 'TPNode','type': 'object','id': 'tp_node','properties': {
'selector': {
'type': 'string','required': true
},'attributes': {
'type': 'array','items': {
'name': 'string','value': 'string'
}
},'children': {
'type': 'array','items': {
'type': 'object','$ref': '#'
}
},'events': {
'type': 'array','items': {
'type': 'object','properties': {
'type': {
'type': 'string'
},'handler': {
'type': 'object'
},'dependencies': {
'type': 'array','items': {
'type': 'string'
}
}
}
}
}
}
}
我想在children属性中表达的是它是一组具有相同精确模式的对象.这是正确的方式来形容吗?
解决方法
使用您需要引用的模式的id
'$ref': 'tp_node'
看这里:
http://json-schema.org/latest/json-schema-core.html#anchor30