You have a set of microservices A, B, C that interact with microservice D for various reasons and one day you discover that sometimes one of the input fields of one of the REST Apis of D need to be potentially cleaned or transformed, by joining it with some other information. You have basically two choices:
- Implement a service E and write the logic in A,B,C that interacts with E before calling D
- Implement a specialized port in D and handle the mapping, cleaning and transformation there
The second approach seems superior in the sense that it provides less duplication and it is easier to test. Are there drawbacks that we don't see?