Open zzsoszz opened 7 years ago
@zzsoszz looks like it's removed somehow 😞
@cbornet @diyfr would you please take a look when you've time?
Is there any update on this? @wing328
It seems @diyfr ‘s PR was never merged
What should we do now? @cbornet Can we merge @diyfr 's PR on the behalf of him?
Hey guys, is there any update? This issue is a big deal for me since my team and I use spring-mvc rather extensively and this is the only issue that stops me from trying codegen in production.
Hi, is there a update? In our project we want to generate our APIs, but the Pageable and Page objects are the reason why we still dont do this.
This feature has not been finalized because it's very specific to SpringFramework. It's been a while since I use Spring anymore, I often use SparkJava it's most light for micro services. If you think it's necessary, I'll see if I can find some time to implement it.(You can also contribute :) PR3357 ) If not, in my projects I treat it this way Add query parameters for each resources :
parameters:
- $ref: '#/parameters/ppage'
- $ref: '#/parameters/psize'
- $ref: '#/parameters/psort'
Don't miss to add a partial response
'206':
description: 'Partial Content'
schema:
type: 'array'
items:
$ref: '#/definitions/Pet
or (see best practise)
'206':
description: 'Partial Content'
schema:
$ref: '#/definitions/Pets'
Define parameters for all project
parameters:
ppage:
name: 'page'
in: 'query'
description: 'Results page you want to retrieve (0..N)'
type: 'integer'
psize:
name: 'size'
in: 'query'
description: 'Number of records per page.'
type: 'integer'
psort:
name: 'sort'
in: 'query'
description: 'Sorting criteria property(,asc|desc) Default sort order is ascending. Multiple sort criteria are supported.'
uniqueItems: true
collectionFormat: 'pipes'
type: 'array'
items:
type: 'string'
Best practise encapsulate your paginated response :
Pets:
type: 'object'
properties:
page:
type: 'integer'
format: 'int32'
size:
type: 'integer'
format: 'int32'
sort:
type: 'string'
total:
type: 'integer'
format: 'int64'
count:
type: 'integer'
format: 'int32'
results:
type: 'array'
items:
$ref: '#/definitions/Pet'
You can also added in your response HTTP header X-Pagination-Count
, X-Pagination-Page
, X-Pagination-Limit
it's more standard, and applicable for all generators
@wing328 The pull request must be submitted to SwaggerCodeGen or OpenApiGenerator ?
This feature has not been finalized because it's very specific to SpringFramework. It's been a while since I use Spring anymore, I often use SparkJava it's most light for micro services. If you think it's necessary, I'll see if I can find some time to implement it.(You can also contribute :) PR3357 ) If not, in my projects I treat it this way Add query parameters for each resources :
parameters: - $ref: '#/parameters/ppage' - $ref: '#/parameters/psize' - $ref: '#/parameters/psort'
Don't miss to add a partial response
'206': description: 'Partial Content' schema: type: 'array' items: $ref: '#/definitions/Pet
or (see best practise)
'206': description: 'Partial Content' schema: $ref: '#/definitions/Pets'
Define parameters for all project
parameters: ppage: name: 'page' in: 'query' description: 'Results page you want to retrieve (0..N)' type: 'integer' psize: name: 'size' in: 'query' description: 'Number of records per page.' type: 'integer' psort: name: 'sort' in: 'query' description: 'Sorting criteria property(,asc|desc) Default sort order is ascending. Multiple sort criteria are supported.' uniqueItems: true collectionFormat: 'pipes' type: 'array' items: type: 'string'
Best practise encapsulate your paginated response :
Pets: type: 'object' properties: page: type: 'integer' format: 'int32' size: type: 'integer' format: 'int32' sort: type: 'string' total: type: 'integer' format: 'int64' count: type: 'integer' format: 'int32' results: type: 'array' items: $ref: '#/definitions/Pet'
You can also added in your response HTTP header
X-Pagination-Count
,X-Pagination-Page
,X-Pagination-Limit
it's more standard, and applicable for all generators@wing328 The pull request must be submitted to SwaggerCodeGen or OpenApiGenerator ?
and how do you parse the parameters into a Pageable? it seems complicated to parse the sort parameter, when i have a look at SortHandlerMethodArgumentResolver
Description
is there any way to make it works? https://github.com/swagger-api/swagger-codegen/issues/3353 https://github.com/swagger-api/swagger-codegen/pull/3357
json code
generated java source