Mappers are the building blocks of Kim - they define how JSON output should look and how input JSON should be expected to look.
Mappers consist of Fields. Fields define the shape and nature of the data both when being ouputted (serialised) and inputted (marshaled).
Mappers must define a model. This is the type that will be instantiated if a new object is marshaled through the mapper. If you only want a simple object, you can set this to dict or object.
class AuthorMapper(Mapper):
__model__ = Author
name = String()
date_of_birth = Date()
38
Mappers are the building blocks of Kim - they define how JSON output should look and how input JSON should be expected to look.
Mappers consist of Fields. Fields define the shape and nature of the data both when being ouputted (serialised) and inputted (marshaled).
Mappers must define a model. This is the type that will be instantiated if a new object is marshaled through the mapper. If you only want a simple object, you can set this to dict or object.