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
{
// ...
}