-
Notifications
You must be signed in to change notification settings - Fork 33
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
Option to replace shield()
with another runtime validator (e.g. zod
)
#97
Comments
I agree it would be nice, but it's far from trivial, and not even possible if drizzle doesn't support type inference. As for adding support for Zod, it's a consideration but so far Closing as I don't think it should be a priority right now: so far, I don't see the added value to be worth the effort. Feel free to object and elaborate. Contribution or sponsoring welcome. |
I don't know what is the right solution, I am just thinking if there is a better integration of type validation with other libraries such as drizzle or zod. Right now all types has to be constructed using shield's buildin type |
I agree that'd be nice. But, again, I don't know if it's possible: does Drizzle types support runtime validation like Zod does? As for Zod, I still don't see much of an added value compared to |
I'm not against this at all. I'm just waiting for a good reason for implementing this. Labeling this as |
Actually, form data is a valid use case for this as explained at #105. Removing That said, contribution or sponsoring welcome. If someone wants to contribute, we can start by having a look at how tRPC does it. |
shield()
with another runtime validator (e.g. zod
)
I'm thinking, maybe an alternative could be to allow users to use Telefunc's |
shield handles basic use cases well, but it doesn't seem to allow defining more complex use cases such as array structure, nested object structure, etc. If shield can be extended with other custom validator and it works well then it would be very useful. But the use case this post is about isn't about extensibility. I'm asking if it is possible if I can have my typescript types to be used with shield. |
@pencilcheck Can you elaborate your use case for needing complex Telefunction arguments? Are you following https://telefunc.com/event-based? The more I know, the better can I take informed decisions. |
I have been using drizzle orm for database typing generation. I have a enum I want to expose as a function parameter. I have created the type but I'm not sure if I can pass it onto the field, as it seems like shield is expecting a certain type of typing input in order for it to work.
I know how to specify enum from shield, but is it possible to allow custom typing such as drizzle to be used instead?
Example
The text was updated successfully, but these errors were encountered: