How to change the response status code for successful operation in Swagger?
<p>As shown in the image, it says "Response Class (Status 200)" for the add operation. However, the add operation has been implemented in such a way that it will never return 200. It returns 201 on success.</p>

<p>My question is how can I change the (Status 200) to (Status 201)?
The code for this part is as follows:</p>

<pre><code>@RequestMapping(method = RequestMethod.PUT, value = "/add")
@ApiOperation(value = "Creates a new person", code = 201)
@ApiResponses(value = {
        @ApiResponse(code = 201, message = "Record created successfully"),
        @ApiResponse(code = 409, message = "ID already taken")
})
public ResponseEntity&lt;String&gt; add(@RequestParam(value = "name", required = true) String name,
        @RequestParam(value = "id", required = true) String id) {
    if (PD.searchByID(id).size() == 0) {
        Person p = new Person(name, id);
        PD.addPerson(p);
        System.out.println("Person added.");
        return new ResponseEntity&lt;String&gt;(HttpStatus.CREATED);
    } else {
        System.out.println("ID already taken.");
        return new ResponseEntity&lt;String&gt;(HttpStatus.CONFLICT);
    }
}
</code></pre>

<p>Thanks!</p>

<p><a href="https://i.stack.imgur.com/ATkiN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ATkiN.png" alt="enter image description here"></a></p>