Description Field Missing from __schema

Report a GraphQL Bug

The description field is missing from __schema but should exist per the official schema introspection schema. Some GraphQL clients assume this field exists and will fail when performing introspection, like the graphql and graphql-client Ruby gems.

What edition and version of Dgraph are you using?

Edition:

  • SlashGraphQL
  • Dgraph (community edition/Dgraph Cloud)

If you are using the community edition or enterprise edition of Dgraph, please list the version:

Dgraph Version
$ dgraph version
 
Dgraph version   : v21.12.0
Dgraph codename  : zion
Dgraph SHA-256   : 078c75df9fa1057447c8c8afc10ea57cb0a29dfb22f9e61d8c334882b4b4eb37
Commit SHA-1     : d62ed5f15
Commit timestamp : 2021-12-02 21:20:09 +0530
Branch           : HEAD
Go version       : go1.17.3
jemalloc enabled : true

For Dgraph official documentation, visit https://dgraph.io/docs.
For discussions about Dgraph     , visit http://discuss.dgraph.io.
For fully-managed Dgraph Cloud   , visit https://dgraph.io/cloud.

Licensed variously under the Apache Public License 2.0 and Dgraph Community License.
Copyright 2015-2021 Dgraph Labs, Inc.

Have you tried reproducing the issue with the latest release?

yes

Steps to reproduce the issue (paste the query/schema if possible)

query IntrospectionQuery {
  __schema {
    description
  }
}

Expected behaviour and actual result.

Expected behavior is to get null or a string back.

Actual result:

{
  "errors": [
    {
      "message": "Cannot query field \"description\" on type \"__Schema\". Did you mean \"subscriptionType\"?",
      "locations": [
        {
          "line": 3,
          "column": 5
        }
      ]
    }
  ],
  "extensions": {
    "tracing": {
      "version": 1,
      "startTime": "2022-01-25T04:27:28.468848793Z",
      "endTime": "2022-01-25T04:27:28.468906438Z",
      "duration": 57660
    }
  }
}
1 Like

I am not aware of a description on schema level on the official Graphql Spec. Descriptions are available on fields and on types if i’m not mistaken.

reference: GraphQL introspection query - for fetching the whole schema (from GraphiQL IDE) for https://atheros.ai/blog/graphql-introspection-and-introspection-queries · GitHub

reference: Designing GraphQL schemas - Dgraph Blog.

As for the error you are getting, __schema hasn’t got a description field as a direct child so it cannot be queried.

Thanks for the quick reply. The official GraphQL spec lists the field here: GraphQL

1 Like

Oh okay, didn’t know there was also a description on __schema level. thanks for pointing :+1:

Then i don’t know why it isn’t in there :stuck_out_tongue:

So how do we go about getting this fixed? I’m hoping it can be resolved soon since I don’t think I can provide a custom introspection document in this Ruby library without forking and maintaining our own gem.

Just allowing the field and returning null would be an acceptable fix? You don’t need it to actually return a custom string right?

I think that is correct. I don’t know how that value would ever be set :thinking:. I just know some libraries fail when doing introspection because it’s missing.

Is this field new to the 2021 spec? Dgraph is aligned to the June 2018 spec.

Is there maybe a way for your client to pick which spec the server is using?


Yes, that is the case. Here is the change commit:

https://github.com/graphql/graphql-spec/commit/02fd71f816139b7e040f969860778d23df288d32


I posted about this new spec update here as well:


I think it goes back to

Which is a fork of:

@core-devs @graphql