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
[KOTLIN;SPRING] - add support for 'x-spring-paginated' to get closer to feature parity with java-spring codegen; add 'autoXSpringPaginated' option; support x-operation-extra-annotation (#22958)
* add x-kotlin-implements
* implement tests
* update samples
* fix tests - forbidden api issue
* add samples
* add samples. use Pageable only for server-side
* add support for auto-detecting x-spring-paginated in Spring Boot operations
* fix maven dependencies import
* add unit tests
* add support for vendor extension
* remove files
* fix samples
* fix docs
* implement suggestions from CR. Fix declarative interface naming.
* move import around
* add x-operation-extra-annotation
* make sure the PageableAsQueryParam does not remove already present x-operation-extra-annotation content
* support also list format
* regenerate samples and docs
* regenerate samples and docs
* force tests rerun
* remove files
* add files
* trigger test rerun
|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.||false|
27
28
|basePackage|base package (invokerPackage) for generated code||org.openapitools|
28
29
|beanQualifiers|Whether to add fully-qualifier class names as bean qualifiers in @Component and @RestController annotations. May be used to prevent bean names clash if multiple generated libraries (contexts) added to single project.||false|
29
30
|configPackage|configuration package for generated code||org.openapitools.configuration|
@@ -73,12 +74,14 @@ These options may be applied as additional-properties (cli) or configOptions (pl
73
74
|x-content-type|Specify custom value for 'Content-Type' header for operation|OPERATION|null
74
75
|x-discriminator-value|Used with model inheritance to specify value for discriminator that identifies current model|MODEL|
75
76
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
77
+
|x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null
76
78
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
77
79
|x-size-message|Add this property whenever you need to customize the invalidation error message for the size or length of a variable|FIELD, OPERATION_PARAMETER|null
78
80
|x-minimum-message|Add this property whenever you need to customize the invalidation error message for the minimum value of a variable|FIELD, OPERATION_PARAMETER|null
79
81
|x-maximum-message|Add this property whenever you need to customize the invalidation error message for the maximum value of a variable|FIELD, OPERATION_PARAMETER|null
80
82
|x-kotlin-implements|Ability to specify interfaces that model must implement|MODEL|empty array
81
83
|x-kotlin-implements-fields|Specify attributes that are implemented by the interface(s) added via `x-kotlin-implements`|MODEL|empty array
84
+
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false
@@ -251,6 +254,7 @@ public KotlinSpringServerCodegen() {
251
254
addOption(X_KOTLIN_IMPLEMENTS_FIELDS_SKIP, "A list of fields per schema name that should NOT be created with `override` keyword despite their presence in vendor extension `x-kotlin-implements-fields` for the schema. Example: yaml `xKotlinImplementsFieldsSkip: Pet: [photoUrls]` skips `override` for `photoUrls` in schema `Pet`", "empty map");
252
255
addOption(SCHEMA_IMPLEMENTS, "A map of single interface or a list of interfaces per schema name that should be implemented (serves similar purpose as `x-kotlin-implements`, but is fully decoupled from the api spec). Example: yaml `schemaImplements: {Pet: com.some.pack.WithId, Category: [com.some.pack.CategoryInterface], Dog: [com.some.pack.Canine, com.some.pack.OtherInterface]}` implements interfaces in schemas `Pet` (interface `com.some.pack.WithId`), `Category` (interface `com.some.pack.CategoryInterface`), `Dog`(interfaces `com.some.pack.Canine`, `com.some.pack.OtherInterface`)", "empty map");
253
256
addOption(SCHEMA_IMPLEMENTS_FIELDS, "A map of single field or a list of fields per schema name that should be prepended with `override` (serves similar purpose as `x-kotlin-implements-fields`, but is fully decoupled from the api spec). Example: yaml `schemaImplementsFields: {Pet: id, Category: [name, id], Dog: [bark, breed]}` marks fields to be prepended with `override` in schemas `Pet` (field `id`), `Category` (fields `name`, `id`) and `Dog` (fields `bark`, `breed`)", "empty map");
257
+
addSwitch(AUTO_X_SPRING_PAGINATED, "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.", autoXSpringPaginated);
254
258
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
255
259
supportedLibraries.put(SPRING_CLOUD_LIBRARY,
256
260
"Spring-Cloud-Feign client with Spring-Boot auto-configured settings.");
0 commit comments