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] Compiler fails to parse .graphql with new comment syntax #2251

Closed
mike-marcacci opened this issue Dec 29, 2017 · 8 comments
Closed

Comments

@mike-marcacci
Copy link
Contributor

The relay-compiler is unable to parse the new multi-line comment syntax used by printSchema in the graphql package. It's pretty trivial to switch over to a JSON file (instead of .graphql) but this should probably be fixed anyhow.

Given a schema.graphql file containing this:

# ...

type AreaObject implements Node, Object {
  id: ID!

  """This is the name of the area."""
  name: String

  # ...
}

# ...

the command relay-compiler --src ./src --schema ./data/schema.graphql produces:

ERROR:
Error loading schema. Expected the schema to be a .graphql or a .json
file, describing your GraphQL server's API. Error detail:

GraphQLError: Syntax Error GraphQL request (44:3) Expected Name, found String

43:
44:   """This is the name of the area."""
      ^
45:   name: String
@chadfurman
Copy link

I second this issue.

Writing default
ERROR:
Error loading schema. Expected the schema to be a .graphql or a .json
file, describing your GraphQL server's API. Error detail:

GraphQLError: Syntax Error GraphQL request (5:3) Unexpected String

4: 
5:   """All input for the `acceptInvite` mutation."""
     ^
6: input AcceptInviteInput {


@ghost
Copy link

ghost commented Jan 7, 2018

A temporary solution besides using JSON is passing commentDescriptions: true to printSchema to revert to the previous functionality.

printSchema(schema, {
  commentDescriptions: true,
});

@chadfurman
Copy link

My schema is being generated by a third-party library. @benjie is that something we can do in postgraphile / graphile-build ?

@benjie
Copy link

benjie commented Jan 8, 2018

You can generate it yourself using something like this:

https://gist.github.com/benjie/446380c4167edfc532a88f2034514049

@chadfurman
Copy link

Neat. A bit more complicated than would be ideal, but a solution none the less. Thank you :)

@pranaygp
Copy link
Contributor

pranaygp commented Feb 10, 2018

This has been fixed in 1.5.0-rc.1, which uses the latest version of graphql where the fix has been implemented.

Please update to that version (or 1.5.0 once it's released) if you want this fixed

@alloy
Copy link
Contributor

alloy commented Feb 10, 2018

@jstejada This can be closed.

@Kenam18
Copy link

Kenam18 commented Mar 12, 2020

1.5.0-rc.1
I have updated my relay-compiler with a version 1.7.0 but still facing the same issue. Any suggestions?

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

7 participants