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] bugfix - PagedModel<T> - default to custom DTO; allow override via import mapping and schema mapping; feature - allow for declarative http interfaces (#23601)
* fix(spring): ensure PagedModel uses mapped FQN for item type in code generation
fix(spring): enhance PagedModel handling with import mapping and schema mapping support
* fix(spring): generate supporting PagedModel files in config package (can be replaced with custom one via importMapping)
* update samples
* improve test
add support for spring declarative interface
* update documentation
* update documentation
* update documentation
* update documentation
* implement feedback from CR
Copy file name to clipboardExpand all lines: docs/generators/java-camel.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,7 +104,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
104
104
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.||true|
105
105
|sourceFolder|source folder for generated code||src/main/java|
106
106
|springApiVersion|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).||null|
107
-
|substituteGenericPagedModel|Detect schemas that represent paginated responses (an object with a 'content' array property and a pagination-metadata property) and replace their generated references with org.springframework.data.web.PagedModel<T>. The detected page schemas and the pagination metadata schema are suppressed from code generation. Only applies when library=spring-boot.||false|
107
+
|substituteGenericPagedModel|Detect schemas that represent paginated responses (an object with a 'content' array property and a 'page' pagination-metadata property) and replace their generated references with PagedModel<T>. By default this uses a generated type in the config package (default 'org.openapitools.configuration'), but `importMappings.PagedModel` can override it to a custom/FQCN-mapped type. The detected page schemas and the pagination metadata schema are suppressed from code generation. Only applies when library=spring-boot or spring-http-interface.||false|
108
108
|testOutput|Set output folder for models and APIs tests||${project.build.directory}/generated-test-sources/openapi|
109
109
|title|server title name or client service name||OpenAPI Spring|
110
110
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).||false|
Copy file name to clipboardExpand all lines: docs/generators/kotlin-spring.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
58
58
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.||null|
59
59
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.||null|
60
60
|sourceFolder|source folder for generated code||src/main/kotlin|
61
-
|substituteGenericPagedModel|Detect schemas that represent paginated responses (an object with a 'content' array property and a pagination-metadata property) and replace their generated references with org.springframework.data.web.PagedModel<T>. The detected page schemas and the pagination metadata schema are suppressed from code generation. Only applies when library=spring-boot.||false|
61
+
|substituteGenericPagedModel|Detect schemas that represent paginated responses (an object with a 'content' array property and a 'page' pagination-metadata property) and replace their generated references with PagedModel<T>. By default this uses a generated type in the config package (default 'org.openapitools.configuration'), but `importMappings.PagedModel` can override it to a custom/FQCN-mapped type. The detected page schemas and the pagination metadata schema are suppressed from code generation. Only applies when library=spring-boot or spring-declarative-http-interface.||false|
62
62
|title|server title name or client service name||OpenAPI Kotlin Spring|
63
63
|useBeanValidation|Use BeanValidation API annotations to validate data types||true|
64
64
|useFeignClientUrl|Whether to generate Feign client with url parameter.||true|
Copy file name to clipboardExpand all lines: docs/generators/spring.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,7 +97,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
97
97
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.||true|
98
98
|sourceFolder|source folder for generated code||src/main/java|
99
99
|springApiVersion|Value for 'version' attribute in @RequestMapping (for Spring 7 and above).||null|
100
-
|substituteGenericPagedModel|Detect schemas that represent paginated responses (an object with a 'content' array property and a pagination-metadata property) and replace their generated references with org.springframework.data.web.PagedModel<T>. The detected page schemas and the pagination metadata schema are suppressed from code generation. Only applies when library=spring-boot.||false|
100
+
|substituteGenericPagedModel|Detect schemas that represent paginated responses (an object with a 'content' array property and a 'page' pagination-metadata property) and replace their generated references with PagedModel<T>. By default this uses a generated type in the config package (default 'org.openapitools.configuration'), but `importMappings.PagedModel` can override it to a custom/FQCN-mapped type. The detected page schemas and the pagination metadata schema are suppressed from code generation. Only applies when library=spring-boot or spring-http-interface.||false|
101
101
|testOutput|Set output folder for models and APIs tests||${project.build.directory}/generated-test-sources/openapi|
102
102
|title|server title name or client service name||OpenAPI Spring|
103
103
|unhandledException|Declare operation methods to throw a generic exception and allow unhandled exceptions (useful for Spring `@ControllerAdvice` directives).||false|
// Simple class name of the PagedModel substitute (derived from importMapping; defaults to "PagedModel")
204
+
privateStringpagedModelClassName = "PagedModel";
203
205
204
206
publicKotlinSpringServerCodegen() {
205
207
super();
@@ -296,10 +298,10 @@ public KotlinSpringServerCodegen() {
296
298
addSwitch(GENERATE_SORT_VALIDATION, "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.", generateSortValidation);
297
299
addSwitch(GENERATE_PAGEABLE_CONSTRAINT_VALIDATION, "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.", generatePageableConstraintValidation);
298
300
addSwitch(SUBSTITUTE_GENERIC_PAGED_MODEL,
299
-
"Detect schemas that represent paginated responses (an object with a 'content' array property and a "
301
+
"Detect schemas that represent paginated responses (an object with a 'content' array property and a 'page' "
300
302
+ "pagination-metadata property) and replace their generated references with "
301
-
+ "org.springframework.data.web.PagedModel<T>. The detected page schemas and the pagination metadata "
302
-
+ "schema are suppressed from code generation. Only applies when library=spring-boot.",
303
+
+ "PagedModel<T>. By default this uses a generated type in the config package (default 'org.openapitools.configuration'), but `importMappings.PagedModel` can override it to a custom/FQCN-mapped type. The detected page schemas and the pagination metadata "
304
+
+ "schema are suppressed from code generation. Only applies when library=spring-boot or spring-declarative-http-interface.",
303
305
substituteGenericPagedModel);
304
306
addSwitch(COMPANION_OBJECT, "Whether to generate companion objects in data classes, enabling companion extensions.", companionObject);
305
307
supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application.");
"Detect schemas that represent paginated responses (an object with a 'content' array property and a "
379
+
"Detect schemas that represent paginated responses (an object with a 'content' array property and a 'page' "
378
380
+ "pagination-metadata property) and replace their generated references with "
379
-
+ "org.springframework.data.web.PagedModel<T>. The detected page schemas and the pagination metadata "
380
-
+ "schema are suppressed from code generation. Only applies when library=spring-boot.",
381
+
+ "PagedModel<T>. By default this uses a generated type in the config package (default 'org.openapitools.configuration'), but `importMappings.PagedModel` can override it to a custom/FQCN-mapped type. The detected page schemas and the pagination metadata "
382
+
+ "schema are suppressed from code generation. Only applies when library=spring-boot or spring-http-interface.",
0 commit comments