File tree 1 file changed +8
-6
lines changed
springdoc-openapi-starter-common/src/main/java/org/springdoc/core/configuration
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change 43
43
import org .springframework .context .annotation .Configuration ;
44
44
import org .springframework .context .annotation .Lazy ;
45
45
import org .springframework .data .domain .Pageable ;
46
+ import org .springframework .data .web .PagedModel ;
46
47
import org .springframework .data .web .config .EnableSpringDataWebSupport ;
47
48
import org .springframework .data .web .config .SpringDataWebSettings ;
48
49
@@ -85,15 +86,16 @@ PageableOpenAPIConverter pageableOpenAPIConverter(ObjectMapperProvider objectMap
85
86
*/
86
87
@ Bean
87
88
@ ConditionalOnMissingBean
88
- @ ConditionalOnBean ( SpringDataWebSettings .class )
89
+ @ ConditionalOnClass ({ PagedModel . class , SpringDataWebSettings .class } )
89
90
@ Lazy (false )
90
- PageOpenAPIConverter pageOpenAPIConverter (SpringDataWebSettings settings ,
91
+ PageOpenAPIConverter pageOpenAPIConverter (Optional < SpringDataWebSettings > settings ,
91
92
ObjectMapperProvider objectMapperProvider ) {
92
- return new PageOpenAPIConverter (
93
- settings .pageSerializationMode () == EnableSpringDataWebSupport .PageSerializationMode .VIA_DTO ,
94
- objectMapperProvider );
93
+ boolean replacePageWithPagedModel = settings .map (SpringDataWebSettings ::pageSerializationMode )
94
+ .map (EnableSpringDataWebSupport .PageSerializationMode .VIA_DTO ::equals )
95
+ .orElse (false );
96
+ return new PageOpenAPIConverter (replacePageWithPagedModel , objectMapperProvider );
95
97
}
96
-
98
+
97
99
/**
98
100
* Delegating method parameter customizer delegating method parameter customizer.
99
101
*
You can’t perform that action at this time.
0 commit comments