Closed ConnorSinnott closed 5 months ago
Hi! Thanks for opening an issue. I'm hesitant to expanding the API for this. Perhaps use the override feature?
Closing for now! Feel free to reopen if it doesn't work out.
No problem! Thanks for the support!
Howdy! I understand that the branding system doesn't really exist at runtime, but there could be value in adding wrappers which enable the JSON ser/de to retain the brands. Something along the line of
zodToJsonSchemaBranded('my-brand', z.___.brand())
wherezodToJsonSchemaBranded<T extends string>(brand: T, schema: z.ZodBranded<T>)
. I think it could be possible for inner .brand function to infer the string from the wrapper.