commanded_messaging icon indicating copy to clipboard operation
commanded_messaging copied to clipboard

Validation done in commanded middleware

Open revati opened this issue 5 years ago • 0 comments

Main changes:

  • commands are created with ExConstructor (similarly how its done with events new/1) without validation and any casting at that point
  • commands have validate function which takes struct data and validates it
  • commands do not import all Ecto.Changeset, but only needed functions
  • validation done in middleware (seems to be more idiomatic way how to integrate with commanded)
    • on failure: halts command execution, returns changeset
    • on success: applies changes and updates command values, proceeds
  • removed event version specific handling as it can be done manually for those who please.
  • events have explicit test for default values
  • contains: https://github.com/trbngr/commanded_messaging/pull/3

revati avatar Jul 17 '20 21:07 revati