OpenAPITools / OpenAPITools/openapi-generator

[REQ] [Java][Spring] Return 'Page<Model>' instead of 'List<Model>' when using 'x-spring-paginated'

Open
#14,062 23 comments 20 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Is your feature request related to a problem? Please describe.

When using Spring Data Pageable in classes generated with the Spring generator and x-spring-paginated: true I would expect the return type to be Page<Model> instead of List<Model>.

Describe the solution you'd like

The Spring generator should return Page<Model> instead of List<Model> when using x-spring-paginated: true.

This has also been requested by @amelnikoff at https://github.com/OpenAPITools/openapi-generator/issues/8315#issuecomment-797010332

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 locating the Spring generator code that handles x-spring-paginated and any tests covering generated paginated methods. The change is complete when that flag produces Page return types instead of List, while other return types remain unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend, tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.