Skip to content

Commit d2ddf99

Browse files
committed
FAQ 11.45 Wrong dependency?. Fixes #22
1 parent a309d9b commit d2ddf99

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

src/docs/asciidoc/faq.adoc

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,19 +173,29 @@ springdoc.packagesToScan=package1, package2
173173

174174
=== How can I map `Pageable` (spring-date-commons) object to correct URL-Parameter in Swagger UI?
175175

176-
The projects that uses `spring-data` should add this dependency together with the `springdoc-openapi-ui` dependency:
177-
[source,xml]
176+
If you only want to enable the support of spring Pageable Type, you can just enable it using:
177+
178+
[source,properties]
178179
----
179-
<dependency>
180-
<groupId>org.springdoc</groupId>
181-
<artifactId>springdoc-openapi-data-rest</artifactId>
182-
<version>latest.version</version>
183-
</dependency>
180+
springdoc.model-converters.pageable-converter.enabled=true
184181
----
185182

186-
* If you use Pageable in a GET HTTP method, you will have to declare the explicit mapping of Pageable fields as Query Params and add the @Parameter(hidden = true) Pageable pageable on your pageable parameter.
183+
* If you use Pageable in a GET HTTP method, you will have to declare the explicit mapping of Pageable fields as Query Params and add the `@Parameter(hidden = true) Pageable pageable` on your pageable parameter.
187184
* You should also, declare the annotation `@PageableAsQueryParam` provided by springdoc on the method level, or declare your own if need to define your custom description, defaultValue, ...
188185
* Since, v1.3.1 you can use as well `@ParameterObject` instead of `@PageableAsQueryParam` for HTTP `GET` methods.
186+
[source,java]
187+
----
188+
static {
189+
getConfig().replaceParameterObjectWithClass(org.springframework.data.domain.Pageable.class, Pageable.class)
190+
.replaceParameterObjectWithClass(org.springframework.data.domain.PageRequest.class, Pageable.class);
191+
}
192+
----
193+
194+
NOTE: The property `springdoc.model-converters.pageable-converter.enabled` is only available since v1.5.11+
195+
196+
TIP: The projects that uses `spring-boot-starter-data-rest` should add the following dependency `springdoc-openapi-data-rest` in combination with the `springdoc-openapi-ui`.
197+
This dependency handles the main previous points listed above.
198+
189199

190200

191201
=== How can I generate enums in the generated description?
@@ -456,14 +466,14 @@ public OpenAPI customOpenAPI() {
456466
springdoc.cache.disabled= true
457467
----
458468

459-
=== How can I expose the api-docs endpoints without using the `swagger-ui`?
469+
=== How can I expose the mvc api-docs endpoints without using the `swagger-ui`?
460470
* You should use the `springdoc-openapi-core` dependency only:
461471

462472
[source,xml]
463473
----
464474
<dependency>
465475
<groupId>org.springdoc</groupId>
466-
<artifactId>springdoc-openapi-core</artifactId>
476+
<artifactId>springdoc-openapi-webmvc-core</artifactId>
467477
<version>latest.version</version>
468478
</dependency>
469479
----

0 commit comments

Comments
 (0)