Skip to content

Types with reserved keywords 'is' and 'as' are generated incorrectly #82

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

Closed
vsahav opened this issue Jun 11, 2024 · 0 comments · Fixed by #83
Closed

Types with reserved keywords 'is' and 'as' are generated incorrectly #82

vsahav opened this issue Jun 11, 2024 · 0 comments · Fixed by #83

Comments

@vsahav
Copy link

vsahav commented Jun 11, 2024

Say we have a graphql schema as follows:

Type Somei8n {
  aa: String,
  ab: String,
  ae: String,
  # and so on...
  as: String,
}

The generator generates a .kt file:

data class Somei8n (
  val aa: String? = null,
  val ab: String? = null,
  //and so on...
  val as: String? = null, //compilation error due to the reserved keyword as not being wrapped in backticks
)

Types with fields matching to reserved keywords should be wrapped with backticks:

data class Somei8n (
  val `as`: String? = null, //works and retains field name
)

Applies at least to is and as keywords. Exhaustive list of Kotlin keywords can be found at: kotlin docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant