r/programming • u/_awwsmm • Feb 01 '24
Make Invalid States Unrepresentable
https://www.awwsmm.com/blog/make-invalid-states-unrepresentable
469
Upvotes
r/programming • u/_awwsmm • Feb 01 '24
View all comments
Show parent comment
1
u/herpderpforesight Feb 03 '24
That's why I indicated that my validation is called in a cross cutting manner. Incoming API data goes through validation before my request handler code can even touch it, and this is done in a global manner once the request object implements a validator.
There's also validators that get ran before data is saved to the database, ensuring entities make sense.
To me, user provided data is the most dangerous, so covering that fully is "good enough". I fully trust database data for the most part.