Graphql-yoga: type and field descriptions?

Created on 4 Jan 2018  路  3Comments  路  Source: dotansimha/graphql-yoga

According to https://stackoverflow.com/questions/39962867/how-do-i-add-a-description-to-a-field-in-graphql-schema-language you should be able to do:

# A type that describes the user
type User {
     # The user's username, should be typed in the login field.
     username: String!
     # The user's password.
     password: String!
}

Shouldn't this add A type that describes the user here?

Most helpful comment

That's the old syntax for comments/descriptions. Since graphql 0.12, you should now use """ for descriptions. So:

"""A type that describes the user"""
type User {
     """The user's username, should be typed in the login field."""
     username: String!
     """The user's password."""
     password: String!
}

I have just tested this syntax with the latest graphql-playground (that comes with graphql-yoga), and the descriptions show up, if you use this new syntax.

All 3 comments

That's the old syntax for comments/descriptions. Since graphql 0.12, you should now use """ for descriptions. So:

"""A type that describes the user"""
type User {
     """The user's username, should be typed in the login field."""
     username: String!
     """The user's password."""
     password: String!
}

I have just tested this syntax with the latest graphql-playground (that comes with graphql-yoga), and the descriptions show up, if you use this new syntax.

Thanks for helping out @kbrandwijk 馃憤

We should probably add some documentation about this for GraphQL Playground.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bmcilw1 picture bmcilw1  路  5Comments

yesprasad picture yesprasad  路  3Comments

checkmatez picture checkmatez  路  5Comments

2wce picture 2wce  路  4Comments

frederikhors picture frederikhors  路  4Comments