Closed imballinst closed 1 year ago
This PR is a PoC to proof that when using groupStrategy: "tag-file", the zod type of Category and Tag are generated last instead of first.
groupStrategy: "tag-file"
Category
Tag
- const Category = z - .object({ id: z.number().int(), name: z.string() }) - .partial() - .passthrough(); - const Tag = z - .object({ id: z.number().int(), name: z.string() }) - .partial() - .passthrough(); const Pet = z .object({ id: z.number().int().optional(), name: z.string(), -- tags: z.array(Tag).optional(), status: z.enum(["available", "pending", "sold"]).optional(), }) .passthrough(); + const Category = z + .object({ id: z.number().int(), name: z.string() }) + .partial() + .passthrough(); + const Tag = z + .object({ id: z.number().int(), name: z.string() }) + .partial() + .passthrough(); const ApiResponse = z .object({ code: z.number().int(), type: z.string(), message: z.string() }) .partial() .passthrough();
As we see above, since Pet is declared first, then it will cause error since Category and Tag isn't defined yet. I'll create an issue for this, referring to this PR.
Pet
The latest updates on your projects. Learn more about Vercel for Git ↗︎
This PR is a PoC to proof that when using
groupStrategy: "tag-file"
, the zod type ofCategory
andTag
are generated last instead of first.As we see above, since
Pet
is declared first, then it will cause error sinceCategory
andTag
isn't defined yet. I'll create an issue for this, referring to this PR.