Custom data transformer and input/output schema
Hello 👋
I would like to code a data transformer, but I would this data transformer to be aware of the input and output Schema of the procedure.
why:
My typical use case is sending data type that are not serializable directly. I use
This is also a problem with the types that can be encoded and decoded to another type: in this case, the typescript type inferred would be
effect-ts .
So let's take a Schema from @effect/schema:
With effect-ts schema can be decoded and encoded.
As we see in the example: data that are sent to myProdedure are decoded.
But thoses data are not encoded in the client.This is also a problem with the types that can be encoded and decoded to another type: in this case, the typescript type inferred would be
number but in my client side, I should send a string to the mutation, so it doesn't match.
So to solve all my problem, I can encode automatically so that: I would send a number from my mutation, that would be encoded to a string, that would be
decoded to a number, and everything would be perfect.
I've read the doc about data transformer, this is probably what I need, but I need to get the input / output schema to makes this working and this is not possible.
Do you have an idea, or a solution on how to achieve that ?
Thanks in advance 🙏0 Replies