Service dependencies
A class diagram. A controller with its service and mapper, and the service's repository, validator and event publisher, laid out left to right.






┌────────────────────────┐
│ OrderRepository │
1 ├────────────────────────┤
┌─►│ + save(order): void │
│ │ + findById(id): Order │
│ └────────────────────────┘
│
│
┌──────────────────────────┐ 1 │ ┌────────────────────────┐
1 │ OrderService │───┘ │ OrderValidator │
┌─►├──────────────────────────┤─────►├────────────────────────┤
┌──────────────────────────┐ │ │ + placeOrder(cmd): Order │───┐ │ + validate(cmd): bool │
│ OrderController │───┘ └──────────────────────────┘ │ └────────────────────────┘
├──────────────────────────┤ 1 │
│ + create(req): Response │───┐ │
└──────────────────────────┘ │ ┌──────────────────────┐ │ ┌────────────────────────┐
│ │ OrderMapper │ │ │ EventPublisher │
└─►├──────────────────────┤ └─►├────────────────────────┤
│ + toDto(order): Dto │ │ + publish(event): void │
└──────────────────────┘ └────────────────────────┘
Spec
{ "type": "class", "direction": "RIGHT", "classes": [ { "id": "controller", "label": "OrderController", "methods": [{"visibility": "+", "text": "create(req): Response"}] }, { "id": "service", "label": "OrderService", "methods": [{"visibility": "+", "text": "placeOrder(cmd): Order"}] }, { "id": "repo", "label": "OrderRepository", "methods": [ {"visibility": "+", "text": "save(order): void"}, {"visibility": "+", "text": "findById(id): Order"} ] }, { "id": "validator", "label": "OrderValidator", "methods": [{"visibility": "+", "text": "validate(cmd): bool"}] }, { "id": "publisher", "label": "EventPublisher", "methods": [{"visibility": "+", "text": "publish(event): void"}] }, { "id": "mapper", "label": "OrderMapper", "methods": [{"visibility": "+", "text": "toDto(order): Dto"}] } ], "relations": [ { "id": "r-controller-service", "from": "controller", "to": "service", "kind": "association", "directed": true, "from_card": "1", "to_card": "1" }, { "id": "r-controller-mapper", "from": "controller", "to": "mapper", "kind": "association", "directed": true }, { "id": "r-service-repo", "from": "service", "to": "repo", "kind": "association", "directed": true, "from_card": "1", "to_card": "1" }, { "id": "r-service-validator", "from": "service", "to": "validator", "kind": "association", "directed": true }, { "id": "r-service-publisher", "from": "service", "to": "publisher", "kind": "association", "directed": true } ]}Draw it yourself
diago render service-dependencies.json > service-dependencies.svgOpen it in the playground to edit it in your browser.