PropSchema v0.2.0 PropSchema.AdditionalProperties behaviour

A behaviour that is used to define additional properties not provided in the base properties provided in the module.

How to Implement

Once you have implemented the callbacks below (see generate_prop/3 below), add the module that implements this behaviour as the option additional_properties in the PropSchema.Executor.__using__/1 declaration.

Link to this section Summary

Callbacks

Implement to define additional properties not provided in the PropSchema.BaseProperties module

Link to this section Callbacks

Link to this callback generate_misc(arg0) (optional)
Link to this callback generate_prop(atom, atom, map) (optional)
generate_prop(atom(), atom(), map()) :: PropSchema.Types.ast_expression()

Implement to define additional properties not provided in the PropSchema.BaseProperties module.

Example

def generate_prop(field, :float, %{positive: true, required: true}) do
  quote do
    {unquote(Atom.to_string(field)), float(min: 1)}
  end
end