On this page

Validating customer input

A customer form reports expected input failures through FluentValidation. Contracts protect programming boundaries such as an absent model. The connected walkthrough now contains the canonical declarations.

The model and rules

Define Customer and CustomerValidator. The model has Id, Name, Email and IsActive; registration leaves a new customer inactive.

Calling the validator

Inspect property failures in an ordinary caller. The same result feeds the HTTP boundary.

Reusing a validator header with a class kind

Replace the ordinary header with a Validator kind. This is an optional replacement, not a second CustomerValidator to add alongside the first.

Useful checks

Check the input boundaries, then follow the full request.