Skip to content

The keyword "type" is not treated as special when generating scala.js #1065

@espinhogr

Description

@espinhogr

Given a GraphQL type that looks like:

type Todo {
   id: String!
   type: String!
}

Intended outcome:

@scala.scalajs.js.native trait Todo extends scala.scalajs.js.Object {
      @scala.scalajs.js.annotation.JSName("id") val id: String
      @scala.scalajs.js.annotation.JSName("type") val `type`: String
}

Notice the declaration of the attribute "type" that is escaped with backquotes.

Actual outcome:

@scala.scalajs.js.native trait Todo extends scala.scalajs.js.Object {
      @scala.scalajs.js.annotation.JSName("id") val id: String
      @scala.scalajs.js.annotation.JSName("type") val type: String
}

How to reproduce the issue:
Create a GraphQL schema that has an object containing a field named "type" and try to generate the code for Scala.js .

Versions
apollo 2.5.3

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