-
Notifications
You must be signed in to change notification settings - Fork 22
Fix flattening zod schema - chained calls, enum value, tsConfigFilePath #59
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
base: main
Are you sure you want to change the base?
Conversation
Ting/fix generator for chained calls
…_path_option feat: generator: allow tsconfig path as module option
…_path_option feat: generator: allow tsconfig path as module option
feat: generator: flatten enum to literal value
@tinglei8 is attempting to deploy a commit to the Kevin's Projects Team on Vercel. A member of the Team first needs to authorize it. |
feat: trpc-module: allow configuring `rootModuleFilePath` in options
I assume this would fix #18 with tsConfig paths not generating schemas? Definitely would like to see this merged if so! |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
fix: remove function bodies from zod schema
Hello, I know there hasn't been any releases in a while and that @KevinEdry said that he's busy but planning on working on this repo - but it has been 6 months and still nothing - does anyone have info about this? Is there a fork of this library, if it has been abandoned? The zod schemas not being flattened is a big issue because it won't allow build without type errors... |
I've added some maintainers to this library recently so we should see those getting merged pretty soon. |
Wow, thank you for the info. This library is amazing and I appreciate your work very much! |
This is also a big thing for me that I would like to see, so it will be one of the first PRs that I look into getting merged in. |
There are 3 fixes in this PR:
Fix 1: Flatten chained function calls.
An example:
Before the fix, references to
TypeEnum
are not flattened inFindManyInput
because it's referenced as parameters of theobject()
andmerge()
calls instead of the lastdescribe()
call.After the fix, The
TypeEnum
schema is properly flattened in all places that reference it.Fix 2: add
tsConfigFilePath
to module config.See issue: #18
Fix 3: Flatten enum name to literal values.
An example:
Before the fix, it generates:
type: z.literal(export enum TypeEnum { Normal = 'Normal', Unknown = 'Unknown' }).describe('Type of the item')
After the fix, it generates:
type: z.literal('Normal').describe('Type of the item')