I'm wondering, what could be a good and scalable way to validate if API request is well formed, before processing it. Rails has strong params for that, but I have a case when an API endpoint suppose to receive relatively complex chunk of data. About 20 params, plus couple of arrays of nested objects.
I was thinking about using JSON Schema for that. The good thing is that it will allow to do more validation for HTTP request payload. Like data types, string lengths, mandatory params, etc. More than what
ActionController::Parameters can do.
But I would still appreciate to hear about alternatives, may be libraries or best practices people in Ruby world use to solve this.
I've implemented it with JSON Schema. So far, it works pretty fine. And here are few more references I found:
Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.