예제 #1
0
class PatchUserSchema(schemas.MappingNode):
    first_name = schemas.StringNode(
        title='First Name', missing=colander.drop,
        validator=colander.All(
            colander.Length(max=50),
            colander.Regex(r'^[a-zA-z0-9]+$')
        ),
    )
    last_name = schemas.StringNode(
        title='Last Name', missing=colander.drop,
        validator=colander.All(
            colander.Length(max=50),
            colander.Regex(r'^[a-zA-z0-9]+$')
        ),
    )
    age = schemas.UnsignedIntegerNode(
        title='Age', nullable=True, missing=colander.drop,
    )
    sex = schemas.StringNode(
        title='Sex', missing=colander.drop,
        validator=colander.OneOf(['m', 'f']), nullable=True
    )
    children = schemas.SequenceNode(
        Child(title='Child', missing=colander.drop),
        missing=colander.drop,
    )
    current_work = Work(title='Current work', missing=colander.drop)
예제 #2
0
class GetAdminChoicesSchema(schemas.GetEmbeddedSchema):
    group = schemas.StringNode(title='Filter by choice group',
                               missing=colander.drop)
    id = schemas.SequenceNode(
        schemas.StringNode(title='Choice ID'),
        title='Filter by choices IDs',
        missing=colander.drop,
    )
예제 #3
0
class UserSchema(schemas.HalResourceSchema):
    id = schemas.UnsignedIntegerNode(title='ID')
    created = schemas.DateTimeNode(title='Created')
    first_name = schemas.StringNode(title='First Name')
    last_name = schemas.StringNode(title='Last Name')
    age = schemas.UnsignedIntegerNode(title='Age', nullable=True)
    sex = schemas.StringNode(title='Sex', validator=colander.OneOf(['m', 'f']))
    children = schemas.SequenceNode(Child(title='Child'))
    current_work = Work(title='Current work')
예제 #4
0
파일: schemas.py 프로젝트: Cykooz/restfw
class CreateUserSchema(schemas.MappingNode):
    name = schemas.StringNode(title='Name', validator=colander.Length(max=250))
예제 #5
0
파일: schemas.py 프로젝트: Cykooz/restfw
class UserSchema(schemas.HalResourceSchema):
    name = schemas.StringNode(title='Name')
예제 #6
0
class Child(schemas.MappingNode):
    sex = schemas.StringNode(title='Sex', validator=colander.OneOf(['m', 'f']))
    name = schemas.StringNode(title='Name')
    age = schemas.UnsignedIntegerNode(title='Age', nullable=True)
예제 #7
0
class Work(schemas.MappingNode):
    title = schemas.StringNode(title="Title")
    address = schemas.StringNode(title="Address")
예제 #8
0
class AdminChoiceSchema(schemas.MappingNode):
    uniq_id = schemas.StringNode(title='Unique ID of choice')
    group = schemas.StringNode(title='Choice group')
    id = schemas.EmptyStringNode(title='Choice ID')
    name = schemas.EmptyStringNode(title='Choice name')
예제 #9
0
파일: schemas.py 프로젝트: Cykooz/restfw
class FileSchema(schemas.HalResourceSchema):
    name = schemas.StringNode(title='Name')
    size = schemas.UnsignedIntegerNode(title='File size')