Closed aconrad closed 3 months ago
@aconrad,
Not reproducible. Feel free to provide a Minimal, Reproducible Example - with HelloController that reproduces the problem.
This ticket will be closed, but can be reopened if your provide the reproducible sample.
We also experienced similar (probably buggy) behavior. After using the annotation @EnableSpringDataWebSupport(pageSerializationMode = EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO)
the generated API doc does not represent the actual response structure.
The following issue might be related: https://github.com/springdoc/springdoc-openapi/issues/2625
@aconrad have you found the solution for the same in the latest 3.3.0 version of springboot and please share the same , i am still facing the issue in latest springboot 3.3.1 ,
"sort": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SortObject"
}
},
Describe the bug
When my controller returns
Page<...>
, the JSON response has the keyscontent
(containing the paged items) andpage
(containing the pageable info) but the openapi spec shows a different schema with keys such ascontent
(as expected) but alsopageable
,totalElements
,totalPages
,first
,last
, etc... (see full list below). This started happening when I upgradedorg.springframework.boot
from 3.2.6 to 3.3.0.Why doesn't the openapi spec reflect the returned data?
To Reproduce Steps to reproduce the behavior:
The openapi output (JSON, only the relevant part):
The data returned by the controller:
Expected behavior
I expect the JSON output to describe PageItemDto with only 2 keys,
content
andpage
.Something like this (handcrafted, sorry if typos):
Screenshots If applicable, add screenshots to help explain your problem.
org.springframework.boot 3.3.0:
org.springframework.boot 3.2.6:
Additional context Add any other context about the problem here.