Estructura.Nested.Type behaviour (estructura v1.11.0)

View Source

The type to be used for coercing, validating, and generation of the implementation’s instances.

Summary

Callbacks

Coerces the value coming from outside

The generator for the type

The generator for the type accepting options

The generator for the type accepting options

The producer for the type accepting options (differs from generate/1 being a non-shrinkable usually infinite stream)

Validates the value as being correct

Callbacks

coerce(term)

@callback coerce(term()) :: {:ok, term()} | {:error, any()}

Coerces the value coming from outside

generate()

@callback generate() :: StreamData.t(any())

The generator for the type

generate(opts)

@callback generate(opts :: keyword()) :: StreamData.t(any())

The generator for the type accepting options

generate(opts, payload)

@callback generate(opts :: keyword(), payload :: any()) :: StreamData.t(any())

The generator for the type accepting options

produce(keyword)

(optional)
@callback produce(keyword()) :: Enumerable.t()

The producer for the type accepting options (differs from generate/1 being a non-shrinkable usually infinite stream)

validate(term)

@callback validate(term()) :: {:ok, term()} | {:error, any()}

Validates the value as being correct