-
Notifications
You must be signed in to change notification settings - Fork 473
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
Configuration validation #1573
Comments
Re-opening this as original PR which addressed this was reverted and subsequent work has taken place on #2133 I've also updated the description |
@maschad I want to work on this issue. |
It's worth reading this comment - #2133 (comment) At the time Zod added a massive chunk of code to browser bundles, too much for us to adopt it. The situation was supposed to improve with Zod v4 but from what I can see, that still hasn't been released. It would be good to finally close this issue out though, I would probably use superstruct instead since it's over 10x smaller than Zod. We can switch later if there's a pressing reason to do so. I would start with a PR that just adds validation to the |
We don't perform much in the way of validation on loaded libp2p config but we really should.
Ideally each module parsing it's config would use something like superstruct to validate at creation time and fail fast with good feedback to the user as to how they can fix their broken config.
This should negate the need for PRs like #1572 as the config would have been validated in src/config.ts already.
Update
@achingbrain explored a few different options and we determined that zod is perhaps the best choice. Currently Zod is 8kb minified + zipped but based on this discussion there are a few different approaches to making Zod tree-shakeable.
Anyone who takes up this work can continue with the commits on #2133 and have look at the discussion on that PR
The text was updated successfully, but these errors were encountered: