Skip to content

Conversation

darkbasic
Copy link

Enum dependencies of circular schemas weren't getting proper TypeScript type annotations (z.ZodType<T>), only object dependencies were. This resulted in enums being generated as const Status = z.enum([...]) instead of const Status: z.ZodType<Status> = z.enum([...]).

Root Cause: The template-context.ts logic only set emittedType: true for object dependencies (nodeSchema.type === "object") of circular schemas, but ignored enum dependencies.

Main fix: Extended the circular dependency processing in template-context.ts to also set emittedType: true for enum dependencies (nodeSchema.type === "string" && nodeSchema.enum).

Secondary fix: Fixed dependency detection in getOpenApiDependencyGraph.ts to handle union types like ["array", "null"] that were preventing some enum dependencies from being detected.

Copy link

vercel bot commented Sep 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
openapi-zod-client-rim4 Ready Ready Preview Comment Sep 24, 2025 5:11pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant