title: How to validate parameters for rest controller
body: <p>I have multiple parameters that are not required. I was wondering if it is possible to validate non-required parameters. For instance, I have &quot;name&quot; field which is not a required parameter. I want to check if it is not blank when api is exposed.</p>
  <pre><code>@GetMapping
  public Response method(@RequestParam(&quot;firstname&quot;) @NotBlank String firstName) {
  ...
  ...
  </code></pre>
  <p>I am new to spring and rest controller so I am not sure if this is even right approach. I want this api to not require firstname but if it is in parameter, I want to make sure something is in there. Is this possible to achieve? If so, how?</p>