Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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>"))
Exemplo n.º 3
0
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>"))
Exemplo n.º 4
0
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>"))
Exemplo n.º 5
0
 class PetSchema(Schema):
     name = String(required=True)
     age = Integer(default=123)
Exemplo n.º 6
0
class PetQuerySchema(Schema):
    page = Integer(missing=1)
    per_page = Integer(missing=20, validate=Range(max=30))
Exemplo n.º 7
0
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>"))
Exemplo n.º 8
0
 class Schema(BaseSchema):
     id = Integer()
Exemplo n.º 9
0
class FooSchema(Schema):
    class Meta:
        unknown = EXCLUDE

    id = Integer(default=123)
    name = String(required=True)
Exemplo n.º 10
0
class QuerySchema(Schema):
    class Meta:
        unknown = EXCLUDE

    id = Integer(missing=1)
Exemplo n.º 11
0
class GroupInSchema(Schema):
    name = String(required=True)
    members = List(Integer())
    private = Boolean()
Exemplo n.º 12
0
class NotificationOutSchema(Schema):
    id = Integer()
    message = String()
    receiver = Nested(PublicUserOutSchema)
    timestamp = DateTime()
Exemplo n.º 13
0
class ImageOutSchema(Schema):
    id = Integer()
    filename = String()
    image_url = URL()
Exemplo n.º 14
0
class PostInSchema(Schema):
    title = String(required=True)
    content = String(required=True)
    private = Boolean(default=False)
    column_ids = List(Integer())
Exemplo n.º 15
0
class BarSchema(Schema):
    class Meta:
        unknown = EXCLUDE

    id2 = Integer(default=123)
    name2 = String(required=True)
Exemplo n.º 16
0
class BazSchema(Schema):
    id = Integer(default=123)
    name = String()
Exemplo n.º 17
0
class CoinInSchema(Schema):
    amount = Integer()
Exemplo n.º 18
0
class PaginationSchema(Schema):
    class Meta:
        unknown = EXCLUDE

    page = Integer(missing=1)
    per_page = Integer(missing=10)
Exemplo n.º 19
0
class TokenOutSchema(Schema):
    access_token = String()
    expires_in = Integer()
    token_type = String()
Exemplo n.º 20
0
 class Spam(BaseSchema):
     id = Integer()
Exemplo n.º 21
0
class CommentInSchema(Schema):
    body = String(required=True)
    post_id = Integer(required=True)
    reply_id = Integer()
Exemplo n.º 22
0
class PetOutSchema(Schema):
    id = Integer()
    name = String()
    category = String()
Exemplo n.º 23
0
class ColumnInSchema(Schema):
    name = String()
    post_ids = List(Integer())