Validating query strings


I’m trying to validate query strings according to this JSONAPI specification:

If a server is unable to identify a relationship path or does not support inclusion of resources from a path, it MUST respond with 400 Bad Request.

What is a good way to validate query strings (or best practices)? Seems like the validator only validates against the request body. Currently just calling an instance method inside a controller doesn’t seem like a scalable solution and goes against the DRY principle.


You can define your own custom data object. More in docs


Perfect! I should’ve read the docs more carefully. Thank you @virk!


@virk I ended up creating a PR on indicative repo that should help others implement this part of JSONAPI validation (which requires checking if array1 is a subset of array2):