-
Notifications
You must be signed in to change notification settings - Fork 21
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
Make next-typesafe-url validation library agnostic #67
Comments
I found this the other day: https://typeschema.com/ |
@riordanpawley thank you for sharing this
No, this project is awesome and we should use it.
Agree, can't imagine it's too difficult. Could probably get some effect guys to do it as well. |
Nice, let's partner up on this! I saw that someone just sent a PR for @effect/schema support (decs/typeschema#17). I'll work with them to get that production ready to unblock your integration. |
Thanks for the help! I'll give it a shot when I get home. I think it should be as easy as changing the zod infer methods to the type schema ones, plus some small runtime stuff. My hope is that updating the docs will take longer. |
@decs ran into a small issue Would it be possible to add a |
hey, @ethanniser! to follow up on for discriminating between success/fail, you can check for the existence of the "issues" key, like so: if ('issues' in result) {
console.log(result.issues);
} else {
console.log(result.data);
} |
@decs got it thanks for the help! if I may ask, do you have a specific objection to having a discriminating field like in my opinion, having a discriminating success field makes code clearer and more readable, as well as being more in like with 'standard conventions' for union types happy to move this discussion to an issue on the typeschema repo btw |
hey, @ethanniser! initially, I had picked I decided to update |
@decs looks great, appreciate your support |
@decs wrote some basic tests using valibot and typebox for the functions that take in a generic schema but im getting some weird errors the exact same code works with no issues in a playground: https://tsplay.dev/mqylQm any clue what this might be? im using ver 0.10.2 |
I'm closing this as not planned. Long term I want to move to @effect/schema which will address #77 fully |
currently next-typesafe-url requires the use of zod
it would be ideal if it could support a multitude of libraries:
typebox, valibot, @effect/schema, etc.
trpc supports a bunch of validation libraries, we should look to do something similar
https://trpc.io/docs/server/validators
https://github.com/trpc/trpc/blob/main/packages/server/src/core/parser.ts
https://github.com/trpc/trpc/blob/main/packages/server/src/core/internals/getParseFn.ts
The text was updated successfully, but these errors were encountered: