testing ADR - architectural decisions
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 14m37s
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 14m37s
This commit is contained in:
@@ -57,14 +57,14 @@ router.get('/:id', validateRequest(getFlyerSchema), async (req, res, next) => {
|
||||
|
||||
### Positive
|
||||
|
||||
* **DRY and Declarative**: Validation logic is defined once in a schema and removed from route handlers.
|
||||
* **Improved Readability**: Route handlers become much cleaner and focus exclusively on their core business logic.
|
||||
* **Type Safety**: `zod` schemas provide strong compile-time and runtime type safety, reducing bugs.
|
||||
* **Consistent and Detailed Errors**: The `errorHandler` can be configured to provide consistent, detailed validation error messages for all routes (e.g., "Query parameter 'limit' must be a positive integer").
|
||||
* **Robustness**: Prevents invalid data from ever reaching the service or database layers.
|
||||
**DRY and Declarative**: Validation logic is defined once in a schema and removed from route handlers.
|
||||
**Improved Readability**: Route handlers become much cleaner and focus exclusively on their core business logic.
|
||||
**Type Safety**: `zod` schemas provide strong compile-time and runtime type safety, reducing bugs.
|
||||
**Consistent and Detailed Errors**: The `errorHandler` can be configured to provide consistent, detailed validation error messages for all routes (e.g., "Query parameter 'limit' must be a positive integer").
|
||||
**Robustness**: Prevents invalid data from ever reaching the service or database layers.
|
||||
|
||||
### Negative
|
||||
|
||||
* **New Dependency**: Introduces `zod` as a new project dependency.
|
||||
* **Learning Curve**: Developers need to learn the `zod` schema definition syntax.
|
||||
* **Refactoring Effort**: Requires a one-time effort to create schemas and refactor all existing routes to use the `validateRequest` middleware.
|
||||
**New Dependency**: Introduces `zod` as a new project dependency.
|
||||
**Learning Curve**: Developers need to learn the `zod` schema definition syntax.
|
||||
**Refactoring Effort**: Requires a one-time effort to create schemas and refactor all existing routes to use the `validateRequest` middleware.
|
||||
Reference in New Issue
Block a user