Expresso.Presenter.Verifier (expresso v0.1.0)

Copy Markdown View Source

The Spark verifier of a presenter definition

It runs one time for each module that uses Expresso.Presenter.Dsl, when the module compiles. It refuses these errors:

  • The option state does not hold exactly the fields of Expresso.Presenter.Definition, or a value has the wrong type.
  • The option sync, the option reset or the option match of a mode names an unknown field. The option sync or the option reset names index.
  • Two modes have the same name.
  • A command is not a command of Expresso.Presenter.Definition, or it gives a field a value of the wrong type.
  • A mode with the option any has bindings.
  • One event has two bindings in one mode. The list of keys would then show two functions for the event.
  • The event :element is in a mode without the option element.
  • A projection names an unknown field, or an attribute or a property with a wrong name. Expresso.Presenter.Projection describes the projections. An attribute with flag: true needs a field that is true or false, and a mark needs a field that holds a number.

The script in the browser reads the same fields and commands. Without the verifier, the script finds such an error only when the presenter uses the document.

Summary

Functions

Make sure of the definition of a presenter

Functions

verify(dsl_state)

@spec verify(map()) :: :ok | {:error, Spark.Error.DslError.t()}

Make sure of the definition of a presenter