Skip to content

Validation done in commanded middleware#5

Open
revati wants to merge 9 commits intotrbngr:masterfrom
revati:master
Open

Validation done in commanded middleware#5
revati wants to merge 9 commits intotrbngr:masterfrom
revati:master

Conversation

@revati
Copy link
Copy Markdown

@revati revati commented Jul 17, 2020

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: Support composite Ecto.Type definitions #3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants