Skip to content

Instantly share code, notes, and snippets.

@JamesMessinger
Created July 16, 2015 03:31
Show Gist options
  • Save JamesMessinger/d18278935fc73e3a0ee1 to your computer and use it in GitHub Desktop.
Save JamesMessinger/d18278935fc73e3a0ee1 to your computer and use it in GitHub Desktop.
JSON Schema Circular $Refs
{
"definitions": {
"thing": {
"$ref": "#/definitions/thing" // circular reference to self
},
"person": {
"properties": {
"name": {
"type": "string"
},
"spouse": {
"type": {
"$ref": "#/definitions/person" // circular reference to parent
}
}
}
},
"parent": {
"properties": {
"name": {
"type": "string"
},
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/child" // indirect circular reference
}
}
}
},
"child": {
"properties": {
"name": {
"type": "string"
},
"parents": {
"type": "array",
"items": {
"$ref": "#/definitions/parent" // indirect circular refernece
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment