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
[JAVA-SPRING,KOTLIN-SPRING] - Enhance pageable validation by adding minSize and minPage constraints; Search also allOf references for constraints; fix PagedModel<T> substitution with 'modelNameSuffix' or 'modelNamePrefix'; add ValuedEnum<T> interface (#23694)
* Enhance pageable validation by adding minSize and minPage constraints. Search also allOf references for constraints and defaults
* update samples
* fix test
* use ModelUtils in SpringPageableScanUtils
* update tests in samples
* move reusable code to shared ModelUtils.java
* add tests
* fix CR suggestion and add tests
* suppress paged schemas correctly when modelNameSuffix/Prefix is set
* refactor: enhance pageable constraints handling with exclusive bounds support
* DRY code
* refactor: improve resolution of nested allOf constraints for maximum and minimum bounds
* re-enable test
* test: fix implementation and add unit test for resolving default in nested allOf schemas
* add comment to explain that behavior around default is undefined in open api spec
* pageable-scan-resolve-allof-constraints refactor: streamline pageable handling and enhance annotation application logic
* feat: add support for ValuedEnum interface in code generation for enums
* fix: remove Pageable support for non-spring-boot libraries and update related documentation
* update documentation
* fix: update default resolution logic for allOf schemas to last-writer-wins semantics
* fix: ensure correct parent reference ordering in allOf for default resolution
* DRY code
* DRY code
* revert default-resolution related changes as the behavior is unspecified and therefore dangerous
* add missing PetApiController implementations and validation tests for allOf-resolved constraints
* fix(kotlin-spring): container inline enums must not get `override val value`
EnumValueInterfaceUtils.injectInPostProcessModelsEnum() adds
ValuedEnum<...> to x-kotlin-implements only for `var.isEnum &&
!var.isContainer`, but dataClass.mustache emitted the `override` keyword
for every enum whenever useEnumValueInterface=true. Container inline
enums therefore produced uncompilable Kotlin (`overrides nothing`) since
the enum class did not actually implement any interface to override.
Gating the `override` token on `^isContainer` keeps the template in sync
with the util.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* feat(kotlin-spring and java-spring): add ValuedEnum interface and update related configurations to verify compilation success for both javax and jakarta setups in kotlin and java spring
* update samples
* update samples
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/generators/java-camel.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,6 +112,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
112
112
|useBeanValidation|Use BeanValidation API annotations||true|
113
113
|useDeductionForOneOfInterfaces|Annotate discriminator-free oneOf interfaces with Jackson's @JsonTypeInfo(use = Id.DEDUCTION) and @JsonSubTypes so the concrete subtype is resolved from the JSON field set rather than a type-tag property. Has no effect when a discriminator is present (name-based resolution is used instead). Requires subtypes to have structurally distinct sets of properties.||false|
114
114
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison||false|
115
+
|useEnumValueInterface|Generate a ValuedEnum<T> interface in the config package and make all generated enums implement it, providing a common typed way to access the underlying enum value. Use `importMappings.ValuedEnum` to substitute a custom/library-provided interface instead of generating one.||false|
115
116
|useFeignClientContextId|Whether to generate Feign client with contextId parameter.||true|
116
117
|useFeignClientUrl|Whether to generate Feign client with url parameter.||true|
117
118
|useHttpServiceProxyFactoryInterfacesConfigurator|Generate HttpInterfacesAbstractConfigurator based on an HttpServiceProxyFactory instance (as opposed to a WebClient instance, when disabled) for generating Spring HTTP interfaces.||false|
@@ -145,7 +146,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
145
146
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
146
147
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
147
148
|x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null
148
-
|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
149
+
|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. Only applies when `library=spring-boot`; ignored for client libraries (spring-cloud, spring-declarative-http-interface).|OPERATION|false
149
150
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
150
151
|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
151
152
|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
Copy file name to clipboardExpand all lines: docs/generators/kotlin-spring.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,6 +63,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
63
63
|title|server title name or client service name||OpenAPI Kotlin Spring|
64
64
|useBeanValidation|Use BeanValidation API annotations to validate data types||true|
65
65
|useDeductionForOneOfInterfaces|Annotate discriminator-free oneOf interfaces with Jackson's @JsonTypeInfo(use = Id.DEDUCTION) and @JsonSubTypes so the concrete subtype is resolved from the JSON field set rather than a type-tag property. Has no effect when a discriminator is present (name-based resolution is used instead). Requires subtypes to have structurally distinct sets of properties.||false|
66
+
|useEnumValueInterface|Generate a ValuedEnum<T> interface in the config package and make all generated enums implement it, providing a common typed way to access the underlying enum value. Use `importMappings.ValuedEnum` to substitute a custom/library-provided interface instead of generating one.||false|
66
67
|useFeignClientUrl|Whether to generate Feign client with url parameter.||true|
67
68
|useFlowForArrayReturnType|Whether to use Flow for array/collection return types when reactive is enabled. If false, will use List instead.||true|
68
69
|useJackson3|Use Jackson 3 dependencies (tools.jackson package). Only available with `useSpringBoot4`. Defaults to true when `useSpringBoot4` is enabled.||false|
@@ -91,7 +92,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
91
92
|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
92
93
|x-kotlin-implements|Ability to specify interfaces that model must implement|MODEL|empty array
93
94
|x-kotlin-implements-fields|Specify attributes that are implemented by the interface(s) added via `x-kotlin-implements`|MODEL|empty array
94
-
|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
95
+
|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. Only applies when `library=spring-boot`; ignored for client libraries (spring-cloud, spring-declarative-http-interface).|OPERATION|false
Copy file name to clipboardExpand all lines: docs/generators/spring.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -105,6 +105,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
105
105
|useBeanValidation|Use BeanValidation API annotations||true|
106
106
|useDeductionForOneOfInterfaces|Annotate discriminator-free oneOf interfaces with Jackson's @JsonTypeInfo(use = Id.DEDUCTION) and @JsonSubTypes so the concrete subtype is resolved from the JSON field set rather than a type-tag property. Has no effect when a discriminator is present (name-based resolution is used instead). Requires subtypes to have structurally distinct sets of properties.||false|
107
107
|useEnumCaseInsensitive|Use `equalsIgnoreCase` when String for enum comparison||false|
108
+
|useEnumValueInterface|Generate a ValuedEnum<T> interface in the config package and make all generated enums implement it, providing a common typed way to access the underlying enum value. Use `importMappings.ValuedEnum` to substitute a custom/library-provided interface instead of generating one.||false|
108
109
|useFeignClientContextId|Whether to generate Feign client with contextId parameter.||true|
109
110
|useFeignClientUrl|Whether to generate Feign client with url parameter.||true|
110
111
|useHttpServiceProxyFactoryInterfacesConfigurator|Generate HttpInterfacesAbstractConfigurator based on an HttpServiceProxyFactory instance (as opposed to a WebClient instance, when disabled) for generating Spring HTTP interfaces.||false|
@@ -138,7 +139,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
138
139
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
139
140
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
140
141
|x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null
141
-
|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
142
+
|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. Only applies when `library=spring-boot`; ignored for client libraries (spring-cloud, spring-declarative-http-interface).|OPERATION|false
142
143
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
143
144
|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
144
145
|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
0 commit comments