This commit is contained in:
Chris McDonough
2010-03-14 06:17:29 +00:00
parent 722cef605b
commit 222b55b07b

View File

@@ -120,18 +120,19 @@ The *type* of a structure indicates its data type (such as
The *validator* of a structure is called after deserialization; it The *validator* of a structure is called after deserialization; it
makes sure the deserialized value matches a constraint. An example of makes sure the deserialized value matches a constraint. An example of
such a validator is provided in the schema above: such a validator is provided in the schema above:
``validator=cereal.Range(0, 200)``. The *name* of a structure appears ``validator=cereal.Range(0, 200)``. A validator is not called after
in error reports. A validator is not called during *serialization*, serialization, only after deserialization.
only during deserialization.
The *default* of a structure indicates its default value if a value The *default* of a structure indicates its default value if a value
for the structure is not found in the input data during serialization for the structure is not found in the input data during serialization
and deserialization. It should be the *deserialized* representation. and deserialization. It should be the *deserialized* representation.
If a structure does not have a default, it is considered required. If a structure does not have a default, it is considered required.
The *name* of a structure that is introduced as a class-level The *name* of a structure appears in error reports.
attribute of a ``cereal.MappingSchema`` or ``cereal.TupleSchema`` is
its class attribute name. For example: The name of a structure that is introduced as a class-level attribute
of a ``cereal.MappingSchema`` or ``cereal.TupleSchema`` is its class
attribute name. For example:
.. code-block:: python .. code-block:: python
:linenos: :linenos:
@@ -143,8 +144,8 @@ its class attribute name. For example:
validator=cereal.OneOf(['home', 'work'])) validator=cereal.OneOf(['home', 'work']))
number = cereal.Structure(cereal.String()) number = cereal.Structure(cereal.String())
The *name* of the structure defined by ``location = The name of the structure defined via ``location =
cereal.Structure(..)`` is ``location``. cereal.Structure(..)`` within the schema above is ``location``.
Schema Objects Schema Objects
~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~