Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
473c551
feat: add sort validation support for pageable operations
Picazsoo Apr 10, 2026
e3bb3ad
add sample
Picazsoo Apr 10, 2026
8ebb3cf
add generated samples
Picazsoo Apr 10, 2026
c751e31
add to compiled samples
Picazsoo Apr 10, 2026
58fe32b
add to compiled samples
Picazsoo Apr 10, 2026
033bbb1
regenerate docs
Picazsoo Apr 12, 2026
5981639
feat: add pageable defaults validation for pageable operations
Picazsoo Apr 13, 2026
919ee18
feat: enhance pageable validation with sort enum support
Picazsoo Apr 13, 2026
9af137f
feat: add pageable constraint validation tests for size and page limits
Picazsoo Apr 14, 2026
88fbea3
update samples
Picazsoo Apr 14, 2026
67884e8
update samples & fix test
Picazsoo Apr 14, 2026
767f864
feat: add validation for pageable and sort parameters with new annota…
Picazsoo Apr 14, 2026
32b6c4a
simplify implementation
Picazsoo Apr 14, 2026
9728c9a
improve doc description
Picazsoo Apr 14, 2026
f1935b4
improve sample
Picazsoo Apr 14, 2026
f4bd267
Merge branch 'master' into feature/add-enum-validation-for-pageable
Picazsoo Apr 15, 2026
8cb9f14
rename from non-existent 'beanValidations' to 'useBeanValidation'
Picazsoo Apr 15, 2026
8aad0ee
feat: add enum validation for pageable sort parameters in API
Picazsoo Apr 15, 2026
e040bec
add tests for both exploded and non-exploded params
Picazsoo Apr 15, 2026
1446407
fix samples after fix
Picazsoo Apr 15, 2026
333143c
add spring-boot-starter-validation when useBeanValidation
Picazsoo Apr 15, 2026
3e30230
add java spring test and delete incorrect sample
Picazsoo Apr 15, 2026
ce62f22
modify sample
Picazsoo Apr 15, 2026
bf56873
add tests
Picazsoo Apr 15, 2026
618d868
add java samples
Picazsoo Apr 15, 2026
701b035
add java samples
Picazsoo Apr 15, 2026
204b9f6
add tests to java samples
Picazsoo Apr 15, 2026
6be3da3
add to built samples
Picazsoo Apr 15, 2026
cf212aa
fix: guard ValidPageable validator against Pageable.unpaged()
Picazsoo Apr 15, 2026
a701da6
fix javadoc
Picazsoo Apr 15, 2026
507128f
remove unused import
Picazsoo Apr 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/samples-kotlin-server-jdk17.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- 'samples/server/petstore/kotlin-server-required-and-nullable-properties/**'
- 'samples/server/petstore/kotlin-spring-declarative*/**'
- 'samples/server/petstore/kotlin-spring-sealed-interfaces/**'
- 'samples/server/petstore/kotlin-springboot-sort-validation/**'
# comment out due to gradle build failure
# - samples/server/petstore/kotlin-spring-default/**
pull_request:
Expand All @@ -23,6 +24,7 @@ on:
- 'samples/server/petstore/kotlin-server-required-and-nullable-properties/**'
- 'samples/server/petstore/kotlin-spring-declarative*/**'
- 'samples/server/petstore/kotlin-spring-sealed-interfaces/**'
- 'samples/server/petstore/kotlin-springboot-sort-validation/**'
# comment out due to gradle build failure
# - samples/server/petstore/kotlin-spring-default/**

