Skip to content

Commit f43b81e

Browse files
authored
[JAVA-SPRING,KOTLIN-SPRING] - feature: validate Pageable params [size, page, sort] and preserve defaults; add PagedModel<T> support; Add 'autoXSpringPaginated' to java-spring (#23575)
* feat: add sort validation support for pageable operations * add sample * add generated samples * add to compiled samples * add to compiled samples * regenerate docs * feat: add pageable defaults validation for pageable operations * feat: enhance pageable validation with sort enum support * feat: add pageable constraint validation tests for size and page limits * update samples * update samples & fix test * feat: add validation for pageable and sort parameters with new annotations * simplify implementation * improve doc description * improve sample * rename from non-existent 'beanValidations' to 'useBeanValidation' * feat: add enum validation for pageable sort parameters in API * add tests for both exploded and non-exploded params * fix samples after fix * add spring-boot-starter-validation when useBeanValidation * add java spring test and delete incorrect sample * modify sample * add tests * add java samples * add java samples * add tests to java samples * add missing tests for autoXSpringPaginated in java spring * add to built samples * fix: guard ValidPageable validator against Pageable.unpaged() Calling getPageSize()/getPageNumber() on Pageable.unpaged() throws UnsupportedOperationException. Add an isPaged() check so unpaged requests pass validation without error. * fix javadoc * remove unused import * add implementation to detect schemas matching PageModel shape and replace with generic * add implementation to detect schemas matching PageModel shape and replace with generic * keep original implementation conditionally when needed by @apiresponse annotation for springdoc * update samples * update Spring Boot version to 3.3.13 in build files * try to compile samples * delete samples * fix sample * delete generated sample * fix kotlin sample * regenerate docs * update samples * fix generation suppresion logic and regenerate samples * update samples
1 parent b41e290 commit f43b81e

File tree

198 files changed

+10309
-35
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+10309
-35
lines changed

.github/workflows/samples-kotlin-server-jdk17.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ on:
1111
- 'samples/server/petstore/kotlin-server-required-and-nullable-properties/**'
1212
- 'samples/server/petstore/kotlin-spring-declarative*/**'
1313
- 'samples/server/petstore/kotlin-spring-sealed-interfaces/**'
14+
- 'samples/server/petstore/kotlin-springboot-sort-validation/**'
15+
- 'samples/server/petstore/kotlin-springboot-paged-model/**'
1416
# comment out due to gradle build failure
1517
# - samples/server/petstore/kotlin-spring-default/**
1618
pull_request:
@@ -23,6 +25,8 @@ on:
2325
- 'samples/server/petstore/kotlin-server-required-and-nullable-properties/**'
2426
- 'samples/server/petstore/kotlin-spring-declarative*/**'
2527
- 'samples/server/petstore/kotlin-spring-sealed-interfaces/**'
28+
- 'samples/server/petstore/kotlin-springboot-sort-validation/**'
29+
- 'samples/server/petstore/kotlin-springboot-paged-model/**'
2630
# comment out due to gradle build failure
2731
# - samples/server/petstore/kotlin-spring-default/**
2832

@@ -62,6 +66,8 @@ jobs:
6266
- samples/server/petstore/kotlin-spring-declarative-interface-reactive-reactor-wrapped
6367
- samples/server/petstore/kotlin-spring-declarative-interface-wrapped
6468
- samples/server/petstore/kotlin-spring-sealed-interfaces
69+
- samples/server/petstore/kotlin-springboot-sort-validation
70+
- samples/server/petstore/kotlin-springboot-paged-model
6571
# comment out due to gradle build failure
6672
# - samples/server/petstore/kotlin-spring-default/
6773
steps:

.github/workflows/samples-spring-jdk17.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ on:
1414
- samples/server/petstore/springboot-lombok-tostring/**
1515
- samples/server/petstore/springboot-file-delegate-optional/**
1616
- samples/server/petstore/springboot-petstore-with-api-response-examples/**
17+
- samples/server/petstore/springboot-sort-validation/**
18+
- samples/server/petstore/springboot-paged-model/**
1719
- samples/openapi3/server/petstore/spring-boot-oneof-sealed/**
1820
- samples/openapi3/server/petstore/spring-boot-oneof-interface/**
1921
pull_request:
@@ -29,6 +31,8 @@ on:
2931
- samples/server/petstore/springboot-lombok-tostring/**
3032
- samples/server/petstore/springboot-file-delegate-optional/**
3133
- samples/server/petstore/springboot-petstore-with-api-response-examples/**
34+
- samples/server/petstore/springboot-sort-validation/**
35+
- samples/server/petstore/springboot-paged-model/**
3236
- samples/openapi3/server/petstore/spring-boot-oneof-sealed/**
3337
- samples/openapi3/server/petstore/spring-boot-oneof-interface/**
3438
jobs:
@@ -52,6 +56,8 @@ jobs:
5256
- samples/server/petstore/springboot-lombok-tostring
5357
- samples/server/petstore/springboot-file-delegate-optional
5458
- samples/server/petstore/springboot-petstore-with-api-response-examples
59+
- samples/server/petstore/springboot-sort-validation
60+
- samples/server/petstore/springboot-paged-model
5561
- samples/openapi3/server/petstore/spring-boot-oneof-sealed
5662
- samples/openapi3/server/petstore/spring-boot-oneof-interface
5763
steps:

bin/configs/kotlin-spring-boot-3-no-response-entity.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ additionalProperties:
99
useSwaggerUI: "false"
1010
serviceImplementation: "true"
1111
serializableModel: "true"
12-
beanValidations: "true"
12+
useBeanValidation: "true"
1313
useSpringBoot3: "true"
1414
requestMappingMode: api_interface

bin/configs/kotlin-spring-boot-3.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ additionalProperties:
99
useSwaggerUI: "false"
1010
serviceImplementation: "true"
1111
serializableModel: "true"
12-
beanValidations: "true"
12+
useBeanValidation: "true"
1313
useSpringBoot3: "true"
1414
requestMappingMode: api_interface

bin/configs/kotlin-spring-boot-4.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ additionalProperties:
99
useSwaggerUI: "false"
1010
serviceImplementation: "true"
1111
serializableModel: "true"
12-
beanValidations: "true"
12+
useBeanValidation: "true"
1313
useSpringBoot4: "true"
1414
useJackson3: "true"
1515
requestMappingMode: api_interface

bin/configs/kotlin-spring-boot-additionalproperties.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ additionalProperties:
99
useSwaggerUI: "false"
1010
serviceImplementation: "true"
1111
serializableModel: "true"
12-
beanValidations: "true"
12+
useBeanValidation: "true"
1313
useSpringBoot3: "true"
1414
requestMappingMode: api_interface

bin/configs/kotlin-spring-boot-delegate-nodefaults.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ additionalProperties:
99
useSwaggerUI: "true"
1010
delegatePattern: "true"
1111
skipDefaultInterface: "true"
12-
beanValidations: "true"
12+
useBeanValidation: "true"
1313
requestMappingMode: "api_interface"
1414
useSpringBoot3: "true"

bin/configs/kotlin-spring-boot-delegate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ additionalProperties:
99
useSwaggerUI: "true"
1010
delegatePattern: "true"
1111
appendRequestToHandler: "true"
12-
beanValidations: "true"
12+
useBeanValidation: "true"
1313
requestMappingMode: none

bin/configs/kotlin-spring-boot-include-http-request-context-delegate.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ additionalProperties:
1111
skipDefaultInterface: true
1212
interfaceOnly: false
1313
serializableModel: true
14-
beanValidations: true
14+
useBeanValidation: true
1515
includeHttpRequestContext: true
1616
reactive: true
1717
delegatePattern: true

bin/configs/kotlin-spring-boot-modelMutable.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ additionalProperties:
99
useSwaggerUI: "true"
1010
serializableModel: "true"
1111
serviceImplementation: "true"
12-
beanValidations: "true"
12+
useBeanValidation: "true"
1313
modelMutable: "true"

0 commit comments

Comments
 (0)