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.
val validate : 'a any_field -> string -> string option
validate field string
decodes a string
and runs the field
's validation logic on the decoded value. Both decoding and validation might fail, which results in an error string.
val optional : 'a any_field -> bool
optional field
turns a field
into an optional field. This means that input that doesn't contain a value for the field will yield in a valid field.
val type_ : 'a any_field -> string
type_ field
returns a string representation of the type of field
.
val encode_default : 'a any_field -> string option
encode_default field
tries to encode the default value if present and to return it as string.