asteasolutions / zod-to-openapi

A library that generates OpenAPI (Swagger) docs from Zod schemas
MIT License
997 stars 61 forks source link

Add support for discriminator on native enums properties #210

Open shaikegross opened 9 months ago

shaikegross commented 9 months ago

Currently discriminating on a field, which changes between different NativeEnum types causes model definition to be incorrect as mapping from discriminator field doesn't map to each of the enum values.

I used the same solution that existed for ZodEnum, and applied it for ZodNativeEnum