I'm implementing a clean architecture design: ui -> domain <- data in modules (this is important) and I've encountered a trouble.
I have the Repository and the DataSource. I create the repository and datasource interfaces in the Domain module
DataSource: Add functions that return data model in Data module (Entity, Remote)
Repository: Call datasource and do the mapping to domain objects.
Now I'm facing a problem. If I want to do the mapping on repository how can I do it without knowing the data models, that seems impossible, in order to do the mapping on repository I need to know what kind of data models exists.
I don't want to do the mapping on DataSource since providing the raw data (data models) is its responsability
What should I do here? What am I missing or not understanding?
Set repository interface in domain module and set DataSource interface in data module.
That way I'm able to do this mapping since implementations of Repository and DataSource are in data module. And now DataSource can return its data models