logoalt Hacker News

Onavotoday at 12:42 AM2 repliesview on HN

With this you don't need to have two sources of truth on the backend. Previously you will end up with one set of DB ORM level validation and a second set of validation on the data transfer object and you have to make sure the types line up. Now the data transfer object will automatically inherit the correct types.


Replies

gavmortoday at 1:29 AM

The two sources of truth are for two disparate adapters. Neither the API nor the DB define the domain, but both must adapt the domain to their respective implementation concerns.

The ontology of your persistence layer should be entirely uncoupled from that of your API, which must accommodate an external client.

In theory, anyway.

show 1 reply
mr_Fatalysttoday at 1:06 AM

Exactly, that's the idea.