Skip to content

Parser/Lexer error with an empty query type #1495

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

Closed
fungiboletus opened this issue Aug 30, 2018 · 3 comments
Closed

Parser/Lexer error with an empty query type #1495

fungiboletus opened this issue Aug 30, 2018 · 3 comments

Comments

@fungiboletus
Copy link

Hei,

I have a very simple schema with only mutations. The server library I use requires a query type to be defined, so I defined an empty Query type.

This is my very simple schema:

type Query {}

And the error when I try to parse it:

V:\whatever\node_modules\graphql\language\parser.js:1299
  throw (0, _error.syntaxError)(lexer.source, token.start, 'Expected ' + kind + ', found ' + (0, _lexer.getTokenDesc)(token));
  ^
Syntax Error: Expected Name, found }

GraphQL request (1:13)
1: type Query {}

GraphQL Version : 0.13.2

@fungiboletus
Copy link
Author

Probably related to #937

@IvanGoncharov
Copy link
Member

IvanGoncharov commented Aug 30, 2018

@yellowiscool It's expected behavior.
You can pass parsing stage by omitting curly brackets type Query but you GraphQL still errors if you try to execute queries against such schema.

As Lee pointed our #937 is fixed: #937 (comment)

Fixing problem that you describe requires changes to GraphQL Specification and actively discussed here: graphql/graphql-spec#490

@fungiboletus
Copy link
Author

Alright. Thanks for the great explanation.

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