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

refactor: use zod in builders #10117

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

Qjuh
Copy link
Contributor

@Qjuh Qjuh commented Feb 4, 2024

Please describe the changes this PR makes and why it should be merged:

Replaces shapeshift with zod and zod-validation-error in @discordjs/builders.

Closes #9468.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating
  • This PR changes the library's interface (methods or parameters added)

Copy link

vercel bot commented Feb 4, 2024

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

Name Status Preview Comments Updated (UTC)
discord-js ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 23, 2024 11:37am
discord-js-guide ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 23, 2024 11:37am

Copy link

codecov bot commented Feb 4, 2024

Codecov Report

Attention: Patch coverage is 95.23810% with 16 lines in your changes are missing coverage. Please review.

Project coverage is 59.38%. Comparing base (a66fc65) to head (15460ea).
Report is 35 commits behind head on main.

Files Patch % Lines
...ers/src/components/selectMenu/ChannelSelectMenu.ts 16.66% 5 Missing ⚠️
...src/components/selectMenu/MentionableSelectMenu.ts 20.00% 4 Missing ⚠️
...ilders/src/components/selectMenu/RoleSelectMenu.ts 33.33% 2 Missing ⚠️
...ilders/src/components/selectMenu/UserSelectMenu.ts 33.33% 2 Missing ⚠️
...ilders/src/components/selectMenu/BaseSelectMenu.ts 85.71% 1 Missing ⚠️
...lders/src/interactions/slashCommands/Assertions.ts 97.29% 1 Missing ⚠️
packages/builders/src/util/validation.ts 95.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10117      +/-   ##
==========================================
- Coverage   62.19%   59.38%   -2.81%     
==========================================
  Files         209      244      +35     
  Lines       16316    17108     +792     
  Branches     1214     1250      +36     
==========================================
+ Hits        10148    10160      +12     
- Misses       6123     6903     +780     
  Partials       45       45              
Flag Coverage Δ
builders 95.57% <95.23%> (+<0.01%) ⬆️
next ∅ <ø> (∅)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Qjuh Qjuh marked this pull request as ready for review February 4, 2024 19:32
@Qjuh Qjuh requested review from a team and iCrawl as code owners February 4, 2024 19:32
Copy link
Member

@vladfrangu vladfrangu left a comment

Choose a reason for hiding this comment

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

Also, this needs a rebase

packages/builders/src/util/validation.ts Show resolved Hide resolved
pnpm-lock.yaml Outdated Show resolved Hide resolved
@Qjuh Qjuh requested a review from vladfrangu February 23, 2024 12:24
@Jiralite Jiralite changed the title refactor(builders): use zod in builders refactor: use zod in builders Feb 29, 2024
@favna
Copy link
Contributor

favna commented Apr 17, 2024

Builders used to use Zod but there were many many complaints about it. That was after /builders initially used the ow library as well. It was changed to the at the time freshly made shapeshift. One of the reasons for us to even make shapeshift was improvements to /builders.

I can reason this is related to confusing errors (the actual linked issue is a duplicate). I very strongly recommend you instead contribute to Shapeshift by fulfilling this issue for which most work is already finished in this pr and only unit tests need to be updated. Once that issue is resolved custom messages can be assigned in /builders and get very clear errors.

Also relevant:

@didinele
Copy link
Member

This has all already been discussed in internals, albeit rather scattered, see:

there's probably more if you search for "shapeshift".

@favna
Copy link
Contributor

favna commented Apr 17, 2024

Copying my message from Discord to here after reading that conversation:

So I understand the argument of "it's still a draft", but there's also a good reason for that, there's simply still tasks to do. I've buggered @vladfrangu and @kyranet for (checks date of PR) 1,5 years now to help me with the PR because I'm inclined to think that I overcorrected in the source code as evident from what I see get returned in the unit tests, but I've never received any. Ergo, PR is stuck.

Adding to it, technically I could finish that PR in a couple of days if I really sit down and just finish it. I've just been lacking the motivation to do so. Once it's finished though, adding custom messages is a singe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Review in Progress
Development

Successfully merging this pull request may close these issues.

None yet

5 participants