Lavash.SparkHeex.Transformers.ValidateActionParams (Lavash v0.3.0-rc.2)

Copy Markdown View Source

Per-element cross-check between phx-value-* attributes and the declared params on the corresponding action.

Composes with ValidateEvents: that transformer ensures every literal event name resolves to some declared action. This one ensures that on any element with phx-click="name" (or phx-submit/phx-change/etc.), the set of phx-value-foo attribute keys exactly matches the declared args: list for action :name.

Rules:

  • Each phx-value-foo key on the element must appear in the action's declared args. Unknown keys ⇒ DslError (typo detection).
  • Each declared arg must appear as a phx-value-foo key. Missing args ⇒ DslError.
  • Dynamic event names (phx-click={@x}) are skipped — the binding to a specific action isn't resolvable at compile time.
  • Dynamic phx-value-foo={@x} values are fine; only the key is checked, not the value's runtime type.
  • Event names that don't match any declared action are not reported here — ValidateEvents already raises in that case. We just skip them to avoid double-reporting.

Summary

Functions

after?(arg1)

Callback implementation for Spark.Dsl.Transformer.after?/1.

after_compile?()

Callback implementation for Spark.Dsl.Transformer.after_compile?/0.

before?(arg1)

Callback implementation for Spark.Dsl.Transformer.before?/1.

transform(dsl_state)

Callback implementation for Spark.Dsl.Transformer.transform/1.