Mayank1791989 / gql

112 stars 19 forks source link

Syntax Error: Cannot parse the unexpected character "&". #115

Open josephktcheung opened 6 years ago

josephktcheung commented 6 years ago

Hi,

Related to graphql/graphql-js#1169, I'm using graphql 0.13.1 and I have a type which implements multiple interfaces:

type Photo implements File & Node {
  id: ID!
  url: URL!
  height: Int!
  width: Int
  images: [Image]
}

And it shows [graphql] Syntax Error: Cannot parse the unexpected character "&". when I turn on graphql for VSCode.

Best, Joseph

ajhyndman commented 6 years ago

Yeah, I'm seeing this too now.

This will be because the version of GraphQL is locked to an old version (0.9.3) and in the most recent versions, this syntax was changed.

See also #111

danielkcz commented 6 years ago

@Mayank1791989 Please, is there some workaround for this? It basically breaks whole thing because it fails to parse schema and all benefits of this are gone.

matt-senseye commented 4 years ago

Is there any update on this issue? As @FredyC points out this renders the entire thing useless if your schema happens to make use of any types that implement multiple interfaces, so it's pretty high impact.

danielkcz commented 4 years ago

@matt-senseye I highly recommend you to look at Apollo GraphQL extension that works nicely. This one seems dead.

matt-senseye commented 4 years ago

@FredyC thanks for the recommendation, the Apollo GraphQL extension is working so I've swapped to that 👍

For the benefit of anyone needing to make the same jump, I didn't find it immediately obvious from the docs how to configure it without using Apollo Engine/Graph Manager, but it worked with the config below:

// apollo.config.js
module.exports = {
  client: {
    service: {
      name: 'Local GraphQL Schema',
      localSchemaFile: "src/generated/schema.graphql"
    },
    includes: [
      "src/app/**/*.{ts,tsx,js,jsx,graphql}"
    ]
  }
};