Graphql-js: printSchema: not valid comments

Created on 15 Feb 2018  路  5Comments  路  Source: graphql/graphql-js

I must be doing something wrong, no one else seems to complain... my schema is being printed with comments with wrong syntax like...

"""
A signed eight-byte integer. The upper big integer values are greater then the
max value for a JavaScript number. Therefore all big integers will be output as
strings and not numbers.
"""
scalar BigInt

the expected syntax is

# A signed eight-byte integer. The upper big integer values are greater then the
# max value for a JavaScript number. Therefore all big integers will be output as
#聽strings and not numbers.
scalar BigInt

All 5 comments

Ohh I see, it has an undocumented option "commentDescriptions"

// Generates comments right
printSchema(schema, { commentDescriptions: true })

~did that option work for you?~ ok its gotta be true, not false

the expected syntax is

@hendrul Version 0.13.0 introduced some breaking changes to SDL syntax, see here:
https://github.com/graphql/graphql-js/releases/tag/v0.13.0

commentDescriptions was added as an option to provide the backward compatible format of descriptions.

Ok I see, cool!, now this option needs to be known

This behavior has been around since v0.12 and was documented in the release notes!
https://github.com/graphql/graphql-js/releases/tag/v0.12.0

Note that the block string is the correct syntax for descriptions in the SDL - we used to use comments before we had a completed specification for this feature.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

henry74 picture henry74  路  4Comments

bhough picture bhough  路  3Comments

davide-ganito picture davide-ganito  路  4Comments

matthewgertner picture matthewgertner  路  4Comments

adriano-di-giovanni picture adriano-di-giovanni  路  3Comments