openapi-react-query-codegen icon indicating copy to clipboard operation
openapi-react-query-codegen copied to clipboard

feat: Support string type for `pageParam` and `nextPageParam` options

Open 7nohe opened this issue 1 year ago • 2 comments

resolve #146

7nohe avatar Sep 17 '24 15:09 7nohe

Coverage Report

Status Category Percentage Covered / Total
🟢 Lines 99.05% (🎯 95%) 2103 / 2123
🟢 Statements 99.05% (🎯 95%) 2103 / 2123
🟢 Functions 100% (🎯 95%) 42 / 42
🟢 Branches 93.57% (🎯 85%) 204 / 218
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/createUseQuery.mts 99.47% 94.5% 100% 99.47% 299-302
Generated in workflow #331

github-actions[bot] avatar Sep 17 '24 15:09 github-actions[bot]

I'm running into a problem with initialPageParam here. My api expects no or an empty initial page parameter. initialPageParam="" generates code that sends page=0. I believe the reason is that formatOptions => safeParseNumber converts the empty string to 0.

I can work around it by setting initialPageParam="''" which generates code that sends page=%27%27 which works with my api but it's a bit ugly.

Ideally there would be a omitInitialPageParam parameter that would change it so that no page parameter is send at all.

JonasPf avatar Sep 26 '24 12:09 JonasPf