So I have used OpenApi Generator to generate java classes (controller interfaces and response class). But because I set flag user-optional to true, every parameter which is not required in request is wrapped as Optional, but if I add constrains to min and max value my parameters looks like following: @Min(1) @Max(10) Optional<Long> value, and obviously my java app is not happy because there is no such validator which will validate Optional.
My snippet of generator file looks like that:
/test:
get:
tags:
- test
summary: Make it work already
parameters:
- name: id
in: query
required: true
schema:
type: string
- name: range
in: query
required: false
schema:
type: integer
format: int64
minimum: 1
maximum: 10
.
.
. etc
And second parameter looks like that @Min(1) @Max(10) @RequestParam(value="range", required = false) Optional<Long> value
Is there way to tell OpenApi to put validators inside of Optional?