Employee Validation
Summary
Validation is split among application validators, domain value objects/aggregates, application-service checks, and persistence constraints. Typed command handlers call their validators explicitly.
Audience
- Backend developers and QA engineers
- Solution architects reviewing rule placement
Reference Content
Input validation
Application validators check tenant presence, required text, basic email form, status parsing, and document/note requirements. Domain value objects normalize and validate employee code, employee name, email, phone, address, money, and audit information where used.
Business and aggregate validation
Aggregate methods protect self-manager assignment, required notes/document metadata, employee status behavior, required organization names/codes, and department self-parenting.
Cross-entity validation
Async validators and application services use repositories to confirm tenant-scoped uniqueness, active departments, active designations, designation/department agreement during creation, and active reporting managers. Some cross-field checks are not applied uniformly across both application styles; see Known Limitations.
Error handling
Expected failures return Result<T> validation, conflict, or not-found outcomes. Domain validation exceptions are caught by application handlers and translated into validation results. Missing tenant context is translated at the host boundary to a safe client error.
Pipeline validation
IValidator<T> and IAsyncValidator<T> abstractions exist, but no implemented pipeline behavior or central dispatcher automatically invokes them. Application/Behaviors/README.md describes future behavior placement only. Each typed command handler invokes its registered async validator directly.
Source References
microservices/src/employee-service/Application/Validators/EmployeeCommandValidators.csmicroservices/src/employee-service/Application/Common/Cqrs.csmicroservices/src/employee-service/Domain/Common/ValueObjects.csmicroservices/src/employee-service/Domain/Employees/Employee.csmicroservices/src/employee-service/Application/Behaviors/README.md
Related Articles
See Also
Keywords
- Async validation
- Aggregate invariant
- Validation pipeline
Revision Information
- Status: Draft
- Last reviewed: 2026-07-15
- Review cycle: Quarterly