swagger-api / swagger-api/swagger-codegen

[Spring] generate paginated resources

Open
#3,353 10 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature Server: Spring
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked discussion in issue #3133 and the repository's Spring generation path, then trace how vendor extensions reach generated operations. Done means operations marked with x-spring-paginated generate the intended Page/Pageable-based Java Spring resources without requiring datasource configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring, spring-boot
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.