0013 - Deprecate global request/response models
Context and Problem Statement
Our Angular application currently partially uses a layered folder structure. This results in a domain context being split between multiple folders several levels deep. This causes friction since modifying services often requires modifying the models belonging to that service.
Understandably our application uses a lot of models, however the biggest and most isolated part of the models are the request and responses. Which makes them a good starting point.
- Continue as is - We can continue as we are, and continue to put models in
- Place models next to their owner - Request and responses are owned by a single API service. They can therefore be placed close to their service which keeps connected changes close to each other.
Use the Place models next to their owner for request and response models.
A rule of thumb is to put any model that is used in the abstraction in the abstraction directory. And any model used in the service in the service directory. Abstractions are part of the service public interface, while services are part of the internal interface.
folder.response.ts (Exposed as public API)
folder.request.ts (Internal, only used within the implementation)