Notification Validation
Summary
Validation is inline and minimal. Endpoints reject missing required inputs with 400; the resolver guards each event payload before producing intents; and template rendering is deliberately tolerant of missing variables. There is no validation framework.
Endpoint guards (verified)
| Endpoint | Guard |
|---|---|
GET /notifications/my | recipientRef required, else 400 |
POST /notification-templates | templateKey and channel required; channel must be known, else 400 |
POST /notifications/test/dispatch | eventType required, else 400 |
POST /notifications/test/publish | eventType required, else 400 |
| Paged reads | take clamped with Math.Clamp to a bounded range |
Resolver guards
EventNotificationResolver guards each event: a null or malformed payload (JSON deserialization failure) returns no intent, and event-specific checks reject empty identifiers (for example, empty EmployeeId, non-positive tenant reference or missing asset code). Unknown event types fall through to an empty intent list.
Tolerant rendering
TemplateEngine substitutes only recognized {{Variable}} placeholders and renders unknown placeholders as empty strings, so an incomplete payload never blocks a notification. NotificationChannels.Normalize canonicalizes channel casing.
Channel and address checks
Before delivery the dispatcher confirms a resolvable address for the channel and a registered sender; missing either is handled as suppression or immediate failure rather than an exception to the caller.
Verified absence
There is no FluentValidation, no IValidator, no data-annotation model validation and no domain invariant enforcement beyond the guards above. Entity setters are public and unconstrained.
Requires Confirmation
Whether stronger payload-schema validation is expected at the service boundary requires confirmation.
Source References
microservices/src/notification-service/Api/NotificationEndpoints.csmicroservices/src/notification-service/Application/EventNotificationResolver.csmicroservices/src/notification-service/Application/TemplateEngine.csmicroservices/src/notification-service/Domain/NotificationEntities.cs
Related Articles
See Also
Keywords
Validation, guards, input checks, tolerant rendering, verified absence.
Revision Information
- Status: Draft
- Last reviewed: 2026-07-21
- Next review: 2026-10-21