Open capaj opened 1 year ago
I think this is what we want the behavior to be, since the schema is just a z.number()
with some extra conditions - when checking against the mapping we just look for the zod type of the schema. This allows adding additional checks at the schema level
Should be able to use createUniqueFieldSchema()
on CategoryId
to make it map correctly:
export const CategoryIdSchema = createUniqueFieldSchema('category-id', z
.number()
.int()
.refine((val) => val > 0)
)
This seems consistent with how other types work in the library - let me know if you think there's a reason z.number().int()
should be considered as a something different from z.number().int()
though. I'll leave open for now for discussion
Version Number
1.6.4
Codesandbox/Expo snack
No response
Steps to reproduce
I have this mapping
yet even when I use
CategoryId
in my zod schema, it is still rendering withNumberField
I will try to prepare a code sandbox
Expected behaviour
It should prefer the exact zod type rather than the generic
z.number()
field componentRelevant log output
No response