-
Notifications
You must be signed in to change notification settings - Fork 658
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
Differentiate escaping of Java or Kotlin keywords #3630
Conversation
@@ -37,7 +37,7 @@ public class TestQuery() : Query<TestQuery.Data> { | |||
public override fun selections(): List<CompiledSelection> = TestQuerySelections.root | |||
|
|||
public data class Data( | |||
public val enum_: Enum? | |||
public val `enum`: Enum? |
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.
I must admit I don't understand this one. Is this KotlinPoet automatically escaping it? If yes why is it not done in other places?
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.
Relevant PR from kotlinpoet: square/kotlinpoet#994
Feels weird escaping in both Apollo + KotlinPoet but I'm not sure we can rely 100% on KotlinPoet because we might use identifiers in places where KotlinPoet doesn't know enough context to escape?
Things like:
CodeBlock.of("%L.value", layout.fieldName(responseName))
Might be worth trying to remove all escaping from Apollo and give KotlinPoet the proper hints?
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.
apollo-compiler/src/main/kotlin/com/apollographql/apollo3/compiler/ReservedKeywords.kt
Outdated
Show resolved
Hide resolved
apollo-compiler/src/test/graphql/com/example/reserved_keywords/TestOperation.graphql
Show resolved
Hide resolved
c6f7975
to
fdffe2d
Compare
No description provided.