Version `0.3.0` changes how `Schema` validators are created. In this release validators are created as instances of `Schema`.
python
import typesystem
artist_schema = typesystem.Schema(
fields={
"name": typesystem.String(max_length=100)
}
)
definitions = typesystem.Definitions()
definitions["Artist"] = artist_schema
album_schema = typesystem.Schema(
fields={
"title": typesystem.String(max_length=100),
"release_date": typesystem.Date(),
"artist": typesystem.Reference("Artist", definitions=definitions)
}
)
The output of validation is also a `dict`, so there's no need to serialize validated data.
python
album, error = album_schema.validate_or_error(data)