sanity-clause.field package

<< back to sanity-clause index

Field classes that can be used to validate data.

Also contains sanity-clause.protocol:get-value, sanity-clause.protocol:deserialize, and sanity-clause.protocol:validate, which represent the lifecycle of loading data from some other object.

Exported symbols:

Functions

make-field

[source]

Make a field instance of class type-FIELD and give it initargs args.

find-field

[source]

Find the class that corresponds to type by name

dump-field-p

[source]

Is this field required for serialization (fields that have flow of :dump or :both)?

load-field-p

[source]

Is this field required for deserialization (fields that have flow of :load or :both)?

Classes

one-schema-of-field

[source]

A field type that allows any of the schemas specified.

Use the :schema-choices initarg to provide a list of schema classes to try.

Note: If your schema choices are very lenient (ie. every field is not required), this field will likely behave in unexpected ways. That is, if you specify a list of classes that only have optional fields, sanity clause won't be able to figure out which one to use and will probably return the missing value instead of valid data. You probably want at least one charactersitic field to be required.

one-field-of-field

[source]

A field type that allows any of the fields specified.

System Message: WARN (Duplicate explicit target name: "[source]"., source line 101)

map-field

[source]

A field that maps values of one kind to values to another kind, like strings to strings, or numbers to objects. examples:

(make-field :map :key-field :string :value-field :integer)
(deserialize * '(("potato" . 4) ("chimp" . 11)))

System Message: WARN (Duplicate explicit target name: "[source]"., source line 112)

nested-field

[source]

A field that represents a complex object located at this slot.

System Message: WARN (Duplicate explicit target name: "[source]"., source line 127)

list-field

[source]

A field that contains a list of values satsified by another field.

System Message: WARN (Duplicate explicit target name: "[source]"., source line 138)

required-value-error

[source]

An error that signals a required value is missing.

System Message: WARN (Duplicate explicit target name: "[source]"., source line 149)

validation-error

[source]

Error that indicates a field is invalid.

System Message: WARN (Duplicate explicit target name: "[source]"., source line 160)

timestamp-field

[source]

A field that contains a timestamp

System Message: WARN (Duplicate explicit target name: "[source]"., source line 171)

real-field

[source]

A field that contains a real value (eg. possibly a float).

System Message: WARN (Duplicate explicit target name: "[source]"., source line 182)

integer-field

[source]

A field that holds an integer value.

System Message: WARN (Duplicate explicit target name: "[source]"., source line 193)

constant-field

[source]

A field that expects to get the same value every time. Will throw a conversion-error if VALUE isn't equal to CONSTANT according to TEST.

System Message: WARN (Duplicate explicit target name: "[source]"., source line 204)

uuid-field

[source]

A field for values that should resemble UUIDs.

System Message: WARN (Duplicate explicit target name: "[source]"., source line 215)

uri-field

[source]

A field for values that should be emails.

System Message: WARN (Duplicate explicit target name: "[source]"., source line 226)

email-field

[source]

A field for values that should be emails.

System Message: WARN (Duplicate explicit target name: "[source]"., source line 237)

boolean-field

[source]

A field type for bolean values.

System Message: WARN (Duplicate explicit target name: "[source]"., source line 248)

member-field

[source]

A field that expects a member of a set of symbols.

System Message: WARN (Duplicate explicit target name: "[source]"., source line 259)

string-field

[source]

A field that contains a string.

System Message: WARN (Duplicate explicit target name: "[source]"., source line 270)

field

[source]

A base class for all fields that controls how they are (de?)serialized.

System Message: WARN (Duplicate explicit target name: "[source]"., source line 281)