{
type: 'object',
properties: {
name: {type: 'string'},
children: {type: 'array', optional: true, items: {'$ref': '#'}}
}
}
"#" is the fragment tag in a URI, which (on it's own) indicates the
root element of the URI.
You can also reference sub elements. For example, to reference
"children", you would use a relative URI of "#/properties/children".
You can also use named references by adding "id" attributes to your
schemas. So, for example, with the following schema:
{
id : '#root'
type: 'object',
properties: {
name: {id: '#name', type: 'string'},
children: {id: '#children', type: 'array', optional: true, items:
{'$ref' : '#root'}}
}
}
You can now reference children with the URI "#children", or name with "#name".
-Gary
> --
> You received this message because you are subscribed to the Google Groups "JSON Schema" group.
> To post to this group, send email to json-...@googlegroups.com.
> To unsubscribe from this group, send email to json-schema...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/json-schema?hl=en.
>
>