admin管理员组文章数量:1435859
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?
本文标签:
版权声明:本文标题:Document a field starting, available since a version with Swagger OpenAPIv3 with Java Spring Boot, - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745290783a2651779.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论