Skip to content

Command Validation Pipeline Enhancements

Latest

Choose a tag to compare

@livedcode livedcode released this 03 Jan 06:39

🚀 What’s New

This release introduces robust command validation behavior to ensure correctness, safety, and predictable execution within the MinimalCQRS dispatcher.

✨ Highlights

Pre-handler validation enforcement

All command validators are executed before any handler is invoked.

If validation fails, handlers are guaranteed not to run.

Multiple validator support

Supports multiple validators per command.

All validators are executed, even if earlier ones fail.

Aggregated validation errors

Validation failures are collected and returned together.

Consumers receive a single CommandValidationException containing all error messages.

Deterministic execution flow

Validation → Handler execution order is now explicit and enforced.

Prevents partial or inconsistent command handling.

🧪 Testing

Added unit tests to verify:

All validators are executed

Validation errors are aggregated

Handlers are not invoked on validation failure

🔄 Backward Compatibility

No breaking API changes.

Existing commands and handlers continue to work without modification.

Projects without validators are unaffected.

📦 Recommended Usage

This version is recommended for all consumers who require:

Strong input validation

Predictable command execution

Clear validation error reporting