class TagSchema(Schema): id = Integer(dump_only=True) created_at = DateTime(dump_only=True) updated_at = DateTime(dump_only=True) author = Function(lambda o: o.user.username) tag = String(strip=True, validate=Length(max=16))
class PostSchema(Schema): id = Integer(dump_only=True) created_at = DateTime(dump_only=True) updated_at = DateTime(dump_only=True) author = Function(lambda o: o.user.username) title = String(required=True, strip=True, validate=[NotEmpty(), Length(min=1, max=32)]) sub = String(required=True, strip=True, validate=Length(max=128)) content = String(required=True, validate=NotEmpty()) statuses = Nested(StatusSchema, only=('created_at', 'status'), many=True, dump_only=True) comments = Nested(CommentSchema, many=True, dump_only=True) tags = Nested(StatusSchema, only=('tag', ), many=True, dump_only=True)
class SampleSchema(Schema): name = String(validate=NotEmpty())
class TestSchema2(Schema): name = String(strip=True, validate=NotEmpty())
class TestSchema(Schema): name = String()
class TestSchema(Schema): name = String(strip=True)