OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.42k stars 6.48k forks source link

[SPRING] Support for Spring Data Pageable #5993

Open Bloodlex opened 4 years ago

Bloodlex commented 4 years ago
Description

I would like the OpenAPI Generator to be able to generate Pageable parameter in API according to the implementation in Spring Boot Data. I've been trying to find a suitable, out of the box solution, but couldn't find one.

Ideally, this Pageable parameter should be added only to GET methods in a following manner:

default ResponseEntity<User> getUser(@ApiParam(value = "value",required=true) @PathVariable("id") Long id, Pageable pageable)

So after implementing this interface in my Controller I would need to override it and having this aforementioned Pageable parameter. I don't want to have separate parameters for size, page or sort, only this Pageable here.

Thanks for any tips and help!

openapi-generator version

4.3.0

AlejandroKolio commented 4 years ago

It would be nice to have a generified Page response automaticaly generated from spec. something like: ResponseEntity<Page<User>> instead of ResponseEntity<Page>

bilak commented 3 years ago

@Bloodlex does this work for you https://github.com/OpenAPITools/openapi-generator/pull/5022 ?

lozybean commented 3 years ago

It would be nice to have a generified Page response automaticaly generated from spec. something like: ResponseEntity<Page<User>> instead of ResponseEntity<Page>

I have same problem. Page<User> in api-docs will produce schema name like Page« User» , and this will cause an error

-attribute components.schemas.Schema name Page«User» doesn't adhere to regular expression ^[a-zA-Z0-9\.\-_]+$