API Reference data_schema v0.2.0


DataSchemas are declarative specifications of how to create structs from some kind of data source. For example you can define a schema that knows how to turn an elixir map into a struct, casting all of the values as it goes. Alternatively you can set up a schema to ingest XML data and create structs from the values inside the XML.

The casting function can either be a 1 arity function or a module that has a cast/1 function implemented. This behaviour is to help ensure that cast/1 function looks the way DataSchema expects.

Defines how DataSchema.to_struct/2 should access data for each given field type.

When we create a struct we either return the struct we were creating or we return this error. The error/errors that happened during struct creation are collected into this struct

An error for when a schema is specified incorrectly. Usually this means there has been a syntax error when defining the schema.

Defines a way to use elixir maps as an input data source. This will Map.get/2 the fields from the source data, meaning it will return nil in the case of the key being missing.