springdoc-openapi
springdoc-openapi copied to clipboard
Support dynamic evaluation of description field in the RequestBody annotation
Is your feature request related to a problem? Please describe.
While using the @RequestBody
annotation it doesn't replace variable content ${myapicall.request_body.description}
for the description. Example the following will result in outputting the variable as is inside the swagger doc
@RequestBody(description = "${myapicall.request_body.description}")
Describe the solution you'd like
While using annotations in for example @Operation
and @Parameter
it supports dynamic evaluation of properties. For example the following will generate the swagger doc in which the summary/descriptions are replaced with the corresponding values from the property file
@Operation(summary = "${myapicall.summary}", description = "${myapicall.description}")
public ResponseEntity<Object> doApiCall(@Parameter(description = "${myapicall.params.example}", required = true) @RequestParam String example) {
}
It would be great if the same would be supported for @RequestBody
. Looking deeper in the source it would effectively mean to support the usage of PropertyResolverUtils inside the RequestBodyService similar to GenericParameterService
Describe alternatives you've considered
- Only real alternative is defining it directly in code, but in case of an multi language setup that would not work
Additional context
None
+1
It would resolve also https://github.com/swagger-api/swagger-ui/issues/9296
Thanks @esirkova
I pushed a PR from my personal account today, so please have a look