Implementing data validation
Validation is a common problem in all kinds of applications: when accepting requests or incoming data, we want to make sure the provided values are valid (for example, user emails, date of birth values, or even movie scores).
In microservice applications, validation often becomes a non-trivial task due to multiple reasons:
- Consistency of validation across services: Different microservices might work with the same types of records, while possibly enforcing different validation rules (for example, if each service has its own validation logic)
- Lack of standardization: If services are implemented and maintained by separate teams, the format and coding style of validation rules might vary dramatically, making maintenance harder
- Asynchronous event validation: Validation rules should work not only in API handlers but also in asynchronous event handlers, such as Kafka consumers
- Client versus server-side validation mismatch: Both...