I had a discussion with my coworker about the way we should implement the communication between 2 microservices. At the moment we have 2 micro services which are depended on each other because my coworker wanted to avoid code duplication by reusing the DTO objects which were used for the REST API.
In a perfect world we would not have any dependencies between the services but in our case it makes sense. In my opinion this couples the services which is worse than duplicating a DTO.
Would you duplicate the DTO in second micro service or are there other solutions?
Even in this post there were different opinions on how to share models between micro services and how to communicate. I would say the clean solutions is explained in this post.