nightspite
nightspite
TtRPC
Created by nightspite on 4/10/2024 in #❓-help
How do I exclude properties while returning data?
Sure in most of the cases, but in the edge case, where for example a value of one property is null I would rather have it returned with the null there than to have a validation error. Or in the case of using the same schema for validating input (for example setting min length of a string) and output, if a record with min length that would not satisfy this validation would also throw the error, even tho it might be unnecessary. Just my way of thinking about this problem. I had this problem with ts-rest, that is also using zod for validating output, that's why it's on my mind and I'm looking for other ways to solve it
6 replies
TtRPC
Created by nightspite on 4/10/2024 in #❓-help
How do I exclude properties while returning data?
how do you actually achieve that? you can technically parse them, so they will automatically strip all unnecessary properties, but if the parse would fail, then you are left with zod validation error and nothing got returned
6 replies