You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it's common issue for generate type from open api spec.
I am using with zodios https://github.com/astahmer/openapi-zod-client/ openapi-zod-client. But did not found any possible solution to generate enum , instead I see that only union types is possible . Any idea to generate TS enum to use this enum in a code durin compile time .
By default it's generate a union with type flag enabled or via handlebars templates you can do yourself. But it is not possible to generate TS enum or z.nativeEnums
Output:
export const Format= z.enum([
'Flat',
'Grouped',
])
export type FormatType = z.infer<typeof Format> // union one
The text was updated successfully, but these errors were encountered:
palaniichukdmytro
changed the title
Generate TS enum and union wtih openapi zod client
Generate TS enum and z.nativeEnum openapi zod client
Sep 7, 2023
I think it's common issue for generate type from open api spec.
I am using with zodios https://github.com/astahmer/openapi-zod-client/ openapi-zod-client. But did not found any possible solution to generate enum , instead I see that only union types is possible . Any idea to generate TS enum to use this enum in a code durin compile time .
Example schema json
By default it's generate a union with type flag enabled or via handlebars templates you can do yourself. But it is not possible to generate TS enum or z.nativeEnums
Output:
Exacted/Desire output
The text was updated successfully, but these errors were encountered: