0

I have a multimodule app which contains the following 2 module API and Core

API module contains all APIs

CORE module contains services, daos and entities

NOTE :

  • Core cannot see API since CORE is actually a dependency in API

  • Core is a dependency in API in which app runs the API directly

Now I have 2 problems

  • First APIs use DTOS so where DTO package has to be located? If APIS so should I convert these DTOs back to an entity when calling any service since again service in CORE can not see DTOs? If we can put DTOs in CORE then should not that violate single responsibility pattern?

  • Second problem should I create a dto for each endpoint as a parameter ex: addUser(AddUserDto dto) so that the endpoint contract contains specific fields? What about complex DTO that contains custom entities data?

  • I'm having trouble figuring out what the problem that you're trying to solve here is. Since you need visibility to the DTO's to be able to use them, the logical place to put them is in CORE. Make as many DTOs as you need to make your functionality possible, but no more than that. – Robert Harvey Mar 20 '18 at 14:58
  • Yes but the idea we try to make our system decoupled as we can so we thought that It's a bad idea to put API dtos in the core – YouYou Mar 20 '18 at 17:27
  • Do you need the decoupling? Don't do something just because it seems like a good idea. Do it because you have a specific need. – Robert Harvey Mar 20 '18 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.