-
-
Notifications
You must be signed in to change notification settings - Fork 467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad Pageable description in Page<DumbBuzModel> description #1215
Comments
This is your generated Pageable object: Pageable:
type: object
properties:
page:
minimum: 0
type: integer
format: int32
size:
minimum: 1
type: integer
format: int32
sort:
type: array
items:
type: string Are you expecting anything different ? |
Hi @bnasslahsen , Yes I expect this for the response :
|
You want a different description for the same object Pageable, between the request and response.
This is a sample code, that you can adapt. @GetMapping(value = "/search", produces = MediaType.APPLICATION_JSON_VALUE)
@PageableAsQueryParam
public Page<ApplicationSimpleDto> findApplication(@Parameter(hidden = true) Pageable pageable) {
return ...;
} |
Thank you for your answer. |
My local solution is to exclude SpringDocDataRestConfiguration.class with
And add a similar class without
|
i see this workaround works fine. @Configuration
class OpenAPIConfig {
@EventListener(ContextRefreshedEvent.class)
void contextRefreshedEvent() {
SpringDocUtils.getConfig().disableReplacement(org.springframework.data.domain.Pageable.class);
}
} |
It work as well. Thank you 👍🏼 |
This issue should be reopened, as the bug persists and the workaround is ugly (and basically disables
Perhaps, after replacing In the meantime, I think it's a good idea to mention the workaround in the Springdoc documentation. |
Replacing We have already introduced the custom Meanwhile, if we find out any better alternatives. will update this ticket. Anyway, if you are feeling the replacement of Page will bring as added value, please feel free to propose a PR. |
@bnasslahsen In fact, what is proposed here is fixing a bug in I would propose a PR, but I'm not sure how to go about replacing In the meantime, I do think it's wise to reopen this issue, as the docs are currently incorrectly claiming that As an aside, Springfox does not have this issue. It would be great to have feature parity in this aspect. |
I am not sure, you are understanding what i have explained here: For the consistency of combining both If you are looking for handling generics replacement, you can see WebFluxSupportConverter. |
Describe the bug
When I use this library
And this code :
the result is this schema :
but in openapi spec generated it's this schemas (look at pageable description) :
If I do not use springdoc-openapi-data-rest I don't have this trouble but I have no support for Pageable in parameters.
To Reproduce
Steps to reproduce the behavior:
You can use this repo : https://github.com/informatique-cdc/ebad/tree/feature/openapi_security and I had openapi description in attached file (is a yaml file).
openapi.txt
Expected behavior
The good behaviour is to have this :
Thanks a lot for your work :)
The text was updated successfully, but these errors were encountered: