class TestSchema(ApiSchema): email = EmailField(max_length=50) char = StringField(required=True, max_length=100) boolean = BooleanField() class Meta: schema_name = 'asdf'
class PersonSchema(ApiSchema): name = StringField(max_length=100, required=True, nullable=False) email = EmailField(max_length=100, nullable=True) phone = StringField(max_length=10, field_type=FieldTypes.READONLY) address = SchemaField(of_type=AddressSchema, nullable=True) company = SubResourceField(resource_cls=CompanyResource, entity_attribute='name', related_filter='person_name', show_in_list=False) friends = ListSubResourceField(resource_cls=FriendResource, entity_attribute='name', related_filter='friend_name', show_in_list=False) nick_names = ListField(field=StringField()) class Meta: schema_name = 'persons'
class NewSchema(self.TestSchema): new_field = EmailField(max_length=20)
class NameLessSchema(ApiSchema): email = EmailField(max_length=50) char = StringField(required=True, max_length=100) boolean = BooleanField()