Schemas and validation ====================== Form schemas are high-level declarative descriptions of forms. They describe every field of the form, how it should rendered, what's the shape of the data and how it should be validated. React Forms provides ``Schema``, ``List`` and ``Property`` schema nodes to describe mapping, list and scalar values correspondingly:: var Schema = ReactForms.schema.Schema var List = ReactForms.schema.List var Property = ReactForms.schema.Property var PersonSchema = Schema(null, Property({name: 'name', label: 'Name'}), Property({name: 'dob', label: 'Date Of Birth'}) ) Object ``PersonSchema`` is a schema for objects which represent persons, every person have ``name`` and ``dob`` properties with labels ``Name`` and ``Date Of Birth`` correspondingly. Attribute ``name`` is required for schema nodes which are defined as a part of ``Schema`` declarations. Forms schema API is designed to be compatible with JSX. The schema above can be specified using JSX syntax:: var PersonSchema = ( ) Reusable schemas ---------------- Schemas are immutable values and can be reused as parts of more sophisticated schemas as much as needed. Also it is possible to define parametrized schemas as functions which construct schema nodes based on arguments passed:: function Name(props) { props = props || {} return } Schema metadata --------------- There are a couple of schema metadata (alongside ``name``) supported by form components out of the box. Schema metadata related to validation: * ``type`` property can be used to specify type of the schema which defines how object is serialized to/deserialize from DOM value. You can read more about schema types below. * ``validate`` property is used to specify validators for values corresponding to schema. * ``defaultValue`` is used to define a value which will be used when a corresponding value for schema node is absent Schema metadata related to presentation: * ``label`` property is used by form components to render ``