fix(spring): preserve original operation ID for pageable - #24724
Open
wassuh0520 wants to merge 2 commits into
Open
fix(spring): preserve original operation ID for pageable#24724wassuh0520 wants to merge 2 commits into
wassuh0520 wants to merge 2 commits into
Conversation
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) |
wing328
reviewed
Aug 21, 2026
| .fileContains("@PageableDefault(page = 0, size = 25)") | ||
| .fileContains("@SortDefault.SortDefaults({@SortDefault(sort = {\"name\"}, direction = Sort.Direction.DESC)})"); | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
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?
Author
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix Spring pageable annotation generation when an OpenAPI
operationIdis normalized during codegeneration.
For example,
list-itemsis normalized tolistItems, but the pageable registries are populatedusing the original OpenAPI operation ID. The generated operation now uses
operationIdOriginalforregistry lookups, with a fallback to the normalized
operationId.Changes
CodegenOperation.operationIdOriginalwhen applying pageable annotations.operationIdas a fallback when no original ID exists.operationId: list-items.and sort defaults.
Validation
SpringPageableScanUtilsTest: 27 tests passed.SpringCodegenTest#pageableAnnotationsUseOriginalOperationId_issue24721: passed.SpringCodegenTest: 328 tests passed.Summary by cubic
Preserves the original OpenAPI
operationIdwhen 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 prefersoperationIdOriginalwith a fallback tooperationId.operationId: list-itemsgenerateslistItemswith the expected pageable and sort annotations.3_0/spring/issue_24721.yamlfixture covering pageable constraints and sort defaults.Written for commit 1b1b14e. Summary will update on new commits.