Consider:
The Use Case layer defines an interface
public interface IGeocoder
{
Coordinate GetCoordinate(Address address);
}
Coordinate and Address are value objects defined in the domain layer (i.e. entities layer in Uncle Bob jargon). Obviously the use case (interactor) constructs the Address and passes it to the IGeocoder, expecting a Coordinate to be returned.
Would this break any Clean Architecture rules? Should I be instead passing DTOs through the interface, so that the actual implementation of the service is not responsible for generating the domain entities? Or is this fine?
Note that I don't see any difference between this and a repository (entity gateway), whose interface would also be defined in the Use Case layer but implemented in the surrounding Interface Adapters layer:
public interface IRestaurantRepository
{
// ...
}
Who is owning the implementation of the infrastructure service? Is it the same team? Then it should be fine to handle it similar to repositories; return domain entities directly. Is it owned by different team? Then creating a boundary and passing dedicated DTOs might be beneficial as it creates less coupling.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With