Skip to content
This repository has been archived by the owner on Jan 28, 2022. It is now read-only.

nesting schema within itself

Sergey Vilgelm edited this page Mar 16, 2020 · 1 revision

To use a self class as a nested object use a text name of a class:

class Person(marshmallow.Model):
    name = marshmallow.fields.String()
    friend = marshmallow.NestedModel("Person")

Person.load({"name": "John Doe", "friend": {"name": "Jane Doe"}})
Clone this wiki locally