Skip to content

Validation done in commanded middleware #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

revati
Copy link

@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