Skip to content

Add lightweight simple validation with string messages#2272

Merged
jeremydmiller merged 1 commit intomainfrom
simple-validation
Mar 9, 2026
Merged

Add lightweight simple validation with string messages#2272
jeremydmiller merged 1 commit intomainfrom
simple-validation

Conversation

@jeremydmiller
Copy link
Member

Summary

  • Add support for Validate/ValidateAsync methods returning IEnumerable<string>, string[], Task<string[]>, or ValueTask<string[]> as a lower-ceremony validation option
  • For message handlers: log validation messages as warnings via ILogger and abort processing
  • For HTTP endpoints: return a ProblemDetails response with status 400 containing the validation errors
  • Register SimpleValidationContinuationPolicy as a default IContinuationStrategy alongside existing HandlerContinuationPolicy
  • Add CreateSimpleValidationFrame method to IChain with default handler implementation in Chain<> and HTTP-specific override in HttpChain
  • Add documentation section covering all validation options in Wolverine

Test plan

  • 8 CoreTests covering all return type permutations (IEnumerable, string[], Task<string[]>, ValueTask<string[]>) with happy and sad paths for message handlers
  • 8 Wolverine.Http.Tests covering all return type permutations with happy and sad paths for HTTP endpoints
  • Verified existing compound_handlers and problem_details tests still pass

🤖 Generated with Claude Code

…and HTTP endpoints

Support Validate/ValidateAsync methods returning IEnumerable<string>, string[],
Task<string[]>, or ValueTask<string[]> as a lower-ceremony validation option.
For message handlers, validation failures are logged and processing aborts.
For HTTP endpoints, a ProblemDetails 400 response is returned.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant