Ever heard the phrase “Never Trust User Inputs”? This is one of the most important things a developer has to keep in mind while writing code. We have all been through the tedious task of validating request before starting to process it. If that’s not tedious enough, we also have to add test cases to verify that the validations indeed are working properly.
Wouldn’t it be great if all that extra work can be avoided just by using an open source Java library which does that for us!
Recently, we decided to use Swagger Request Validator that validates the Http request/response against an OpenAPI specification. The idea was to integrate this library with Grails framework. In this article, we will see how to achieve this without breaking a sweat.