|
26 | 26 |
|
27 | 27 | import java.util.Optional;
|
28 | 28 |
|
| 29 | +import org.springdoc.core.converters.PageOpenAPIConverter; |
29 | 30 | import org.springdoc.core.converters.PageableOpenAPIConverter;
|
30 | 31 | import org.springdoc.core.customizers.DataRestDelegatingMethodParameterCustomizer;
|
31 | 32 | import org.springdoc.core.customizers.DelegatingMethodParameterCustomizer;
|
|
42 | 43 | import org.springframework.context.annotation.Configuration;
|
43 | 44 | import org.springframework.context.annotation.Lazy;
|
44 | 45 | import org.springframework.data.domain.Pageable;
|
| 46 | +import org.springframework.data.web.config.EnableSpringDataWebSupport; |
| 47 | +import org.springframework.data.web.config.SpringDataWebSettings; |
45 | 48 |
|
46 | 49 | import static org.springdoc.core.utils.Constants.SPRINGDOC_ENABLED;
|
47 | 50 | import static org.springdoc.core.utils.Constants.SPRINGDOC_PAGEABLE_CONVERTER_ENABLED;
|
@@ -75,6 +78,22 @@ PageableOpenAPIConverter pageableOpenAPIConverter(ObjectMapperProvider objectMap
|
75 | 78 | return new PageableOpenAPIConverter(objectMapperProvider);
|
76 | 79 | }
|
77 | 80 |
|
| 81 | + /** |
| 82 | + * Page open api converter. |
| 83 | + * @param objectMapperProvider the object mapper provider |
| 84 | + * @return the page open api converter |
| 85 | + */ |
| 86 | + @Bean |
| 87 | + @ConditionalOnMissingBean |
| 88 | + @ConditionalOnBean(SpringDataWebSettings.class) |
| 89 | + @Lazy(false) |
| 90 | + PageOpenAPIConverter pageOpenAPIConverter(SpringDataWebSettings settings, |
| 91 | + ObjectMapperProvider objectMapperProvider) { |
| 92 | + return new PageOpenAPIConverter( |
| 93 | + settings.pageSerializationMode() == EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO, |
| 94 | + objectMapperProvider); |
| 95 | + } |
| 96 | + |
78 | 97 | /**
|
79 | 98 | * Delegating method parameter customizer delegating method parameter customizer.
|
80 | 99 | *
|
|
0 commit comments