Fork me on GitHub
#architecture
<
2019-08-08
>
abdullahibra15:08:18

for rest API design, how separating the validation of request and response from the business logic code?

lukasz15:08:21

Our services validate request and response data at the "edge" - I wrote a middleware which uses Avro schemas for input/output validation. It's sort of a RPC framework (POST requests only, can speak JSON or Avro, generates documentation out of schema + endpoint configuration, Avro was chosen because we can use it in other languages, something you can't do with spec or Schema). Everything else we tried failed in some way - either validations were spread over too many namespaces or we had very brittle schemas which couldn't be easily shared. In my opinion without going very strict, it's very hard to maintain the separation.

lukasz15:08:32

Also, I'm planning to open source the mentioned middleware