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

GraphQLError on working against schema.graphql generated by absinthe 1.6 #452

Closed
ymtszw opened this issue Feb 4, 2021 · 4 comments
Closed

Comments

@ymtszw
Copy link

ymtszw commented Feb 4, 2021

/home/ymtszw/workspace/siiibo-app/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:39717
  throw (0, _error.syntaxError)(lexer.source, token.start, "Expected \"".concat(value, "\", found ").concat((0, _lexer.getTokenDesc)(token)));
  ^
GraphQLError: Syntax Error: Expected "schema", found String "Represents a schema"
    at syntaxError (/home/ymtszw/workspace/siiibo-app/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:37451:10)
    at expectKeyword (/home/ymtszw/workspace/siiibo-app/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:39717:32)
    at parseSchemaDefinition (/home/ymtszw/workspace/siiibo-app/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:39005:3)
    at parseTypeSystemDefinition (/home/ymtszw/workspace/siiibo-app/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:38957:16)
    at parseDefinition (/home/ymtszw/workspace/siiibo-app/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:38404:12)
    at many (/home/ymtszw/workspace/siiibo-app/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:39773:16)
    at parseDocument (/home/ymtszw/workspace/siiibo-app/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:38367:18)
    at parse (/home/ymtszw/workspace/siiibo-app/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:38302:10)
    at Object.buildSchema (/home/ymtszw/workspace/siiibo-app/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:49061:43)
    at Object.generateOrExitIntrospectionFileFromSchema (/home/ymtszw/workspace/siiibo-app/node_modules/@dillonkearns/elm-graphql/dist/bundle.js:53112:82) {
  locations: [ { line: 1, column: 1 } ]
}

The culprit here is description on schema directive:

# generated by absinthe 1.5
schema {
  query: RootQueryType
  mutation: RootMutationType
}

...
# generated by absinthe 1.6
"Represents a schema"
schema {
  query: RootQueryType
  mutation: RootMutationType
}

...

"Represents a schema" is newly inserted line, which causes error.

In graphql spec I assume everything is describe-able, so I believe this is a valid schema file, but no confidence here.
https://spec.graphql.org/June2018/#sec-Descriptions

Which part of the generator needs looking? Or, should this be reported to Absinthe as inconsistency?

Any guidance is appreciated.

@ymtszw
Copy link
Author

ymtszw commented Feb 4, 2021

For now I'm dropping first line of the generated file with | tail -n +2 as a cheap workaround.

@dillonkearns
Copy link
Owner

Hello! This is using the NPM package graphql under the hood. It looks like they added support for this syntax in their 15.0.0 release through this PR graphql/graphql-js#2419.

I think if I merge this pull request from dependabot it should fix it: #446.

Maybe I can add a little test case to try it out in the end-to-end tests after merging this in. Thanks for reporting the issue!

@dillonkearns
Copy link
Owner

dillonkearns commented Feb 4, 2021

Published! I believe this should be working in the latest NPM release: https://github.com/dillonkearns/elm-graphql/blob/master/CHANGELOG-NPM-PACKAGE.md#411---2021-02-04.

Could you try it out and confirm that it's working for you without the workaround now? Thank you!

@ymtszw
Copy link
Author

ymtszw commented Feb 5, 2021

Quickness 👍
And it worked, thanks.

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