Replies: 10 comments
-
On phone, will give example tomorrow, but
|
Beta Was this translation helpful? Give feedback.
-
Interested to see the example, but I think I may not have explained the use case properly. I want to take an appRouter defined on the server side, with So given that (desired) workflow I'm not your suggestion applies - the schema has already been defined on the server side, and there isn't actually a react app to move the schema definition to even if we wanted to. As mentioned this is possible already by just accessing the private variable, which works at runtime, and the compiler error can be suppressed. Likely the pull request to fix this would just be removing |
Beta Was this translation helpful? Give feedback.
-
Ohhh, using trpc with Retool is exciting, I'd love for that to work well. I'll have a peek later today and see if we can find a solution. |
Beta Was this translation helpful? Give feedback.
-
This is using the private property |
Beta Was this translation helpful? Give feedback.
-
You can use the above, just be aware it may stop working in the future without a major version change. If you can make a proof of concept and document it in the official docs I would happily add better support. |
Beta Was this translation helpful? Give feedback.
-
@all-contributors add @mmkal for ideas |
Beta Was this translation helpful? Give feedback.
-
I've put up a pull request to add @mmkal! 🎉 |
Beta Was this translation helpful? Give feedback.
-
did an example that does it dynamically in 43f328c |
Beta Was this translation helpful? Give feedback.
-
Amazing, thank you! Yes that example is exactly along the lines I was thinking. I will try to open a docs PR and make it non-private soon if I can get some spare cycles. |
Beta Was this translation helpful? Give feedback.
-
@mmkal - I'll leave the PR + docs to you then. Would be really cool get an example of this up and running on retool, such a timesaver. |
Beta Was this translation helpful? Give feedback.
-
Hi - have just started using trpc and it is 👌
One request: what do you think about exposing the (zod) schema on the
Procedure
object? The use-case being, I would like to create a UI in an internal admin app using react-json-schema-form for various whitelisted "admin" queries/mutations. If we could accessappRouter._def.queries.myQuery.inputParser
we could pass it to zod-to-json-schema which would give us some schemas we could use with react-json-schema-form.It's possible to do now by suppressing the typescript error about using a private field, but I wanted to see if you'd be open to making it public so that it wouldn't disappear and break our workflow in a minor update.
Beta Was this translation helpful? Give feedback.
All reactions