-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Support recursive type definition (e.g. an item class has a field of its same type) by implementing $refs support, and use $refs as well when a given type is used more than once in the schema.
For example, given:
@dataclass
class Node:
parent: Node | None
children: list[Node] | None
Be able to get a JSON Schema like:
{
"$defs": {
"Node": {
"type": "object",
"properties": {
"parent": {
"anyOf": [
{"type": "null"},
{"$ref": "#/$defs/Node"}
]
},
"children": {
"anyOf": [
{"type": "null"},
{
"type": "array",
"items": {"$ref": "#/$defs/Node"},
}
]
}
}
},
},
"$ref": "#/$defs/Node"
}
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request