forked from jc-turn/shapeshifter
-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Currently, shapeshifter generates flattened schemas which cannot define anything with a self reference (such as a tree structure, where a "Branch" may contain other "Branch" objects as well as "Leaf" objects).
However, JSON Schema allows for self referencing schemas via "$ref" property:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Tree",
"oneOf": [ {
"$ref": "#/definitions/Leaf"
}, {
"$ref": "#/definitions/Branch"
}
],
"definitions": {
"Leaf": {
"title": "Leaf",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string"
}
},
"required": [ "name" ]
},
"Branch": {
"title": "Branch",
"type": "object",
"additionalProperties": false,
"properties": {
"name": { "type": "string" },
"nodes": {
"type": "array",
"items": {
"oneOf": [ {
"$ref": "#/definitions/Leaf"
}, {
"$ref": "#/definitions/Branch"
}
]
}
}
},
"required": [ "name" ]
}
}
}It would be nice if we could somehow tell shapeshifter to generate reference-based schemas instead of flattened schemas in order to accommodate such structures.
Metadata
Metadata
Assignees
Labels
No labels