-
-
Notifications
You must be signed in to change notification settings - Fork 114
Recursive zod fields now uses string literal - Fixes #1900 #1901
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
Conversation
🦋 Changeset detectedLatest commit: 10f4b61 The changes in this PR will be included in the next version bump. This PR includes changesets to release 21 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughUpdated code generation in Changes
Sequence Diagram(s)(omitted — changes are a localized code-generation formatting update; control flow is unchanged) Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Related Documentation Checked 1 published document(s). No updates required. You have 2 draft document(s). Publish docs to keep them always up-to-date |
More templates
@kubb/cli
@kubb/core
kubb
@kubb/mcp
@kubb/oas
@kubb/parser-ts
@kubb/plugin-client
@kubb/plugin-cypress
@kubb/plugin-faker
@kubb/plugin-mcp
@kubb/plugin-msw
@kubb/plugin-oas
@kubb/plugin-react-query
@kubb/plugin-redoc
@kubb/plugin-solid-query
@kubb/plugin-svelte-query
@kubb/plugin-swr
@kubb/plugin-ts
@kubb/plugin-vue-query
@kubb/plugin-zod
@kubb/react
unplugin-kubb
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/plugin-zod/src/parser.ts (1)
370-373
: Escape the property name to handle embedded quotes/backslashesUse the existing transformers.stringify to safely emit the string literal; avoids edge cases when name contains " or .
Apply this diff:
- return `get "${name}"(){ + return `get ${transformers.stringify(name)}(){ return ${zodKeywordMapper.nullish(objectValue)} }` - return `get "${name}"(){ + return `get ${transformers.stringify(name)}(){ return ${zodKeywordMapper.optional(objectValue)} }` - return `get "${name}"(){ + return `get ${transformers.stringify(name)}(){ return ${zodKeywordMapper.nullable(objectValue)} }` - return `get "${name}"(){ + return `get ${transformers.stringify(name)}(){ return ${objectValue} }`
Also applies to: 377-380, 384-387, 389-392
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/plugin-zod/src/parser.ts
(1 hunks)
🔇 Additional comments (1)
packages/plugin-zod/src/parser.ts (1)
370-373
: Quoting getter names is the right call for non-identifier keysThis prevents failures on keys like default, 123, or foo-bar and aligns with the intent of #1900. Looks good.
Also applies to: 377-380, 384-387, 389-392
Codecov Report❌ Patch coverage is
Additional details and impacted files
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Documentation Updates Checked 1 published document(s). No updates required. You have 2 draft document(s). Publish docs to keep them always up-to-date |
A humble attempt to solve the issue described in #1900.
Please let me know, if I can do anything more to help. :)
Summary by CodeRabbit