Python marshmallow: how to allow multiple Schemas to a Schema's field?

Viewed 3226

I'd like to declare a schema field to accept different schema types, but not any.

Is something like the following possible with Marshmallow?

class SchemaA(Schema):
    name = String()

class SchemaB(Schema):
    name = String()
    age = Integer()

class SchemaC(Schema)
    one_of_many_but_not_any = [SchemaA(), SchemaB(), String()]  # <- !
1 Answers
Related