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

Relay Compiler: Syntax error when compiling schemas with multiple inheritance #2364

Closed
cousine opened this issue Mar 11, 2018 · 1 comment
Closed

Comments

@cousine
Copy link

cousine commented Mar 11, 2018

Given the following schema:

interface Invitable {
  avatar_url: String
  email: String
  github_nickname: String
  id: ID!
  name: String
}

interface Node {
  # ID of the object.
  id: ID!
}

type Student implements Node, Invitable {
  avatar_url: String
  email: String
  github_nickname: String
  id: ID!
  name: String
}

type Teacher implements Node, Invitable {
  avatar_url: String
  email: String
  github_nickname: String
  id: ID!
  name: String
}

Relay compiler would throw a syntax error Unexpected name Invitable, however, if I replace the , with & the schema would compile:

interface Invitable {
  avatar_url: String
  email: String
  github_nickname: String
  id: ID!
  name: String
}

interface Node {
  # ID of the object.
  id: ID!
}

type Student implements Node & Invitable {
  avatar_url: String
  email: String
  github_nickname: String
  id: ID!
  name: String
}

type Teacher implements Node & Invitable {
  avatar_url: String
  email: String
  github_nickname: String
  id: ID!
  name: String
}

Same issue can also be found here: https://stackoverflow.com/questions/49198778/relay-compiler-cannot-compile-graph-cool-graphql-schemas-with-multiple-inheritan

Info:

node@8.0.0
npm@5.6.0
relay-compiler@1.5.0
Schema auto generated via get-graphql-schema@2.1.1

@alloy
Copy link
Contributor

alloy commented Mar 12, 2018

This is due to a change in the SDL spec that was implemented in graphql-js v0.13. While graphql-js can technically accept an option to enable legacy parsing, it is not exposed in relay-compiler.

The simplest way to make this work would be to make get-graphql-schema work with graphql-js v0.13, possibly by using e.g. yarn’s resolutions feature: https://yarnpkg.com/lang/en/docs/selective-version-resolutions/

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