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)
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, )
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')
class CreateUserSchema(schemas.MappingNode): name = schemas.StringNode(title='Name', validator=colander.Length(max=250))
class UserSchema(schemas.HalResourceSchema): name = schemas.StringNode(title='Name')
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)
class Work(schemas.MappingNode): title = schemas.StringNode(title="Title") address = schemas.StringNode(title="Address")
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')
class FileSchema(schemas.HalResourceSchema): name = schemas.StringNode(title='Name') size = schemas.UnsignedIntegerNode(title='File size')