Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dynamic evaluation of description field in the RequestBody annotation #2488

Closed
kbos-work opened this issue Jan 22, 2024 · 4 comments · Fixed by #2492
Closed

Support dynamic evaluation of description field in the RequestBody annotation #2488

kbos-work opened this issue Jan 22, 2024 · 4 comments · Fixed by #2492

Comments

@kbos-work
Copy link
Contributor

kbos-work commented Jan 22, 2024

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

@kbos-work kbos-work changed the title Support dynamic evaluation of description fielkd in the RequestBody annotation Support dynamic evaluation of description field in the RequestBody annotation Jan 22, 2024
@vsadokhin
Copy link

+1

@esirkova
Copy link

It would resolve also swagger-api/swagger-ui#9296

@scintilla932
Copy link

Thanks @esirkova

BokoEnos pushed a commit to BokoEnos/springdoc-openapi that referenced this issue Jan 25, 2024
BokoEnos pushed a commit to BokoEnos/springdoc-openapi that referenced this issue Jan 25, 2024
@BokoEnos
Copy link

I pushed a PR from my personal account today, so please have a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants