class S(halogen.Schema): """Test schema.""" key = halogen.Attr()
class Schema(halogen.Schema): attr = halogen.Attr(required=True, default=lambda: 'lambda')
class Ticket(halogen.Schema): """Test schema.""" item = halogen.Attr(types.URI('static'), )
class T(S): """Test schema.""" key = halogen.Attr()
class Product(halogen.Schema): """A product has a name and quantity.""" name = halogen.Attr() quantity = halogen.Attr()
class AccountSchema(halogen.Schema): self = halogen.Link(attr=lambda account: url_for( "get_account", account_key=account.key.urlsafe())) id = halogen.Attr(attr=lambda account: account.key.id()) username = halogen.Attr()
class Error(halogen.Schema): message = halogen.Attr( attr=lambda error, language: error["message"][language])
class PersonSchema(halogen.Schema): """A schema that matches the Person class.""" name = halogen.Attr() surname = halogen.Attr()
class PublisherSchema(halogen.Schema): name = halogen.Attr(required=True) address = halogen.Attr()
class BookSchema(halogen.Schema): title = halogen.Attr(required=True) year = halogen.Attr(halogen.types.Int(), required=True) authors = halogen.Attr(halogen.types.List(AuthorSchema), required=True) publisher = halogen.Attr(PublisherSchema)
class AuthorSchema(halogen.Schema): name = halogen.Attr(required=True)
class MySchema(halogen.Schema): """Test schema.""" num = halogen.Attr( halogen.types.Int( validators=[halogen.validators.Range(min=10, max=11)]))
class EventSchema(halogen.Schema): """A schema that matches the Event class.""" name = halogen.Attr()
class Schema(halogen.Schema): attr = halogen.Attr(required=True)
class Person(halogen.Schema): """A person has a name and surname.""" name = halogen.Attr() surname = halogen.Attr()
class Schema(halogen.Schema): attr = halogen.Attr(required=False, default=1)
class OrderedSchema2(halogen.Schema): self = halogen.Link('http://somewhere.com') hello = halogen.Attr() foo = halogen.Attr('bar') person = halogen.Embedded(PersonSchema)