I have an API to retrive all products with Paging and Sorting functions as follow:

        @ApiImplicitParam(name = "page", dataType = "integer", paramType = "query", value = "The page number that should be returned. Default is 0."),
        @ApiImplicitParam(name = "size", dataType = "integer", paramType = "query", value = "How many items the page should have. Default is 20."),
        @ApiImplicitParam(name = "sort", allowMultiple = true, dataType = "string", paramType = "query", value = "Sorting order, e.g. asc or desc. Default is asc")})
public ResponseEntity<Product[]> getAllProducts(Pageable pageable) {}

And then I use Codegen to generate Client API but the problem here is the method's signature that it generated is not the one that I am expecting:

public List<Product> getAllProductsUsingGET(Object page, Object size, List<String> sort){}

What I would like to have here is getAllProductsUsingGET(Pageable pageable)

Did I make some mistake with the configuration? Can anyone give me some hint how to achieve only pageable as parameter instead of each single property like that? Thank you very much!

0 Answers