Skip to content
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

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

Closed
espinhogr opened this issue Mar 3, 2019 · 2 comments
Closed

Comments

@espinhogr
Copy link
Contributor

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

@espinhogr
Copy link
Contributor Author

I'm already working on it and I have a PR.

espinhogr added a commit to espinhogr/apollo-tooling that referenced this issue Mar 3, 2019
espinhogr added a commit to espinhogr/apollo-tooling that referenced this issue Mar 3, 2019
espinhogr added a commit to espinhogr/apollo-tooling that referenced this issue Mar 4, 2019
trevor-scheer pushed a commit that referenced this issue Mar 4, 2019
@trevor-scheer
Copy link
Member

Fixed in #1066

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

No branches or pull requests

2 participants