class AlumnoSchema(Schema): cuenta = Integer(required=True, validate=Range(min=1000000, max=9999999)) nombre = String(required=True, validate=Length(min=2, max=50)) primer_apellido = String(required=True, validate=Length(min=2, max=50)) segundo_apellido = String(required=False, validate=Length(min=2, max=50)) carrera = String(required=True, validate=OneOf(carreras)) semestre = Integer(required=True, validate=Range(min=1, max=50)) promedio = Float(required=True, validate=Range(min=1, max=10)) al_corriente = Boolean(required=True)
class PostOutSchema(Schema): id = Integer() title = String() content = String() coins = Integer() private = Boolean() author = Nested(PublicUserOutSchema) comments = List(Nested(CommentOutSchema, exclude=("post", ))) columns = List(Nested(ColumnOutSchema, exclude=("posts", "author"))) self = ma.URLFor(".post", values=dict(post_id="<id>"))
class PrivateUserOutSchema(Schema): id = Integer() username = String() name = String() coins = Float() experience = Integer() location = String() about_me = String() confirmed = Boolean() blocked = Boolean() member_since = DateTime() last_seen = DateTime() self = ma.URLFor(".user", values=dict(user_id="<id>"))
class CommentOutSchema(Schema): id = Integer() body = String() author = Nested(PublicUserOutSchema) post = Nested(lambda: PostOutSchema(only=( "id", "title", "self", ))) replying = Nested(lambda: CommentOutSchema(exclude=("replying", ))) self = ma.URLFor(".comment", values=dict(comment_id="<id>"))
class PetSchema(Schema): name = String(required=True) age = Integer(default=123)
class PetQuerySchema(Schema): page = Integer(missing=1) per_page = Integer(missing=20, validate=Range(max=30))
class ColumnOutSchema(Schema): id = Integer() name = String() author = Nested(PublicUserOutSchema) posts = List(Nested(lambda: PostOutSchema(only=("id", "title", "self")))) self = ma.URLFor(".column", values=dict(column_id="<id>"))
class Schema(BaseSchema): id = Integer()
class FooSchema(Schema): class Meta: unknown = EXCLUDE id = Integer(default=123) name = String(required=True)
class QuerySchema(Schema): class Meta: unknown = EXCLUDE id = Integer(missing=1)
class GroupInSchema(Schema): name = String(required=True) members = List(Integer()) private = Boolean()
class NotificationOutSchema(Schema): id = Integer() message = String() receiver = Nested(PublicUserOutSchema) timestamp = DateTime()
class ImageOutSchema(Schema): id = Integer() filename = String() image_url = URL()
class PostInSchema(Schema): title = String(required=True) content = String(required=True) private = Boolean(default=False) column_ids = List(Integer())
class BarSchema(Schema): class Meta: unknown = EXCLUDE id2 = Integer(default=123) name2 = String(required=True)
class BazSchema(Schema): id = Integer(default=123) name = String()
class CoinInSchema(Schema): amount = Integer()
class PaginationSchema(Schema): class Meta: unknown = EXCLUDE page = Integer(missing=1) per_page = Integer(missing=10)
class TokenOutSchema(Schema): access_token = String() expires_in = Integer() token_type = String()
class Spam(BaseSchema): id = Integer()
class CommentInSchema(Schema): body = String(required=True) post_id = Integer(required=True) reply_id = Integer()
class PetOutSchema(Schema): id = Integer() name = String() category = String()
class ColumnInSchema(Schema): name = String() post_ids = List(Integer())