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

Support for string literals as description #86

Closed
kortac opened this issue Apr 12, 2018 · 5 comments
Closed

Support for string literals as description #86

kortac opened this issue Apr 12, 2018 · 5 comments
Labels
parser Blocked on parser

Comments

@kortac
Copy link

kortac commented Apr 12, 2018

As of version 0.12.3 the default style of describing a type or field is to add a string literal instead of a comment.
https://github.com/graphql/graphql-js/blob/master/src/utilities/extendSchema.js#L44

Expected Behaviour

Parsing a schema with string literals as descriptions and generating the Golang files.

Actual Behavior

Crashing due to invalid syntax.

Minimal graphql.schema and models to reproduce

"This is a description."
schema {
    query: Query
}

Results in unable to parse schema: graphql: syntax error: unexpected "\"This is a comment.\"", expecting Ident (line 1, column 1)

@imiskolee
Copy link

maybe start with comment symbol is better. like

//This is a description.
schema {
    query: Query
}

@kortac
Copy link
Author

kortac commented Apr 17, 2018

gqlgen should stick to the reference implementation.

The implementation states that descriptions should be written as string literals. Comments are no longer used for descriptions.

/**
 * Descriptions are defined as preceding string literals, however an older
 * experimental version of the SDL supported preceding comments as
 * descriptions. Set to true to enable this deprecated behavior.
 *
 * Default: false
 */
commentDescriptions?: boolean,

Source: https://github.com/graphql/graphql-js/blob/master/src/utilities/extendSchema.js#L44

@imiskolee
Copy link

@SpaceHeroGuide got it. thanks!

@vektah
Copy link
Collaborator

vektah commented Apr 24, 2018

The blocker on this, and a few other issues is the parser we use for schema.

Upstream issue graph-gophers/graphql-go#196

Another alternative is to fork https://github.com/tmc/graphql and get it up to date. A parser generator would be nice way nicer to work with than a hand rolled parser.

@vektah vektah added the parser Blocked on parser label May 3, 2018
@vektah
Copy link
Collaborator

vektah commented Aug 7, 2018

Fixed in 0.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser Blocked on parser
Projects
None yet
Development

No branches or pull requests

3 participants