I have a REST endpoint that has a request parameter “myParam”. This is a required parameter without which any GET request made to this endpoint is considered a bad request. I’m using Swagger to highlight the fact that this parameter is required, as follows
@ApiParam(required = true) @RequestParam(value = "myParam") String myParam
The problem is that when I submit a GET to this endpoint via Postman the HTTP error returned is a 500 saying that the required parameter myParam is not provided. Is there any way to refactor this so that if a parameter labelled by Swagger as required is missing the response is 404 instead?