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

    id = Integer(default=123)
    name = String(required=True)
Beispiel #10
0
class QuerySchema(Schema):
    class Meta:
        unknown = EXCLUDE

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

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

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