-
Notifications
You must be signed in to change notification settings - Fork 221
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
graph codegen
: handle reserved words
#1929
Conversation
Deploying graph-tooling with
|
Latest commit: |
f6ea892
|
Status: | ✅ Deploy successful! |
Preview URL: | https://3c35e1f8.graph-tooling.pages.dev |
Branch Preview URL: | https://yaro-codegen-reserved-words.graph-tooling.pages.dev |
🦋 Changeset detectedLatest commit: f6ea892 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
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.
LGTM but just curious, why isn't safeName
also used in the body of the generated code ?
For example here:
graph-tooling/packages/cli/src/codegen/schema.ts
Lines 343 to 352 in f6ea892
return tsCodegen.method( | |
`get ${safeName}`, | |
[], | |
returnType, | |
` | |
let value = this.get('${name}') | |
${isNullable ? getNullable : getNonNullable} | |
`, | |
); | |
} |
That would mean renaming these fields in subgraph GraphQL schema, and that's unnecessary and leaks implementation details. |
Fixes #1896