Skip to content

Add helper for coercing empty string query params to undefined#391

Merged
Chucks1093 merged 2 commits into
accesslayerorg:mainfrom
Johnpii1:main
May 31, 2026
Merged

Add helper for coercing empty string query params to undefined#391
Chucks1093 merged 2 commits into
accesslayerorg:mainfrom
Johnpii1:main

Conversation

@Johnpii1
Copy link
Copy Markdown
Contributor

Summary

Description
Added a reusable helper coerceEmptyStringQueryParamsToUndefined in src/utils/empty-query-param.utils.ts that converts empty-string values to undefined, collapses empty-array results, and recurses into query record objects.
Applied the helper in the shared public query parser by normalizing the input in parsePublicQuery (src/utils/public-query-parse.utils.ts) before Zod validation so all public endpoints receive consistent query shapes.
Added unit tests in src/utils/empty-query-param.utils.test.ts that assert empty search, verified, and cursor params normalize the same as omitted values and that non-empty strings are preserved.

Testing

Testing
Ran the unit test suite for the new tests with pnpm exec jest src/utils/empty-query-param.utils.test.ts --runInBand, which passed.
Ran eslint on the modified files, which reported no errors (pnpm exec eslint src/utils/empty-query-param.utils.ts src/utils/empty-query-param.utils.test.ts src/utils/public-query-parse.utils.ts).
pnpm build was attempted but failed in this environment due to missing/generated Prisma client type exports unrelated to these changes (known workspace type generation issue).

  • pnpm lint
  • pnpm build
  • pnpm exec prisma generate when schema or generated types changed

Checklist

  • Linked issue or backlog item
  • No secrets or live credentials added
  • Docs updated if setup or env changed
  • Change is scoped to one problem

close #379

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 31, 2026

@Johnpii1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Chucks1093 Chucks1093 merged commit 71bd519 into accesslayerorg:main May 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add helper for coercing empty string query params to undefined

2 participants