Skip to content

Add RequirementResult as validation return type for Validate methods#2275

Merged
jeremydmiller merged 1 commit intomainfrom
data-requirements
Mar 9, 2026
Merged

Add RequirementResult as validation return type for Validate methods#2275
jeremydmiller merged 1 commit intomainfrom
data-requirements

Conversation

@jeremydmiller
Copy link
Member

Summary

  • Adds RequirementResultContinuationPolicy — a new IContinuationStrategy that detects Validate/ValidateAsync methods returning RequirementResult
  • When Branch == Continue, processing continues normally
  • When Branch == Stop, message handlers log each message as a warning and abort; HTTP endpoints return ProblemDetails with 400 status
  • If Messages are empty on stop, handlers log "Invalid Request" and HTTP endpoints set ProblemDetails.Detail = "Invalid Request"
  • Separate Frame classes for reuse: RequirementResultHandlerFrame (message handlers) and RequirementResultHttpFrame (HTTP endpoints)
  • Follows the same pattern established in PR Add lightweight simple validation with string messages #2272 for IEnumerable<string> simple validation

Test plan

  • 5 message handler tests (sync, async, empty messages — happy and sad paths)
  • 7 HTTP endpoint tests (sync, async, empty messages — happy and sad paths, Detail assertion)
  • All 532 existing HTTP tests still pass

🤖 Generated with Claude Code

Adds a new continuation strategy that detects Validate/ValidateAsync methods
returning RequirementResult. When Branch == Continue, processing proceeds
normally. When Branch == Stop, message handlers log warnings and abort, while
HTTP endpoints return ProblemDetails with 400 status. If Messages are empty,
ProblemDetails.Detail is set to "Invalid Request".

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