Fork me on GitHub

is adding validation layer between rest API and storage layer good?


so this simple architecture for restful service should be 3 layers: 1- rest APIs which has the business logic and full control 2- validation layer which is another layer to ask about the input and output data 3- storage layer


so the flow should be: 1. input should hit the rest API layer 2. rest API layer should ask validation layer 3. if validation layer success then ingest the data, else return error


4. if ingesting of data success return success, else return error and roll down.


This is the sort of thing we use clojure.spec for. So I wouldn't say it's another layer but it is very structured and we have some macros to reduce boilerplate.

👍 4