New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate schema from types within one file #219
Comments
Hello @kirillkurko, Thanks for reporting. Can you confirm that it works when generating to another file that the initial one? |
Hey @tvillaren, I can confirm that it works when generating to another file. And zod schemas are generated when running with the |
Thanks for reporting, I found the issue. I commited the fix (20175f4) if you need to use it or would like to try it and confirm it does fix your issue 🙏 |
Sounds great, thank you for such a quick response and finding a solution! I'll validate the fix tomorrow and let you know if it works |
Hi @tvillaren, sorry for the late reply, but I just checked the fix and it solved the problem, thanks! 🚀 |
Bug description
In versions
3.6.1
and below (tested down to3.1.2
), it was possible to generate zod schemas from types within a single file using a command similar to the one below:# Note that the input file matches the output file npx ts-to-zod some-file.ts some-file.ts
After updating to version
3.7.3
(3.7.0
,3.7.1
and3.7.2
have not been tested), the above command results in an error and no zod schemas are generated. The same problem occurs when using version3.8.0
.Input
some-file.ts
.some-file.ts
and output the generated schemas to the samesome-file.ts
.Expected output
Zod schemas are generated.
Actual output
No zod schemas are generated.
Versions
v5.2.2
v3.22.4
The text was updated successfully, but these errors were encountered: