Showing results for 
Search instead for 
Did you mean: 

Openapi working in postman and not working in swagger-ui

Occasional Visitor

Openapi working in postman and not working in swagger-ui

After generating endpoints from Openapi i am getting 501 error(method unimplemented) in Swagger-UI.

However when using postman its working fine.

The following endpoint was generated using openapi

public class CustomerApiController implements CustomerApi {
    private final NativeWebRequest request;
    public CustomerApiController(NativeWebRequest request) {
        this.request = request;
    public ResponseEntity<Void> createCustomer(@ApiParam(value = "create customer"  )  @Valid @RequestBody CustomerDto customerDto) {
        return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);


Together with the following interface


@Api(value = "customer", description = "the customer API")
public interface CustomerApi {

    @ApiOperation(value = "", nickname = "createCustomer", notes = "", tags={ "customer", })
    @ApiResponses(value = { 
        @ApiResponse(code = 201, message = "Created"),
        @ApiResponse(code = 405, message = "Invalid input") })
    @RequestMapping(value = "/customer/create",
        consumes = { "application/json" },
        method = RequestMethod.POST)
    ResponseEntity<Void> createCustomer(@ApiParam(value = "create customer"  )  @Valid @RequestBody CustomerDto customerDto);


Rest Endpoint implementation :

public class CustomerController implements CustomerApi {
    public ResponseEntity<Void> createCustomer(@Valid CustomerDto customerDto) {
        return new ResponseEntity<>(HttpStatus.CREATED);

Executing the above in postman works perfect.however in swagger-ui it results in 501 error.


What might be the issue ?

New Here?
Join us and watch the welcome video:
Top Kudoed Authors