Expand Down Expand Up @@ -62,6 +64,7 @@ jobs:
- samples/server/petstore/kotlin-spring-declarative-interface-reactive-reactor-wrapped
- samples/server/petstore/kotlin-spring-declarative-interface-wrapped
- samples/server/petstore/kotlin-spring-sealed-interfaces
- samples/server/petstore/kotlin-springboot-sort-validation
# comment out due to gradle build failure
# - samples/server/petstore/kotlin-spring-default/
steps:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/samples-spring-jdk17.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- samples/server/petstore/springboot-lombok-tostring/**
- samples/server/petstore/springboot-file-delegate-optional/**
- samples/server/petstore/springboot-petstore-with-api-response-examples/**
- samples/server/petstore/springboot-sort-validation/**
- samples/openapi3/server/petstore/spring-boot-oneof-sealed/**
- samples/openapi3/server/petstore/spring-boot-oneof-interface/**
pull_request:
Expand All @@ -29,6 +30,7 @@ on:
- samples/server/petstore/springboot-lombok-tostring/**
- samples/server/petstore/springboot-file-delegate-optional/**
- samples/server/petstore/springboot-petstore-with-api-response-examples/**
- samples/server/petstore/springboot-sort-validation/**
- samples/openapi3/server/petstore/spring-boot-oneof-sealed/**
- samples/openapi3/server/petstore/spring-boot-oneof-interface/**
jobs:
Expand All @@ -52,6 +54,7 @@ jobs:
- samples/server/petstore/springboot-lombok-tostring
- samples/server/petstore/springboot-file-delegate-optional
- samples/server/petstore/springboot-petstore-with-api-response-examples
- samples/server/petstore/springboot-sort-validation
- samples/openapi3/server/petstore/spring-boot-oneof-sealed
- samples/openapi3/server/petstore/spring-boot-oneof-interface
steps:
Expand Down
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-boot-3-no-response-entity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ additionalProperties:
useSwaggerUI: "false"
serviceImplementation: "true"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
useSpringBoot3: "true"
requestMappingMode: api_interface
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-boot-3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ additionalProperties:
useSwaggerUI: "false"
serviceImplementation: "true"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
useSpringBoot3: "true"
requestMappingMode: api_interface
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-boot-4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ additionalProperties:
useSwaggerUI: "false"
serviceImplementation: "true"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
useSpringBoot4: "true"
useJackson3: "true"
requestMappingMode: api_interface
Expand Down
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-boot-additionalproperties.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ additionalProperties:
useSwaggerUI: "false"
serviceImplementation: "true"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
useSpringBoot3: "true"
requestMappingMode: api_interface
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-boot-delegate-nodefaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ additionalProperties:
useSwaggerUI: "true"
delegatePattern: "true"
skipDefaultInterface: "true"
beanValidations: "true"
useBeanValidation: "true"
requestMappingMode: "api_interface"
useSpringBoot3: "true"
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-boot-delegate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ additionalProperties:
useSwaggerUI: "true"
delegatePattern: "true"
appendRequestToHandler: "true"
beanValidations: "true"
useBeanValidation: "true"
requestMappingMode: none
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ additionalProperties:
skipDefaultInterface: true
interfaceOnly: false
serializableModel: true
beanValidations: true
useBeanValidation: true
includeHttpRequestContext: true
reactive: true
delegatePattern: true
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-boot-modelMutable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ additionalProperties:
useSwaggerUI: "true"
serializableModel: "true"
serviceImplementation: "true"
beanValidations: "true"
useBeanValidation: "true"
modelMutable: "true"
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ additionalProperties:
useSwaggerUI: "false"
serviceImplementation: "true"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
useResponseEntity: "false"
delegatePattern: true
requestMappingMode: controller
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-boot-no-response-entity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ additionalProperties:
useSwaggerUI: "false"
serviceImplementation: "true"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
useResponseEntity: "false"
requestMappingMode: controller
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-boot-reactive-without-flow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ additionalProperties:
useSwaggerUI: "true"
serviceImplementation: "true"
reactive: "true"
beanValidations: "true"
useBeanValidation: "true"
useFlowForArrayReturnType: "false"
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-boot-reactive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ additionalProperties:
useSwaggerUI: "true"
serviceImplementation: "true"
reactive: "true"
beanValidations: "true"
useBeanValidation: "true"
# the following option is set to true by default
#useFlowForArrayReturnType: "true"
18 changes: 18 additions & 0 deletions bin/configs/kotlin-spring-boot-sort-validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
generatorName: kotlin-spring
outputDir: samples/server/petstore/kotlin-springboot-sort-validation
library: spring-boot
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-sort-validation.yaml
templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
additionalProperties:
documentationProvider: none
annotationLibrary: none
useSwaggerUI: "false"
serviceImplementation: "false"
serializableModel: "true"
useBeanValidation: "true"
interfaceOnly: "true"
useSpringBoot3: "true"
generateSortValidation: "true"
generatePageableConstraintValidation: "true"
useTags: "true"
requestMappingMode: api_interface
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-boot-source-swagger1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ additionalProperties:
useSwaggerUI: "true"
serviceImplementation: "true"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
implicitHeaders: "true"
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-boot-source-swagger2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ additionalProperties:
useSwaggerUI: "true"
serviceImplementation: "true"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
implicitHeaders: "true"
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-boot-x-kotlin-implements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ additionalProperties:
skipDefaultInterface: true
interfaceOnly: true
serializableModel: true
beanValidations: true
useBeanValidation: true
includeHttpRequestContext: true
schemaImplements:
Pet: com.some.pack.WithId
Expand Down
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-boot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ additionalProperties:
useSwaggerUI: "false"
serviceImplementation: "true"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
requestMappingMode: controller
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-cloud.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ additionalProperties:
annotationLibrary: none
useSwaggerUI: "false"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
interfaceOnly: "true"
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ additionalProperties:
annotationLibrary: swagger2
useSwaggerUI: "false"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
interfaceOnly: true
reactive: true
useResponseEntity: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ additionalProperties:
annotationLibrary: swagger2
useSwaggerUI: "false"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
interfaceOnly: true
reactive: true
useResponseEntity: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ additionalProperties:
annotationLibrary: swagger2
useSwaggerUI: "false"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
interfaceOnly: true
reactive: false
useResponseEntity: true
Expand Down
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-declarative-interface.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ additionalProperties:
annotationLibrary: swagger2
useSwaggerUI: "false"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
interfaceOnly: true
reactive: false
useResponseEntity: true
Expand Down
2 changes: 1 addition & 1 deletion bin/configs/kotlin-spring-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ templateDir: modules/openapi-generator/src/main/resources/kotlin-spring
# useSwaggerUI: "false"
# serviceImplementation: "true"
# serializableModel: "true"
# beanValidations: "true"
# useBeanValidation: "true"
# useSpringBoot3: "true"
20 changes: 20 additions & 0 deletions bin/configs/spring-boot-sort-validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
generatorName: spring
outputDir: samples/server/petstore/springboot-sort-validation
library: spring-boot
inputSpec: modules/openapi-generator/src/test/resources/3_0/spring/petstore-sort-validation.yaml
templateDir: modules/openapi-generator/src/main/resources/JavaSpring
additionalProperties:
documentationProvider: none
annotationLibrary: none
useSwaggerUI: "false"
serviceImplementation: "false"
serializableModel: "true"
useBeanValidation: "true"
interfaceOnly: "false"
skipDefaultInterface: "true"
useSpringBoot3: "true"
generateSortValidation: "true"
hideGenerationTimestamp: "true"
generatePageableConstraintValidation: "true"
useTags: "true"
requestMappingMode: api_interface
2 changes: 1 addition & 1 deletion bin/configs/unmaintained/kotlin-spring-boot-reactive.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ additionalProperties:
useSwaggerUI: "true"
serviceImplementation: "true"
reactive: "true"
beanValidations: "true"
useBeanValidation: "true"
2 changes: 1 addition & 1 deletion bin/configs/unmaintained/kotlin-spring-boot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ additionalProperties:
useSwaggerUI: "false"
serviceImplementation: "true"
serializableModel: "true"
beanValidations: "true"
useBeanValidation: "true"
3 changes: 3 additions & 0 deletions docs/generators/java-camel.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename. If not provided, uses the version from the OpenAPI specification file. If that's also not present, uses the default value of the artifactVersion option.| |1.0.0|
|async|use async Callable controllers| |false|
|autoXSpringPaginated|Automatically add x-spring-paginated to operations that have 'page', 'size', and 'sort' query parameters. When enabled, operations with all three parameters will have Pageable support automatically applied. Operations with x-spring-paginated explicitly set to false will not be auto-detected. Only applies when library=spring-boot.| |false|
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
Expand Down Expand Up @@ -62,6 +63,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|generateBuilders|Whether to generate builders for models| |false|
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
|generateGenericResponseEntity|Use a generic type for the `ResponseEntity` wrapping return values of generated API methods. If enabled, method are generated with return type ResponseEntity<?>| |false|
|generatePageableConstraintValidation|Generate a @ValidPageable annotation and PageableConstraintValidator class, and apply @ValidPageable to the injected Pageable parameter of operations whose 'page' or 'size' parameter specifies a maximum constraint. The annotation enforces those constraints on the Pageable object that replaces the individual page/size query parameters. Requires useBeanValidation=true and library=spring-boot.| |false|
|generateSortValidation|Generate a @ValidSort annotation and SortValidator class, and apply @ValidSort to the injected Pageable parameter of operations whose 'sort' parameter has enum values. The annotation validates that sort values in the Pageable object match the allowed enum values from the spec. Requires useBeanValidation=true and library=spring-boot.| |false|
|generatedConstructorWithRequiredArgs|Whether to generate constructors with required args for models| |true|
|groupId|groupId in generated pom.xml| |org.openapitools|
|hateoas|Use Spring HATEOAS library to allow adding HATEOAS links| |false|
Expand Down
2 changes: 2 additions & 0 deletions docs/generators/kotlin-spring.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|documentationProvider|Select the OpenAPI documentation provider.|<dl><dt>**none**</dt><dd>Do not publish an OpenAPI specification.</dd><dt>**source**</dt><dd>Publish the original input OpenAPI specification.</dd><dt>**springdoc**</dt><dd>Generate an OpenAPI 3 specification using SpringDoc.</dd></dl>|springdoc|
|enumPropertyNaming|Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original'| |original|
|exceptionHandler|generate default global exception handlers (not compatible with reactive. enabling reactive will disable exceptionHandler )| |true|
|generatePageableConstraintValidation|Generate a @ValidPageable annotation and PageableConstraintValidator class, and apply @ValidPageable to the injected Pageable parameter of operations whose 'page' or 'size' parameter specifies a maximum constraint. The annotation enforces those constraints on the Pageable object that replaces the individual page/size query parameters. Requires useBeanValidation=true and library=spring-boot.| |false|
|generateSortValidation|Generate a @ValidSort annotation and SortValidator class, and apply @ValidSort to the injected Pageable parameter of operations whose 'sort' parameter has enum values. The annotation validates that sort values in the Pageable object match the allowed enum values from the spec. Requires useBeanValidation=true and library=spring-boot.| |false|
|gradleBuildFile|generate a gradle build file using the Kotlin DSL| |true|
|groupId|Generated artifact package's organization (i.e. maven groupId).| |org.openapitools|
|implicitHeaders|Skip header parameters in the generated API methods.| |false|
Expand Down
3 changes: 3 additions & 0 deletions docs/generators/spring.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|artifactUrl|artifact URL in generated pom.xml| |https://github.com/openapitools/openapi-generator|
|artifactVersion|artifact version in generated pom.xml. This also becomes part of the generated library's filename. If not provided, uses the version from the OpenAPI specification file. If that's also not present, uses the default value of the artifactVersion option.| |1.0.0|
|async|use async Callable controllers| |false|
|autoXSpringPaginated|Automatically add x-spring-paginated to operations that have 'page', 'size', and 'sort' query parameters. When enabled, operations with all three parameters will have Pageable support automatically applied. Operations with x-spring-paginated explicitly set to false will not be auto-detected. Only applies when library=spring-boot.| |false|
|basePackage|base package (invokerPackage) for generated code| |org.openapitools|
|bigDecimalAsString|Treat BigDecimal values as Strings to avoid precision loss.| |false|
|booleanGetterPrefix|Set booleanGetterPrefix| |get|
Expand All @@ -55,6 +56,8 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|generateBuilders|Whether to generate builders for models| |false|
|generateConstructorWithAllArgs|whether to generate a constructor for all arguments| |false|
|generateGenericResponseEntity|Use a generic type for the `ResponseEntity` wrapping return values of generated API methods. If enabled, method are generated with return type ResponseEntity&lt;?&gt;| |false|
|generatePageableConstraintValidation|Generate a @ValidPageable annotation and PageableConstraintValidator class, and apply @ValidPageable to the injected Pageable parameter of operations whose 'page' or 'size' parameter specifies a maximum constraint. The annotation enforces those constraints on the Pageable object that replaces the individual page/size query parameters. Requires useBeanValidation=true and library=spring-boot.| |false|
|generateSortValidation|Generate a @ValidSort annotation and SortValidator class, and apply @ValidSort to the injected Pageable parameter of operations whose 'sort' parameter has enum values. The annotation validates that sort values in the Pageable object match the allowed enum values from the spec. Requires useBeanValidation=true and library=spring-boot.| |false|
|generatedConstructorWithRequiredArgs|Whether to generate constructors with required args for models| |true|
|groupId|groupId in generated pom.xml| |org.openapitools|
|hateoas|Use Spring HATEOAS library to allow adding HATEOAS links| |false|
Expand Down
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ openapi-generator-cli generate \
-i petstore.yaml \
-g kotlin-spring \
-o out \
--additional-properties=library=spring-boot,beanValidations=true,serviceImplementation=true \
--additional-properties=library=spring-boot,useBeanValidation=true,serviceImplementation=true \
--import-mappings=DateTime=java.time.LocalDateTime \
--type-mappings=DateTime=java.time.LocalDateTime
```
Expand Down
Loading