package conformist
-
conformist
Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
A field of type ('meta, 'a) t
represents the static type 'a
and it can hold arbitrary meta data of type 'meta
. That meta data can be used to build functionality on top of conformist.
val meta : 'a any_field -> 'a option
meta field
returns an optional meta data of a field
. This can be used to store arbitrary meta data in each field. Note that the type of the meta data has to be the same for all fields.
val name : 'a any_field -> string
name field
returns the name of the field
, which uniquely identifies the field within one schema.
validate field values
decodes values
and runs the field
's validation logic on the decoded values. Both decoding and validation might fail, which results in an error string.
val optional : 'a any_field -> bool
optional field
returns true
if the field
is optional and false
otherwise.
val is_optional : 'a any_field -> bool
is_optional field
returns true
if the field
is optional and false
otherwise.
val type_ : 'a any_field -> string
type_ field
returns a string representation of the type of field
.
val encode_default : 'a any_field -> string Stdlib.List.t
encode_default field
tries to encode the default value if present and to return it as string.