astahmer / openapi-zod-client

Generate a zodios (typescript http client with zod validation) from an OpenAPI spec (json/yaml)

Home Page:openapi-zod-client.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

regex on enum?

fegyi001 opened this issue · comments

I have a strange issue.
When I try to generate zod client from an openapi v3 json file the enums does not seem to work well. It adds a regex to them, but z.enum does not seem to have a 'regex' method.

Property 'regex' does not exist on type 'ZodEnum<["CSV", "PDF"]>'.

image

It turned out that when using enums pattern is not necessary at all. The backend should either provide enum or pattern property, but not both.