Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

groq-builder: zod compatibility #257

Merged
merged 52 commits into from
Feb 5, 2024
Merged

groq-builder: zod compatibility #257

merged 52 commits into from
Feb 5, 2024

Conversation

scottrippey
Copy link
Member

@scottrippey scottrippey commented Jan 23, 2024

What

Ensures full compatibility with Zod.
Ditches the "lite validation" that I had implemented.
If Zod is not used, it can still be tree-shaken with this approach, so it's still an "optional" dependency.

Additional changes:

  • Type improvements, documentation as per feedback from @bkonkle
  • Added validationRequired: true flag, for enforcing runtime validation if desired
  • Removed $ from q.conditional$ and q.select$ methods; these are now just q.conditional and q.select
  • Improved all projections, so that "optional" values are correctly mapped as | null types

Copy link

vercel bot commented Jan 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
groqd ⬜️ Ignored (Inspect) Visit Preview Feb 4, 2024 0:52am

@scottrippey scottrippey marked this pull request as ready for review January 26, 2024 21:07
Copy link
Contributor

@BrianWalters BrianWalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me, although a lot of this is over my head. Making Zod tree-shakable is important.

@scottrippey scottrippey merged commit a6e10ab into main Feb 5, 2024
5 checks passed
@scottrippey scottrippey deleted the zod-again branch February 5, 2024 15:13
@github-actions github-actions bot mentioned this pull request Feb 5, 2024
@scottrippey
Copy link
Member Author

I added like a hundred more commits :) I had a lot of things on the mind to fix and improve!

@heggemsnes
Copy link
Contributor

@scottrippey not sure if this is the right format but using Zod for all validation will certainly slow down the editors and possibly noticable runtime validations as queries become complex.

Added a bit context in #261 but after using Groqd for >10 production projects we are scrambling for an option as developer experience has become intolerable.

@scottrippey
Copy link
Member Author

I'd love to discuss!
For our next major release, we've made zod optional, so maybe that will help with your performance issues. However, we've added a lot more TypeScript in order to enable auto completion too.

I'd love to hear more about the kind of performance issues you've experienced. Are these run time issues? Or TypeScript + IDE performance issues?

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.

3 participants