Пример #1
0
class PetOwnerSchema(BaseSchema):
    """Example PetOwner schema, with different polymorphic fields."""
    auto_pets = TryFrom([CatSchema, DogSchema], many=True)
    by_attribute_pets = ByAttribute(
        {
            'fur_density': CatSchema,
            'barking_power': DogSchema
        }, many=True)
    by_type_contact = ByType([fields.Email(), fields.Url()])
Пример #2
0
class PersonSchema(BaseSchema):
    """Example Person schema."""
    name = fields.String(required=True)
    birth_date = fields.Date()
    email = fields.Email()