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
Is your feature request related to a problem? Please describe.
starting with spring-boot-3.3.0 / spring-data-commons-3.3.0, you can choose to use PagedModel<T> (part of spring-data's public api) as (default) response representation of spring-data's Page<T> interface.
adding @EnableSpringDataWebSupport(pageSerializationMode = EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO) does not change springdoc's behavior - it still uses the Page interface to infer the response representation (which kinda makes sense given it is still the controller method return type)..
Describe the solution you'd like
it would be nice if springdoc would support PageSerializationMode.VIA_DTO, e.g. by making it aware of SpringDataWebSettings.pageSerializationMode or by some means of configuration.
Describe alternatives you've considered
works (although not always desirable):
using PagedModel explicitly (i.e. changing controller return type from Page<T> to PagedModel<T>) and returning new PagedModel<>(myPage)
this does not respect generics - i.e. it results in one PagedModel<?> schema (content: any[]) instead of specific representations tied to the contained type like it works for Page<T> (e.g. Page<Person> -> PagePerson schema (content: Person[]))
using SpringDocUtils.getConfig().replaceWithClass(Page.class, PagedModel.class)
this does not respect generics as well - same problem as above
Additional context
n/a
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
starting with spring-boot-3.3.0 / spring-data-commons-3.3.0, you can choose to use
PagedModel<T>
(part of spring-data's public api) as (default) response representation of spring-data'sPage<T>
interface.ref. https://docs.spring.io/spring-data/commons/reference/repositories/core-extensions.html#core.web.page.config
adding
@EnableSpringDataWebSupport(pageSerializationMode = EnableSpringDataWebSupport.PageSerializationMode.VIA_DTO)
does not change springdoc's behavior - it still uses thePage
interface to infer the response representation (which kinda makes sense given it is still the controller method return type)..Describe the solution you'd like
it would be nice if springdoc would support
PageSerializationMode.VIA_DTO
, e.g. by making it aware ofSpringDataWebSettings.pageSerializationMode
or by some means of configuration.Describe alternatives you've considered
PagedModel
explicitly (i.e. changing controller return type fromPage<T>
toPagedModel<T>
) and returningnew PagedModel<>(myPage)
@ApiResponse(content = @Content(schema = @Schema(implementation = PagedModel.class)))
PagedModel<?>
schema (content: any[]
) instead of specific representations tied to the contained type like it works forPage<T>
(e.g.Page<Person>
->PagePerson
schema (content: Person[]
))SpringDocUtils.getConfig().replaceWithClass(Page.class, PagedModel.class)
Additional context
n/a
The text was updated successfully, but these errors were encountered: