The context array from the Application Validators is often passed directly into the UseCaseError that is thrown by a UseCase Validator - for example in the GetItemStatementsValidator. This results in the Application/Validation namespace effecting the error context the route handlers return.
Instead the UseCase Validators should declare context keys as constants and “rebuild” the context array when creating the UseCaseErrors to throw in order to keep the Application/Validation namespace isolated from the RouteHandlers.
Things to consider once task complete:
- Should we create use case level validators for commonly validated request data?
- Should we create namespaces for similar groups of use cases (e.g. Item / Property use cases) ?
- Common use case validators could live in each of those namespaces