Skip to content

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

Closed
@vsahav

Description

@vsahav

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions