Enum with a null value causes type error
BrandonGoren opened this issue · comments
Describe the bug
As of 1.11.1, the following command produces an enum that does not work with zod.
openapi-zod-client https://raw.githubusercontent.com/plaid/plaid-openapi/master/2020-09-14.yml -o src/generated/plaid-api-schemas.ts --export-schemas
/** Has a type error **/
export const OwnershipType = z.enum([
null,
'individual',
'joint',
'association',
'trust',
])
Minimal reproduction
OwnershipType:
nullable: true
type: string
enum:
- null
- individual
- joint
- association
- trust
Expected behavior
The z.enum
should be nullable, and not include the null value.
I'm also bumping into this. Has anyone found a reliable workaround?