mikeywaites / kim

Kim: A JSON Serialization and Marshaling framework
http://kim.readthedocs.org/en/latest/
Other
317 stars 17 forks source link

Mapper system #39

Closed mikeywaites closed 9 years ago

mikeywaites commented 9 years ago

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.

class AuthorMapper(Mapper):
    __model__ = Author

    name = String()
    date_of_birth = Date()
mikeywaites commented 9 years ago

40 Moving to a pull request per feature. Please ignore this issue