class Booking(typesystem.Schema): start_date = typesystem.Date() end_date = typesystem.Date() room = typesystem.Choice(choices=[ ("double", "Double room"), ("twin", "Twin room"), ("single", "Single room"), ]) include_breakfast = typesystem.Boolean(title="Include breakfast", default=False)
class UserSchema(typesystem.Schema): name = typesystem.String(title="Name") email = typesystem.String(title="E-mail") email_verified = typesystem.Boolean(title="E-mail verified?", default=False) given_name = typesystem.String(title="Given name", allow_null=True) middle_name = typesystem.String(title="Middle name", allow_null=True) family_name = typesystem.String(title="Family name", allow_null=True) nickname = typesystem.String(title="Nick name", allow_null=True) preferred_username = typesystem.String(title="Preferred user name", allow_null=True) profile = typesystem.String(title="Profile", allow_null=True) website = typesystem.String(title="Website", allow_null=True) gender = typesystem.String(title="Gender", allow_null=True) birthdate = typesystem.Date(title="Birthdate", allow_null=True) zoneinfo = typesystem.String(title="Zone info", allow_null=True) locale = typesystem.String(title="Locale", allow_null=True) phone_number = typesystem.String(title="Phone number", format="tel", allow_null=True) phone_number_verified = typesystem.Boolean(title="Phone number verified?", allow_null=True) address = typesystem.String(title="Address", allow_null=True) cognito_mfa_enabled = typesystem.Boolean(title="MFA enabled?", default=True)
class BookingSchema(typesystem.Schema): start_date = typesystem.Date(title="Start date") end_date = typesystem.Date(title="End date") room = typesystem.Choice( title="Room type", choices=[ ("double", "Double room"), ("twin", "Twin room"), ("single", "Single room"), ], ) include_breakfast = typesystem.Boolean(title="Include breakfast", default=False) def __str__(self): breakfast = ("(with breakfast)" if self.include_breakfast else "(without breakfast)") return f"Booking for {self.room} from {self.start_date} to {self.end_date}"
class Album(typesystem.Schema, definitions=definitions): title = typesystem.String(max_length=100) release_date = typesystem.Date() artist = typesystem.Reference("Artist")
class Album(typesystem.Schema): title = typesystem.String(max_length=100) release_date = typesystem.Date() artist = typesystem.Reference(Artist)
class Example(typesystem.Schema): created = typesystem.Date(default=datetime.date.today)
class BlogPost(typesystem.Schema): text = typesystem.String() created = typesystem.Date()
class BlogPost(typesystem.Schema): text = typesystem.String() created = typesystem.Date() modified = typesystem.Date(allow_null=True)
class BlogPost(typesystem.Schema): text = typesystem.String() modified = typesystem.Array(typesystem.Date())
def get_validator(self, **kwargs) -> typesystem.Field: return typesystem.Date(**kwargs)