-
-
Notifications
You must be signed in to change notification settings - Fork 546
fix: escape quotes in enum string values #365
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
…g values are not escaped
Codecov Report
@@ Coverage Diff @@
## main #365 +/- ##
=======================================
Coverage 92.91% 92.91%
=======================================
Files 5 5
Lines 268 268
Branches 90 90
=======================================
Hits 249 249
Misses 13 13
Partials 6 6
Continue to review full report at Codecov.
|
@@ -73,7 +73,7 @@ export default function generateTypesV3( | |||
(node.enum as string[]).map((item) => | |||
typeof item === "number" || typeof item === "boolean" | |||
? item | |||
: `'${item}'` | |||
: `'${item.replace(/'/g, "\\'")}'` |
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.
This makes sense to me. In my experience, you should never be too aggressive escaping quotes like this, as you may end up with more things escaped than anticipated.
I believe this fixes #256? |
ah yes, thanks! |
|
I've run into this problem when updating to the latest GitHub schema, this PR reproduces the problem the same way. I'm looking into fixing it
fixes #256