title: How to add an example in @ApiResponse with Swagger?
body: <p>I would like to add an example with Swagger in my method, I have tried a few things, but they didn't work.</p>
  <p>I have my Interface, where I define the method:</p>
  <pre><code>@Api(value = &quot;test API&quot;)
  @RequestMapping(&quot;/api/v1/product&quot;)
  public interface TestController {
  
      @ApiOperation(
              value = &quot;Service that return a Product&quot;,
              notes = &quot;This service returns a Product by the ID&quot;,
              nickname = &quot;getProductById&quot;,
              response = ProductResponse.class)
      @ApiResponses(value = {
              @ApiResponse(code = 200, message = &quot;The request has succeeded.&quot;, response = ProductResponse.class),
              @ApiResponse(code = 500, message = &quot;Internal server error.&quot;, response = ProductResponse.class) })
      @GetMapping(
              value = &quot;/productById&quot;,
              produces = { &quot;application/json&quot; }
      )
      ResponseEntity&lt;ProductResponse&gt; getProductById(@RequestParam(value = &quot;productId&quot;, required = true) String productId);
  </code></pre>
  <p>The ProductResponse class is the following:</p>
  <pre><code>@Getter
  @Setter
  @AllArgsConstructor
  public class ProductResponse {
  
      private Product product;
      private CustomException customException;
  
  }
  </code></pre>
  <p>The Product class is the following:</p>
  <pre><code>@Getter
  @Setter
  @AllArgsConstructor
  public class Product {
  
      @JsonProperty(&quot;id&quot;)
      private String id;
  
      @JsonProperty(&quot;productName&quot;)
      private String productName;
  
      @JsonProperty(&quot;productDescription&quot;)
      private String productDescription;
  
      @JsonProperty(&quot;unitPrice&quot;)
      private Double unitPrice;
  </code></pre>
  <p>And the CustomException class is the following:</p>
  <pre><code>@Getter
  public class CustomException {
  
      private final String message;
      private final String errorCode;
      private final String errorType;
      private final Exception exceptionDetail;
      
      public CustomException(String message, String errorCode, String errorType, Exception exceptionDetail) {
          this.message = message;
          this.errorCode = errorCode;
          this.errorType = errorType;
          this.exceptionDetail = exceptionDetail;
      }
  </code></pre>
  <p>When the response is 200, the response is like:</p>
  <pre><code>{
    &quot;product&quot;: {
      &quot;id&quot;: &quot;12345&quot;,
      &quot;productName&quot;: &quot;Product name&quot;,
      &quot;productDescription&quot;: &quot;This is a description&quot;,
      &quot;unitPrice&quot;: 3.25
    },
    &quot;customException&quot;: null
  }
  </code></pre>
  <p>But when the response is 500, the response is like:</p>
  <pre><code>{
    &quot;product&quot;: &quot;null,&quot;,
    &quot;customException&quot;: {
      &quot;message&quot;: &quot;/ by zero&quot;,
      &quot;errorCode&quot;: &quot;500&quot;,
      &quot;errorType&quot;: &quot;Internal server error&quot;,
      &quot;exceptionDetail&quot;: null,
      &quot;cause&quot;: null,
      &quot;stackTrace&quot;: [
        {
          &quot;classLoaderName&quot;: &quot;app&quot;,
          &quot;moduleName&quot;: null,
          &quot;moduleVersion&quot;: null,
          &quot;methodName&quot;: &quot;getProductById&quot;,
          &quot;fileName&quot;: &quot;TestControllerImpl.java&quot;,
          &quot;lineNumber&quot;: 33,
          &quot;className&quot;: &quot;com.myproject.testmicroservice.controller.impl.TestControllerImpl&quot;,
          &quot;nativeMethod&quot;: false
        }
      ]
    }
  }
  </code></pre>
  <p>How can I add a custom example in the @ApiResponse annotation?</p>