Is it a valid json schema:
object:
$ref: '#/definitions/object'
Would you recommend to use such format?
Is it a valid json schema:
object:
$ref: '#/definitions/object'
Would you recommend to use such format?
Self references are allowed and useful. However, your example looks like it would just be a referential infinite loop. Here is an example of a JSON Schema that uses recursive references to define a tree structure of unlimited depth.
{
"type": "object",
"properties": {
"name": { "type": "string" },
"tree": { "$ref": "#/definitions/tree" }
},
"definitions": {
"tree": {
"type": "object",
"properties": {
"value": { "type": "string" },
"branches": {
"type": "array",
"items": { "$ref": "#/definitions/tree" },
"minItems": 1
}
},
"required": ["value"]
}
}
}