title: OpenApi add example for request body
body: <p>Am working with Spring boot and I am using <a href="https://mvnrepository.com/artifact/org.springdoc/springdoc-openapi-ui" rel="nofollow noreferrer">springdoc-openapi-ui</a> to generate spec files using <a href="https://editor.swagger.io/" rel="nofollow noreferrer">swagger editor</a>
  The issue Is, Am trying to avoid creating model classes just to use them in the request body to show them with swagger UI.
  For example :</p>
  <pre><code>    @RequestMapping(value = &quot;/update/project/{id}&quot;, method = RequestMethod.POST,
      produces = MediaType.APPLICATION_JSON_VALUE)
      public ResponseEntity&lt;String&gt; projectUpdate(@RequestBody ObjectNode json, @PathVariable int id)  
      { ... } 
  </code></pre>
  <p>If I use it like this, the example will be empty on the Swagger UI page.
  So as a solution, I have to do it like the following</p>
  <pre><code>public class CustomerCreateRequest {
      
      @JsonProperty
      private String ProjectId;
      @JsonProperty
      private String ProjectName;
      @JsonProperty
      private String ProjectDescription;
      @JsonProperty
      private String CustomerId;
      @JsonProperty
      private String CustomerName;
      @JsonProperty
      private String CustomerDescription;
      @JsonProperty
      private String BucketId;
      @JsonProperty
      private String API_KEY;
      @JsonProperty
      private String Name;
      @JsonProperty
      private String RedmineId;
  </code></pre>
  <p>And then I can use the model class I just created like the following.</p>
  <pre><code>@PostMapping(value = &quot;/createUser&quot;)
      public ResponseEntity createCustomer(@RequestBody CustomerCreateRequest requestBody)
      { ... } 
  </code></pre>
  <p><strong>Question</strong></p>
  <ul>
  <li>Is it ok to do a model class just for this purpose?</li>
  <li>Is there a way to add an example so the UI team will have an idea of how to use it.</li>
  <li>I know that a model class can be helpful in generating a client for UI ( like JSClient ) But is it really necessary? I mean can't we overcome this issue?</li>
  </ul>
  <p>Any Answer, Suggestion, Links are appreciated, the <a href="https://swagger.io/docs/specification/describing-request-body/" rel="nofollow noreferrer">swagger docs</a> was not helpful in my case.</p>