Skip to content

fix(processor): document Pageable as page, size and sort in OpenAPI - #8

Merged
notablogger merged 1 commit into
mainfrom
fix/pageable-openapi-params
Oct 23, 2026
Merged

notablogger merged 1 commit into
mainfrom
fix/pageable-openapi-params

Conversation

@notablogger

Copy link
Copy Markdown
Owner

Summary

With pageable = true, the generated findAll(Pageable pageable) was documented in /v3/api-docs as a single required query parameter pageable of type object, instead of the optional page / size / sort parameters the endpoint actually takes. The endpoint itself always worked; only the API docs (Swagger UI, generated clients) were wrong.

Type

  • 🐛 Bug fix
  • ✨ New feature / annotation attribute
  • ♻️ Refactor (no behaviour change)
  • 🧪 Tests only
  • 📝 Documentation only
  • 🔧 Build / CI change

Related issue

None

What was changed

  • RestControllerGenerator: the Pageable parameter gets springdoc's @ParameterObject when org.springdoc.core.annotations.ParameterObject is on the processing classpath. Without springdoc nothing changes (no springdoc annotation is generated).
  • RestControllerGeneratorTest: new test for both cases (springdoc present → @ParameterObject Pageable pageable; absent → no annotation).

No breaking change — can ship as a 3.0.x patch. (#6 uses the same mechanism for its filter parameter; it will be reconciled when either merges.)

How to test

  1. Entity with @ExposeEntity(path = "products", pageable = true) in an app with springdoc.
  2. GET /v3/api-docs → /api/products GET lists page, size, sort as optional query params.

Verified end-to-end with this branch published to mavenLocal and a Spring Boot 4.0.8 + springdoc 3.0.3 app:

Before After
Parameters pageable — required, $ref: Pageable (object) page (integer, default 0), size (integer, default 20), sort (array of string) — all optional
GET ?page=0&size=1&sort=name,desc 200 200

Generated output (if applicable)

Generated source diff
// before
public ResponseEntity<Page<ProductDto>> findAll(Pageable pageable)
// after (springdoc on the classpath)
public ResponseEntity<Page<ProductDto>> findAll(@ParameterObject Pageable pageable)

Checklist

  • All existing tests pass (./gradlew :processor:test) — 59/59; ./gradlew build clean
  • New tests added / updated to cover the change
  • No MapStruct warnings in the sample project — not run
  • README.md updated if a public API / annotation attribute changed — n/a
  • docs/tech/ updated if architecture or generated artifacts changed — n/a
  • Commit messages follow type(scope): description format

Generated by Claude Code

With pageable = true the generated findAll(Pageable pageable) showed up
in /v3/api-docs as one *required* query parameter "pageable" of type
object, so Swagger UI and generated clients asked for an object instead
of the optional page / size / sort parameters the endpoint really takes.

The Pageable parameter now gets springdoc's @ParameterObject when
springdoc is on the processing classpath (no springdoc → no annotation,
as before).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LcaFXaRgJhB2GBCbwnAc6V
@notablogger
notablogger marked this pull request as ready for review October 23, 2026 08:47
@notablogger
notablogger merged commit 166b003 into main Oct 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants