Skip to content

fix(spring): preserve original operation ID for pageable - #24724

Open
wassuh0520 wants to merge 2 commits into
OpenAPITools:masterfrom
wassuh0520:fix/issue-24721-pageable-operation-id
Open

fix(spring): preserve original operation ID for pageable#24724
wassuh0520 wants to merge 2 commits into
OpenAPITools:masterfrom
wassuh0520:fix/issue-24721-pageable-operation-id

Conversation

@wassuh0520

@wassuh0520 wassuh0520 commented Aug 17, 2026

Copy link
Copy Markdown

Summary

Fix Spring pageable annotation generation when an OpenAPI operationId is normalized during code
generation.

For example, list-items is normalized to listItems, but the pageable registries are populated
using the original OpenAPI operation ID. The generated operation now uses operationIdOriginal for
registry lookups, with a fallback to the normalized operationId.

Changes

  • Use CodegenOperation.operationIdOriginal when applying pageable annotations.
  • Preserve the normalized operationId as a fallback when no original ID exists.
  • Add an end-to-end regression test for operationId: list-items.
  • Add a minimal OpenAPI fixture covering pageable constraints, sort validation, pageable defaults,
    and sort defaults.

Validation

  • SpringPageableScanUtilsTest: 27 tests passed.
  • SpringCodegenTest#pageableAnnotationsUseOriginalOperationId_issue24721: passed.
  • Full SpringCodegenTest: 328 tests passed.

Summary by cubic

Preserves the original OpenAPI operationId when generating Spring pageable annotations to avoid mismatches after normalization. Previously, registries were keyed by the original ID while generation used the normalized ID; lookup now prefers operationIdOriginal with a fallback to operationId.

  • In SpringPageableScanUtils.applyPageableAnnotations, use CodegenOperation.operationIdOriginal when present; otherwise use operationId.
  • Adds a unit test covering original-ID registry lookup and an end-to-end test validating operationId: list-items generates listItems with the expected pageable and sort annotations.
  • Adds 3_0/spring/issue_24721.yaml fixture covering pageable constraints and sort defaults.
  • No migration required; only pageable annotation resolution for sanitized operation IDs changes.

Written for commit 1b1b14e. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

@wing328

wing328 commented Aug 18, 2026

Copy link
Copy Markdown
Member

thanks for the pr

cc @cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09) @martin-mfg (2023/08) @KannaKim (2026/07)

.fileContains("@PageableDefault(page = 0, size = 25)")
.fileContains("@SortDefault.SortDefaults({@SortDefault(sort = {\"name\"}, direction = Sort.Direction.DESC)})");
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR and adding the test

should the test look for the original operationId list-items in the output to confirm it's preserved?

@wassuh0520 wassuh0520 Aug 21, 2026

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion.

I added a focused unit test which explicitly sets the generated operation ID to listItems, keeps operationIdOriginal as list-items, and uses pageable registries keyed only by list-items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants