Graphql-go: Support for string literals as description

Created on 12 Apr 2018  路  5Comments  路  Source: graph-gophers/graphql-go

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

Using the schema

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

results in a crash.

Most helpful comment

The schema IDL only exists in the draft spec. I think it makes sense to keep up to date with it. The current "stable" is years behind and only specifies the query syntax afaik.

All 5 comments

Thanks for requesting! We have this tracked for adding support in the roadmap.

I took a look at adding it in with the current lexer/parser but ran into some issues working """ syntax into it, so I detoured into writing a GraphQL-syntax based lexer instead of leaning on the Go-syntax based text/scanner.

I _think_ I'll have the time to get this feature in within ~two weeks.

A small concern, the GraphQL specification states that comments start with #. This will remain right? Because I see that "Support descriptions; deprecate comment functionality", and deprecation would violate that, or I miss understood the roadmap entry?

Yep, comments are comments, as far as the spec is concerned they should be treated as whitespace.

Descriptions are quoted strings that act like a little like comments but are added to the description field for the type they precede in the introspection api.

see also:

OK, so we talk about the "draft" of the new specification. I hope that deprecation comes after the new spec is released, not while we still are using the ancient 2016 spec :)

The schema IDL only exists in the draft spec. I think it makes sense to keep up to date with it. The current "stable" is years behind and only specifies the query syntax afaik.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bsr203 picture bsr203  路  6Comments

thewillhuang picture thewillhuang  路  5Comments

rogchap picture rogchap  路  5Comments

MrMatten picture MrMatten  路  6Comments

Hagbarth picture Hagbarth  路  6Comments