You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Spring generator uses one-based API page default as zero-based Pageable default #25160
Hello @Pattrigue, thanks for the report. The cause is that the generator copies page.default from the spec straight into @PageableDefault(page = …). That annotation always counts pages from zero, and spring.data.web.pageable.one-indexed-parameters doesn't change it. So with default: 1 you get page index 1, which is the second page.
Until there's a proper fix (for example, an option to turn off generated pageable defaults or to declare one-based pagination), you can get the 7.24.0 output back by overriding a single template.
Workaround: override api.mustache via templateDir
@PageableDefault (along with @SortDefault.SortDefaults, @ValidPageable and @ValidSort) comes from the x-pageable-extra-annotation vendor extension. api.mustache renders it right before the Pageable pageable parameter. Remove that fragment and the parameter is generated as plain final Pageable pageable again, so Spring's own defaults (which follow one-indexed-parameters) apply.
1. Make a template directory in your project, e.g. src/main/openapi-templates/, and add a file named exactly api.mustache (full content below). Any template you don't override still comes from the built-in set.
Version match: this template is based on the current master copy of JavaSpring/api.mustache. If you're pinned to a different version, the safer option is to take that version's api.mustache and remove only the fragment shown in the diff above.
Everything in that extension is dropped: besides @PageableDefault, this also removes @SortDefault.SortDefaults and, if you enabled them, @ValidPageable/@ValidSort. That matches what 7.24.0 generated, but if you rely on any of them, you'll need to handle them another way for now.
Size default: without @PageableDefault, the page size comes from spring.data.web.pageable.default-page-size (default 20), not from the spec. Set it there if your spec uses a different value.
Leftover import: the org.springframework.data.web.PageableDefault import may still be generated but goes unused. It's harmless.
Remove the override after upgrading: a templateDir override hides later changes to that template. Once a fixed version is out, delete the override (or rebase it) so you don't miss future fixes. Thanks for reporting this bug! You are right about the issue. The cause is that the generator copies page.default from the spec straight into @PageableDefault(page = …). That annotation always counts pages from zero, and spring.data.web.pageable.one-indexed-parameters doesn't change it. So with default: 1 you get page index 1, which is the second page.
Until there's a proper fix (for example, an option to turn off generated pageable defaults or to declare one-based pagination), you can get the 7.24.0 output back by overriding a single template.
Workaround: override api.mustache via templateDir
@PageableDefault (along with @SortDefault.SortDefaults, @ValidPageable and @ValidSort) comes from the x-pageable-extra-annotation vendor extension. api.mustache renders it right before the Pageable pageable parameter. Remove that fragment and the parameter is generated as plain final Pageable pageable again, so Spring's own defaults (which follow one-indexed-parameters) apply.
1. Make a template directory in your project, e.g. src/main/openapi-templates/, and add a file named exactly api.mustache (full content below). Any template you don't override still comes from the built-in set.
Version match: this template is based on the current master copy of JavaSpring/api.mustache. If you're pinned to a different version, the safer option is to take that version's api.mustache and remove only the fragment shown in the diff above.
Everything in that extension is dropped: besides @PageableDefault, this also removes @SortDefault.SortDefaults and, if you enabled them, @ValidPageable/@ValidSort. That matches what 7.24.0 generated, but if you rely on any of them, you'll need to handle them another way for now.
Size default: without @PageableDefault, the page size comes from spring.data.web.pageable.default-page-size (default 20), not from the spec. Set it there if your spec uses a different value.
Leftover import: the org.springframework.data.web.PageableDefault import may still be generated but goes unused. It's harmless.
Remove the override after upgrading: a templateDir override hides later changes to that template. Once a fixed version is out, delete the override (or rebase it) so you don't miss future fixes.
I will try to prepare a comprehensive fix for the issue. It is present in both java-spring and kotlin-spring generators.
I think we should make it configurable via boolean generatePageableDefaults (default to true) to allow for skipping generation of any defaults annotations as well as to make the index configurable via boolean oneIndexedPageParameters (default to false). And we should warn during code generation, when we encounter pagedefault or pagemin = 1, if the oneIndexedPageParameters is unset (and hence defaulting to false) as that is probably by accident. Setting oneIndexedPageParameters to either true or false explicitly will silence the warning.
Hi @Pattrigue and @seonwooj0810, I've kept thinking about this bug and the fix we merged, and I'd like to propose a different approach. Also pinging @dfpatinoc and @wassuh0520, since you were both involved in the discussions around @ValidPageable and @PageableDefault.
There are really two separate problems here:
@PageableDefault(page = …) is always zero-based.
@ValidPageable validates the Pageable after Spring has already converted it.
Both currently depend on knowing whether the API is one-based. #25171 guesses this from minimum: 1, and my #25197 adds options for it. I think we can avoid the question entirely.
1. Stop generating page in @PageableDefault
I can't think of a realistic case where the default page should be anything other than "the first page". A default size makes sense; a default page really doesn't. If we never emit the page attribute, the Pageable defaults to index 0. That is the first page, whatever spring.data.web.pageable.one-indexed-parameters is set to. We can then drop all the logic that derives the page default from the spec. size and sort defaults would stay as they are.
If a spec sets a page.default that is not its first page, we could log a warning that it is ignored.
2. Validate the raw request values instead of the converted Pageable
By the time the Pageable exists, Spring Data has already changed the incoming values. In PageableHandlerMethodArgumentResolverSupport#parseAndApplyBoundaries, it:
subtracts 1 when one-indexed-parameters=true,
turns negative numbers into 0,
caps the value at the upper limit,
turns non-numeric input into 0.
So with one-based parameters, ?page=0 becomes -1, is then turned into 0, and looks like a perfectly valid first page. minPage can never reject it. Likewise, ?page=abc silently becomes page 0. However we shift the bounds, the validator only sees values that Spring has already adjusted.
The spec's minimum/maximum describe the values sent over the wire, so that is what we should validate:
Spring MVC: the annotation can stay on the Pageable parameter. Internally, the validator gets the current HttpServletRequest from RequestContextHolder (a ThreadLocal) and checks the raw page/size query parameters. The generator only treats parameters named exactly page/size/sort as pageable, so the names are known. The spec bounds go into the annotation as they are, with no shifting and no dependence on one-indexed-parameters.
WebFlux: there is no ThreadLocal request, and the Pageable already holds converted values. Here I'd put @ValidPageable on the ServerWebExchange parameter and validate exchange.getRequest().getQueryParams(). includeHttpRequestContext already defaults to true for reactive. We would only need to force it, ideally with a warning, when a user explicitly set it to false and generatePageableConstraintValidation is on.
Edge cases I'd handle:
No bound request (e.g. the method is called directly in a unit test): skip the check, as we do today for null.
Missing parameter: nothing to validate; the default applies.
Non-numeric value: report a violation instead of letting it silently become page 0.
Result
No new generator options and no runtime configuration needed. The generated code works out of the box with both one-indexed-parameters=true and false.
I would close Bugfix/25160 #25197, since it adds generatePageableDefaults and oneIndexedPageParameters, and open a new PR implementing the above for both spring and kotlin-spring.
Does this make sense to you? I'd especially welcome feedback on the WebFlux part, since it moves the annotation onto ServerWebExchange.
A follow-up on the WebFlux part of my previous comment. Moving @ValidPageable onto ServerWebExchange works, but then where the annotation goes depends on the stack (Pageable for MVC, the exchange for WebFlux), and reactive needs includeHttpRequestContext forced on. Here's an alternative that keeps the annotation on the Pageable parameter for both stacks. The cost is one small piece of configuration.
Variant B: the annotation only carries the bounds; a wrapping Pageable resolver does the checking
The generated method signatures stay as they are today:
A strict Pageable resolver checks the raw values, one per stack: MVC HandlerMethodArgumentResolver, WebFlux SyncHandlerMethodArgumentResolver.
It reads @ValidPageable/@ValidSort from the MethodParameter.
It checks the raw page/size/sort query values against them, taken from NativeWebRequest (MVC) or ServerWebExchange (WebFlux).
On a violation it throws ResponseStatusException(BAD_REQUEST) (400).
Otherwise it passes the call to Spring Data's own resolver, so one-indexed-parameters, max-page-size, @PageableDefault and prefixes keep working.
Both stacks share one framework-agnostic check: check(rawPage, rawSize, rawSorts, annotation).
The annotations become plain metadata.@ValidPageable/@ValidSort don't need a @Constraint validator at all, because the resolver is the only thing that reads them.
The generator generates the wiring alongside ValidPageable/ValidSort in configPackage:
a WebMvcConfigurer (servlet) that inserts the strict resolver at index 0, wrapping the PageableHandlerMethodArgumentResolver bean;
or a WebFluxConfigurer (reactive) that registers it via configureArgumentResolvers, wrapping a ReactivePageableHandlerMethodArgumentResolver.
Why it might be worth it
The annotation stays in the same place everywhere (on the Pageable), with the same bounds copied from the spec, independent of includeHttpRequestContext.
The validation reads the raw request values in both stacks: no ThreadLocal in MVC, and no ServerWebExchange parameter needed in WebFlux.
The check runs before the controller method, which is where Spring rejects other bad input too.
Users who import their own ValidPageable/ValidSort via importMappings can use the same pattern without generated code changing.
Costs / open questions
It isn't zero-config. The generated @Configuration must be picked up, either by component scanning of configPackage or by an @Import. If it isn't, the annotations do nothing, and nothing tells you.
WebFlux: as far as I know, Boot doesn't create a ReactivePageableHandlerMethodArgumentResolver bean. The generated config would have to create it, and users' customisations of it would need a hook.
More generated code: a resolver and a config class per stack, plus tests.
Optional extension: fail loudly when the resolver isn't wired in
The silent no-op above can be closed without any extra configuration:
The strict resolver returns a marker type, e.g. final class ValidatedPageRequest extends PageRequest. Extending PageRequest keeps existing instanceof PageRequest checks working.
@ValidPageable stays a @Constraint, but its validator only asserts that the Pageable it receives is that marker. If it isn't, it throws IllegalStateException("Strict pageable resolver is not registered; import <generated config>").
Spring's built-in method validation runs this validator in both MVC and WebFlux with no wiring, so a missing registration becomes an obvious error instead of silently skipped validation.
What it costs:
The failure shows up on the first request to a paginated endpoint, not at startup. That's still better than never.
The resolver must always return the marker, including when Spring Data falls back to Pageable.unpaged(). Otherwise the guard has to allow unpaged explicitly.
It adds one more generated type, and the annotation keeps a validator whose only job is to check the wiring.
It's separable: variant B works without it, and it could be added later, or behind a flag.
My preference
I still lean towards the simpler approach from my previous comment: the ThreadLocal in MVC and the exchange in WebFlux, both working out of the box. I'm posting variant B (with or without the guard) so we can compare. If maintainers prefer "the annotation always stays on Pageable" and accept generating a config class, I'm happy to implement it instead.
A short addendum to variant B: it's already possible today, with no generator changes, but #25171 gets in the way for one-based APIs.
Variant B works with the current generator via importMappings
The generator only writes the annotation usages (@ValidPageable(maxSize = …, minPage = …), @ValidSort(allowedValues = {…})) and resolves the classes through importMappings with putIfAbsent, so a user mapping wins:
// build.gradle.kts (openApiGenerate)
importMappings.set(mapOf(
"ValidPageable" to "com.example.validation.ValidPageable",
"ValidSort" to "com.example.validation.ValidSort",
))
The user then provides their own ValidPageable/ValidSort (plain metadata, or with the guard), the strict resolver, and the WebMvcConfigurer/WebFluxConfigurer that registers it. The generated controllers stay exactly as they are.
Things to watch out for:
Attribute names. The custom annotations must declare the attributes the generator writes: maxSize, maxPage, minSize, minPage and allowedValues.
Unused generated files. The generated ValidPageable/ValidSort sources are still written to configPackage, even with a custom mapping. Exclude them via .openapi-generator-ignore.
Flags. The annotations only appear with useBeanValidation, generatePageableConstraintValidation and generateSortValidation enabled.
Zero-based specs (minimum: 0 or no minimum) aren't affected; there the bounds are copied unchanged.
For one-based specs (pageminimum: 1), the problem is that the annotation doesn't say whether it was shifted. @ValidPageable(minPage = 0, maxPage = 99) could come from a zero-based spec with maximum: 99, or from a one-based spec with minimum: 1, maximum: 100 shifted down by #25171. A check of the raw values has to know from somewhere else and add 1 back:
Reading Spring's one-indexed-parameters setting is the obvious source, but the generator decides from the spec's minimum: 1, not from that setting. If a spec says minimum: 1 and the app is zero-based, the bounds are shifted anyway and the compensation goes wrong.
Assuming a convention, e.g. "all our APIs are one-based", also works, but only by agreement.
So #25171 makes the annotation correct for the stock validator, which checks the already-converted Pageable, but wrong for any check of the raw values, whether it's my original proposal or variant B. That's one more reason to copy the bounds unchanged: then the annotation always describes the value the client sends, and any implementation, generated or plugged in via importMappings, can use it directly.
Activity
Picazsoo commentedon Oct 8, 2026
Hello @Pattrigue, thanks for the report. The cause is that the generator copies
page.defaultfrom the spec straight into@PageableDefault(page = …). That annotation always counts pages from zero, andspring.data.web.pageable.one-indexed-parametersdoesn't change it. So withdefault: 1you get page index 1, which is the second page.Until there's a proper fix (for example, an option to turn off generated pageable defaults or to declare one-based pagination), you can get the 7.24.0 output back by overriding a single template.
Workaround: override
api.mustacheviatemplateDir@PageableDefault(along with@SortDefault.SortDefaults,@ValidPageableand@ValidSort) comes from thex-pageable-extra-annotationvendor extension.api.mustacherenders it right before thePageable pageableparameter. Remove that fragment and the parameter is generated as plainfinal Pageable pageableagain, so Spring's own defaults (which followone-indexed-parameters) apply.1. Make a template directory in your project, e.g.
src/main/openapi-templates/, and add a file named exactlyapi.mustache(full content below). Any template you don't override still comes from the built-in set.2. Point the generator at it:
Maven:
Gradle:
openApiGenerate { generatorName = "spring" templateDir = "$projectDir/src/main/openapi-templates" // ... your existing configuration ... }CLI:
3. The edited
api.mustache. The only change from the stock template is in thePageableparameter line. This fragment was removed:-{{#vendorExtensions.x-pageable-extra-annotation}}{{{.}}} {{/vendorExtensions.x-pageable-extra-annotation}}Full
api.mustacheNotes / caveats
mastercopy ofJavaSpring/api.mustache. If you're pinned to a different version, the safer option is to take that version'sapi.mustacheand remove only the fragment shown in the diff above.@PageableDefault, this also removes@SortDefault.SortDefaultsand, if you enabled them,@ValidPageable/@ValidSort. That matches what 7.24.0 generated, but if you rely on any of them, you'll need to handle them another way for now.@PageableDefault, the page size comes fromspring.data.web.pageable.default-page-size(default20), not from the spec. Set it there if your spec uses a different value.org.springframework.data.web.PageableDefaultimport may still be generated but goes unused. It's harmless.templateDiroverride hides later changes to that template. Once a fixed version is out, delete the override (or rebase it) so you don't miss future fixes. Thanks for reporting this bug! You are right about the issue. The cause is that the generator copiespage.defaultfrom the spec straight into@PageableDefault(page = …). That annotation always counts pages from zero, andspring.data.web.pageable.one-indexed-parametersdoesn't change it. So withdefault: 1you get page index 1, which is the second page.Until there's a proper fix (for example, an option to turn off generated pageable defaults or to declare one-based pagination), you can get the 7.24.0 output back by overriding a single template.
Workaround: override
api.mustacheviatemplateDir@PageableDefault(along with@SortDefault.SortDefaults,@ValidPageableand@ValidSort) comes from thex-pageable-extra-annotationvendor extension.api.mustacherenders it right before thePageable pageableparameter. Remove that fragment and the parameter is generated as plainfinal Pageable pageableagain, so Spring's own defaults (which followone-indexed-parameters) apply.1. Make a template directory in your project, e.g.
src/main/openapi-templates/, and add a file named exactlyapi.mustache(full content below). Any template you don't override still comes from the built-in set.2. Point the generator at it:
Maven:
Gradle:
openApiGenerate { generatorName = "spring" templateDir = "$projectDir/src/main/openapi-templates" // ... your existing configuration ... }CLI:
3. The edited
api.mustache. The only change from the stock template is in thePageableparameter line. This fragment was removed:-{{#vendorExtensions.x-pageable-extra-annotation}}{{{.}}} {{/vendorExtensions.x-pageable-extra-annotation}}Full
api.mustacheNotes / caveats
mastercopy ofJavaSpring/api.mustache. If you're pinned to a different version, the safer option is to take that version'sapi.mustacheand remove only the fragment shown in the diff above.@PageableDefault, this also removes@SortDefault.SortDefaultsand, if you enabled them,@ValidPageable/@ValidSort. That matches what 7.24.0 generated, but if you rely on any of them, you'll need to handle them another way for now.@PageableDefault, the page size comes fromspring.data.web.pageable.default-page-size(default20), not from the spec. Set it there if your spec uses a different value.org.springframework.data.web.PageableDefaultimport may still be generated but goes unused. It's harmless.templateDiroverride hides later changes to that template. Once a fixed version is out, delete the override (or rebase it) so you don't miss future fixes.Picazsoo commentedon Oct 8, 2026
I will try to prepare a comprehensive fix for the issue. It is present in both java-spring and kotlin-spring generators.
I think we should make it configurable via boolean
generatePageableDefaults(default totrue) to allow for skipping generation of any defaults annotations as well as to make the index configurable via booleanoneIndexedPageParameters(default tofalse). And we should warn during code generation, when we encounterpagedefaultorpagemin= 1, if theoneIndexedPageParametersis unset (and hence defaulting tofalse) as that is probably by accident. SettingoneIndexedPageParametersto eithertrueorfalseexplicitly will silence the warning.[SPRING;KOTLIN-SPRING] fix: shift 1-based page default/bounds to Spri…
Picazsoo commentedon Nov 9, 2026
Hi @Pattrigue and @seonwooj0810, I've kept thinking about this bug and the fix we merged, and I'd like to propose a different approach. Also pinging @dfpatinoc and @wassuh0520, since you were both involved in the discussions around
@ValidPageableand@PageableDefault.There are really two separate problems here:
@PageableDefault(page = …)is always zero-based.@ValidPageablevalidates thePageableafter Spring has already converted it.Both currently depend on knowing whether the API is one-based. #25171 guesses this from
minimum: 1, and my #25197 adds options for it. I think we can avoid the question entirely.1. Stop generating
pagein@PageableDefaultI can't think of a realistic case where the default page should be anything other than "the first page". A default
sizemakes sense; a defaultpagereally doesn't. If we never emit thepageattribute, thePageabledefaults to index 0. That is the first page, whateverspring.data.web.pageable.one-indexed-parametersis set to. We can then drop all the logic that derives the page default from the spec.sizeand sort defaults would stay as they are.If a spec sets a
page.defaultthat is not its first page, we could log a warning that it is ignored.2. Validate the raw request values instead of the converted
PageableBy the time the
Pageableexists, Spring Data has already changed the incoming values. InPageableHandlerMethodArgumentResolverSupport#parseAndApplyBoundaries, it:one-indexed-parameters=true,0,0.So with one-based parameters,
?page=0becomes-1, is then turned into0, and looks like a perfectly valid first page.minPagecan never reject it. Likewise,?page=abcsilently becomes page 0. However we shift the bounds, the validator only sees values that Spring has already adjusted.The spec's
minimum/maximumdescribe the values sent over the wire, so that is what we should validate:Pageableparameter. Internally, the validator gets the currentHttpServletRequestfromRequestContextHolder(a ThreadLocal) and checks the rawpage/sizequery parameters. The generator only treats parameters named exactlypage/size/sortas pageable, so the names are known. The spec bounds go into the annotation as they are, with no shifting and no dependence onone-indexed-parameters.Pageablealready holds converted values. Here I'd put@ValidPageableon theServerWebExchangeparameter and validateexchange.getRequest().getQueryParams().includeHttpRequestContextalready defaults totruefor reactive. We would only need to force it, ideally with a warning, when a user explicitly set it tofalseandgeneratePageableConstraintValidationis on.Edge cases I'd handle:
null.Result
one-indexed-parameters=trueandfalse.minimum: 1inference from [SPRING;KOTLIN-SPRING] fix: shift 1-based page default/bounds to Spring's 0-based page index #25171 can be reverted.generatePageableDefaultsandoneIndexedPageParameters, and open a new PR implementing the above for bothspringandkotlin-spring.Does this make sense to you? I'd especially welcome feedback on the WebFlux part, since it moves the annotation onto
ServerWebExchange.Picazsoo commentedon Nov 9, 2026
A follow-up on the WebFlux part of my previous comment. Moving
@ValidPageableontoServerWebExchangeworks, but then where the annotation goes depends on the stack (Pageablefor MVC, the exchange for WebFlux), and reactive needsincludeHttpRequestContextforced on. Here's an alternative that keeps the annotation on thePageableparameter for both stacks. The cost is one small piece of configuration.Variant B: the annotation only carries the bounds; a wrapping
Pageableresolver does the checkingThe generated method signatures stay as they are today:
What changes is who checks the values:
Pageableresolver checks the raw values, one per stack: MVCHandlerMethodArgumentResolver, WebFluxSyncHandlerMethodArgumentResolver.@ValidPageable/@ValidSortfrom theMethodParameter.page/size/sortquery values against them, taken fromNativeWebRequest(MVC) orServerWebExchange(WebFlux).ResponseStatusException(BAD_REQUEST)(400).one-indexed-parameters,max-page-size,@PageableDefaultand prefixes keep working.check(rawPage, rawSize, rawSorts, annotation).@ValidPageable/@ValidSortdon't need a@Constraintvalidator at all, because the resolver is the only thing that reads them.ValidPageable/ValidSortinconfigPackage:WebMvcConfigurer(servlet) that inserts the strict resolver at index 0, wrapping thePageableHandlerMethodArgumentResolverbean;WebFluxConfigurer(reactive) that registers it viaconfigureArgumentResolvers, wrapping aReactivePageableHandlerMethodArgumentResolver.Why it might be worth it
Pageable), with the same bounds copied from the spec, independent ofincludeHttpRequestContext.ServerWebExchangeparameter needed in WebFlux.ValidPageable/ValidSortviaimportMappingscan use the same pattern without generated code changing.Costs / open questions
@Configurationmust be picked up, either by component scanning ofconfigPackageor by an@Import. If it isn't, the annotations do nothing, and nothing tells you.ReactivePageableHandlerMethodArgumentResolverbean. The generated config would have to create it, and users' customisations of it would need a hook.Optional extension: fail loudly when the resolver isn't wired in
The silent no-op above can be closed without any extra configuration:
final class ValidatedPageRequest extends PageRequest. ExtendingPageRequestkeeps existinginstanceof PageRequestchecks working.@ValidPageablestays a@Constraint, but its validator only asserts that thePageableit receives is that marker. If it isn't, it throwsIllegalStateException("Strict pageable resolver is not registered; import <generated config>").What it costs:
Pageable.unpaged(). Otherwise the guard has to allow unpaged explicitly.It's separable: variant B works without it, and it could be added later, or behind a flag.
My preference
I still lean towards the simpler approach from my previous comment: the ThreadLocal in MVC and the exchange in WebFlux, both working out of the box. I'm posting variant B (with or without the guard) so we can compare. If maintainers prefer "the annotation always stays on
Pageable" and accept generating a config class, I'm happy to implement it instead.Picazsoo commentedon Nov 9, 2026
A short addendum to variant B: it's already possible today, with no generator changes, but #25171 gets in the way for one-based APIs.
Variant B works with the current generator via
importMappingsThe generator only writes the annotation usages (
@ValidPageable(maxSize = …, minPage = …),@ValidSort(allowedValues = {…})) and resolves the classes throughimportMappingswithputIfAbsent, so a user mapping wins:The user then provides their own
ValidPageable/ValidSort(plain metadata, or with the guard), the strict resolver, and theWebMvcConfigurer/WebFluxConfigurerthat registers it. The generated controllers stay exactly as they are.Things to watch out for:
maxSize,maxPage,minSize,minPageandallowedValues.ValidPageable/ValidSortsources are still written toconfigPackage, even with a custom mapping. Exclude them via.openapi-generator-ignore.useBeanValidation,generatePageableConstraintValidationandgenerateSortValidationenabled.How #25171 affects this
Zero-based specs (
minimum: 0or no minimum) aren't affected; there the bounds are copied unchanged.For one-based specs (
pageminimum: 1), the problem is that the annotation doesn't say whether it was shifted.@ValidPageable(minPage = 0, maxPage = 99)could come from a zero-based spec withmaximum: 99, or from a one-based spec withminimum: 1, maximum: 100shifted down by #25171. A check of the raw values has to know from somewhere else and add 1 back:one-indexed-parameterssetting is the obvious source, but the generator decides from the spec'sminimum: 1, not from that setting. If a spec saysminimum: 1and the app is zero-based, the bounds are shifted anyway and the compensation goes wrong.So #25171 makes the annotation correct for the stock validator, which checks the already-converted
Pageable, but wrong for any check of the raw values, whether it's my original proposal or variant B. That's one more reason to copy the bounds unchanged: then the annotation always describes the value the client sends, and any implementation, generated or plugged in viaimportMappings, can use it directly.