Closed kziemski closed 1 year ago
Hi @kziemski! Thanks for reporting this. The thing is, it's not necessarily true that these properties should be ignored - I can imagine a case, where they are rendered as read-only fields instead.
To work round that, it'd be easiest to build it into the bridge. You could subclass the ZodBridge
and change the getSubfields
method to exclude such fields.
Let me know how it went!
Agree it would be better if it could also be rendered as a readonly.
Assuming it could be treated as a bug
Is there anyway to ignore fields and subfields in which ZodBridge cannot understand type as opposed to crashing?
Rendering it as read-only out-of-the-box is a problem on its own, as z.literal
accepts null
and undefined
. Also, not all themes support read-only fields.
Is there anyway to ignore fields and subfields in which ZodBridge cannot understand type as opposed to crashing?
Not in a "if crash then ignore" way, as if it reaches the getType
method, rendering already started. As I said above, such fields could be ignored in getSubfields
.
No response so far, so I'm closing. Feel free to comment further, though!
crashing in getType for instance const PersonSchema = z.object({ __typename: z.literal("Person").optional(), name: z.string().min(1) }) const schema = new ZodBridge(PersonSchema) ...
Crashes and throws Field "__typename" has an unknown type.