I have a POJO request which I am trying to document with swagger and openapiv3.
The code is straightforward:
@RestController
class ReportController {
@GetMapping("/getReport")
String getReport(@RequestBody Report report) {
record Report(
@Schema(description = "Some field", minLength = 1, maxLength = 10) String somefield,
String someFieldOnlyAvailableSinceVersion2) {
}
I am hoping to have an annotation, something like @Version("v2"), @Since("v2")
, which can tell in the generated document page that the field is available only since version.
What I am trying so far is:
record Report(
@Schema(description = "Some field", minLength = 1, maxLength = 10) String somefield,
@Schema(description = "Some field only available since version 2", minLength = 1, maxLength = 5)String someFieldOnlyAvailableSinceVersion2) {
}
While there is some info displayed in the generated doc, I was hoping for an annotation that can mention the version since.
The question is not about validating the field with spring validation.
What would be the way to tell swagger openapiv3 the field is only available since a particular version?