[JAVA-SPRING;KOTLIN-SPRING] improvement: Allow autoXSpringPaginated for endpoints without sort - #24863
Draft
Picazsoo wants to merge 1 commit into
Conversation
Change autoXSpringPaginated from a boolean switch into a string-enum option
with three canonical values:
- none: disable auto-detection (default)
- page-size-sort: require page, size, and sort query parameters (identical
to the previous true behavior)
- page-size: require only page and size; sort may be absent (new)
The legacy true/false values are still accepted as deprecated aliases for
page-size-sort/none respectively. A deprecation warning is logged once via
the generator logger only when the option is explicitly set to true/false;
leaving the option unset keeps the silent none default with no warning.
- Add SpringPageableScanUtils.AutoPaginationMode enum and
resolveAutoPaginationMode() to centralize parsing/validation/deprecation
warnings shared by SpringCodegen and KotlinSpringServerCodegen.
- Update willBePageable, applyAutoXSpringPaginatedIfNeeded, and the
scanSortValidationEnums/scanPageableDefaults/scanPageableConstraints/
scanAll methods to take AutoPaginationMode instead of boolean.
- Replace the boolean CLI switch with a documented string-enum CLI option
in SpringCodegen and KotlinSpringServerCodegen (JavaCamelServerCodegen
inherits the behavior since it extends SpringCodegen).
- Update existing tests to use the new enum where internal signatures
changed; add new tests for page-size mode detection, deprecation
warnings (once when explicit, never when unset), and invalid values.
- Regenerate docs/generators/{spring,kotlin-spring,java-camel}.md.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
autoXSpringPaginated for endpoints without sort
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.
Change autoXSpringPaginated from a boolean switch into a string-enum option with three canonical values:
The legacy true/false values are still accepted as deprecated aliases for page-size-sort/none respectively. A deprecation warning is logged once via the generator logger only when the option is explicitly set to true/false; leaving the option unset keeps the silent none default with no warning.
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
Summary by cubic
Changes
autoXSpringPaginatedfrom a boolean switch into a string-enum option so Spring generators can auto-detect Pageable endpoints that have onlypageandsize(nosort). Previously auto-detection required all three parameters; nowpage-sizemode is available, and the defaultnonedisables auto-detection.none,page-size-sort, andpage-size;page-size-sortmatches the oldtruebehavior.true/falsevalues still work but log a deprecation warning when explicitly set; the unset default stays silent.SpringPageableScanUtilsand shared bySpringCodegen,KotlinSpringServerCodegen, andJavaCamelServerCodegen.page-sizedetection, deprecation warnings, and invalid values; regenerates generator docs.Written for commit 3c5e26a. Summary will update on new commits.