Question: How to define self referential schemas
alisaifee opened this issue · comments
Ali-Akber Saifee commented
I have a schema that references itself in a property, and couldn't figure out a way to declare this.
For example:
person = Schema({
"first_name": str,
"last_name": str,
"age": int,
"children": [person]
}, name="person")
Liam commented
hey, we did self-referential schemas this way:
person_defn = dict()
person_defn.update(
{
"first_name": str,
"last_name": str,
"age": int,
"children": [person_defn]
}
)
person = Schema(person_defn)