Skip to content
Advertisement

Java Spring Boot OpenApi 3 – How to add description for RequestBody?

I want to have a description for RequestBody in spring boot openapi 3 . so i make my code like this :

JavaScript

RequestBody description is Book to add. My desire UI is like this :

desire

But nothings happen ! There is no description in my UI.

description was added to Schemas panel Book entity !!! result

What is the problem ?

Advertisement

Answer

From your Code Snippet it seems to me as if your description actually belongs into the @RequestBody Annotation instead of the @Schema Annotation.

With @Schema you define and describe your Models but what you actually want to do is to describe the parameter in the context of your operation.

Try something along the lines of:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement