openapi-react-query-codegen
openapi-react-query-codegen copied to clipboard
feat: Support string type for `pageParam` and `nextPageParam` options
resolve #146
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 |
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.