micronaut-projects / micronaut-projects/micronaut-openapi
Support pagination for generated httpClients
- Dominant language
- Java
- Stars
- 114
- Forks
- 121
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 25
Description
### Feature description
**Summary**
I don't think there's a native way to support pagination with the openapi generator, correct me if I'm wrong.
example endpoint: from Zendesk's api to list categories
```yaml
/api/v2/help_center/{locale}/categories:
parameters:
- $ref: '#/components/parameters/OptionalLocale'
get:
operationId: ListCategories
tags:
- Category
summary: List Categories by Locale
description: |-
Note: {/locale} is an optional parameter for admins and agents. End users and anonymous users must provide the parameter.
Allowed for
- Anonymous users
The response will list only the categories that the agent, end user, or
anonymous user can view in the help center.
Pagination
- Cursor pagination (recommended)
- Offset pagination
See Pagination.
Sorting
You can sort the results with the sort_by and sort_order query string parameters.
GET /api/v2/help_center/en-us/categories.json?sort_by=updated_at&sort_order=asc
The sort_by parameter can have one of the following values:
value
description
position
order set manually using the Arrange Content page. Default order
created_at
order by creation time
updated_at
order by update time
The sort_order parameter can have one of the following values:
value
description
asc
ascending order
desc
descending order
Sideloads
The following sideloads are supported:
Name
Will sideload
translations
the category translations, if any
Translations are embedded within the category because they're
not shared between resources.
parameters:
- name: sort_by
in: query
description:
Sorts the results by one of the accepted values
schema:
type: string
enum:
- position
- created_at
- updated_at
- name: sort_order
in: query
description:
Selects the order of the results.
schema:
type: string
enum:
- asc
- desc
responses:
"200":
description:
description
content:
application/json:
schema:
$ref: '#/components/schemas/CategoriesResponse'
```
Using this yaml, the generator produces a single `Mono` object, then I write my own way to support the pagination.
I can't find any documentation on this being supported with the openapi generator - it could be supported already and I'm simply not finding it.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by checking how the generator handles the example OpenAPI response that currently produces a single Mono, along with any existing pagination documentation or support. Define the expected generated-client behavior for cursor and offset pagination, then verify that the result supports the Zendesk-style endpoint without requiring custom pagination code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, openapi
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100