Skip to content

[Spring] generate paginated resources #3353

@cbornet

Description

@cbornet

To follow the discussion from #3133
The idea is to generate Page/Pageable if the operation has a "x-spring-paginated" vendor-extension.

I just tried

    public ResponseEntity<List<Pet>> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List<String> tags, Pageable pageable) {
        ArrayList<Pet> petList = new ArrayList<Pet>();
        Page<Pet> page = new PageImpl(petList, pageable, 0);
        // do some magic!
        return new ResponseEntity<List<Pet>>(page.getContent(), HttpStatus.OK);
    }

in spring-boot after including spring-data-commons and didn't have any issue.
I didn't have to configure any datasource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions