spencer.sm
spencer.sm

Reputation: 20574

Descriptions for type fields in graphiql not showing

For reference, I'm using graphql-tools to build my schema and apollo-server-express to provide the graphiql interface.

In graphiql, the following schema is only showing the description for Query and not for the user field. I've also tried using the """ syntax shown in the apollo docs but that didn't work either.

What could be causing the description for Query to show but not for the inner field?

# Description for Query
type Query {
  # Returns data for a single user.
  user(id: Int): User
}

Upvotes: 1

Views: 1309

Answers (1)

spencer.sm
spencer.sm

Reputation: 20574

The way I was attempting was the correct way.

# Single line field description

"""
Multiple
line description
"""

The problem I was actually having was that my dev server wasn't automatically restarting.

I wrote my schema definitions using multiple plaintext .gql files (for syntax highlighting) and didn't realize that those files weren't being watched by nodemon.

I just needed to define what file extensions to watch by adding the ext line to the nodemon config in my package.json file:

"nodemonConfig": {
  "watch": ["src/"],
  "ext": "js json gql"
},

Upvotes: 2

Related Questions