-----------
- Code updated to work with latest marshmallow (3.7.0).
- Validation is done on record add and update time too. Fixes 70. Previously
data was added without validation and when it was read back, validation was done
at that time (default marshmallow behavior) and caused validation errors.
- [Backward incompatible] Setting _key field to require=True means that it's value
should always be provided and is not to be auto-generated. To keep the previous
behavior do not set `required=True` for the field. This will allow both setting
it or having it auto generated.
.. code-block:: python
allows _key auto-generation
class Person(Collection):
__collection__ = "persons"
_key = String()
name = String(required=True, allow_none=False)
age = Integer(allow_none=True, missing=None)
dob = Date(allow_none=True, missing=None)
This will not allow _key auto-generation
class Person(Collection):
__collection__ = "persons"
_key = String(required=True)
name = String(required=True, allow_none=False)
age = Integer(allow_none=True, missing=None)
dob = Date(allow_none=True, missing=None)