✅ Refined inputs #600
Replies: 4 comments
-
This is an interesting idea for further development. I will consider the possibility of its implementation in the future. endpointsFactory.build({
method: "post",
input: z.object({
credentials: z.object({
email: z.string().email().optional(),
phoneNumber: z.string().optional(),
token: z.string().optional()
}).refine(
credentials => Object.keys(credentials).length >= 1,
'Please provide at least one property'
),
}),
// ...
}); |
Beta Was this translation helpful? Give feedback.
-
I don't think the proposed solution is great tbh, I just opened a similar issue before I saw this. Would be great if there was a way to support this without changing the API input. |
Beta Was this translation helpful? Give feedback.
-
I'm thinking on this feature currently. |
Beta Was this translation helpful? Give feedback.
-
@johngeorgewright && @ssteuteville , |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Are there any future plans to allow refining of an input, and not just it's properties?
For example, I want to check that an input has at least one property, but I don't care which one.
Currently the above will fail as the
input
is of typeZodEffects
which cannot be assigned toIOSchema
.Or maybe there's a better solution to the above example
Beta Was this translation helpful? Give feedback.
All reactions