View Source Myrmidex.GeneratorSchema behaviour (myrmidex v0.3.0)

Behaviour defining the contract for a GeneratorSchema module.

GeneratorSchemas map terms, or fields defining the types of map or struct fields, into StreamData generators. See Myrmidex.GeneratorSchemas.Default.

Summary

Callbacks

Callback defining custom generator mappings per term

Callback defining custom generator mappings per field--type tuple

Functions

Generates code to delegate to another generator schema in the case of no matching cast_field/2 implementations. Should be called last in a generator schema module.

Callbacks

Link to this callback

cast(term, opts)

View Source (optional)
@callback cast(term(), opts :: keyword()) :: StreamData.t(term())

Callback defining custom generator mappings per term

Link to this callback

cast_field(t, opts)

View Source (optional)
@callback cast_field(Myrmidex.Field.t(), opts :: keyword()) :: StreamData.t(term())

Callback defining custom generator mappings per field--type tuple

Functions

Link to this macro

generator_schema_fallback(mod)

View Source (macro)

Generates code to delegate to another generator schema in the case of no matching cast_field/2 implementations. Should be called last in a generator schema module.