Document a field starting, available since a version with Swagger OpenAPIv3 with Java Spring Boot, - Stack Overflow

I have a POJO request which I am trying to document with swagger and openapiv3.The code is straightfor

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?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745290783a4620843.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信