Replies: 1 comment 1 reply
-
You’re right, we should also support cursor-based pagination, so I believe we need an option to generate pageParam and nextPageParam as strings. Could you create an issue for this? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm unsure whether I'm doing something wrong, so feel free to correct me, otherwise I can open this up as an issue.
This command correctly creates all hooks with the exception of the
infiniteQueries.ts
file.openapi-rq -i http://localhost:5000/rest/openapi -o ./src/data/api --pageParam after --nextPageParam nextLink
When I examine the generated hooks:
SongService.getSongIdById({ after: pageParam as number, authorization, filter, first, id, orderby, select, xMsApiRole }) as TData
I see an error on the
after
parameter. It's expecting a string (correct), but this code is brute forcing it to a number (incorrect).Here's an example of the
nextLink
value:"nextLink": "http://localhost:5000/rest/Song?$first=5&$after=W3siRW50aXR5TmFtZSI6IlNvbmciLCJGaWVsZE5hbWUiOiJJZCIsIkZpZWxkVmFsdWUiOiJBQjc4MDlBRC02RkE0LTQ1NkQtQkQ3NS0wM0VCMjcxOTZBMjIiLCJEaXJlY3Rpb24iOjB9XQ=="
My first thought was that this library doesn't support cursor-based pagination, but as it's so widely used, I'd be surprised. Am I doing something wrong?
Beta Was this translation helpful? Give feedback.
All reactions