Dgraph ignores casing in names on generated payloads in graphql resolvers

I’m using the admin API to post a schema to dgraph in my cluster, which I deployed using the helm chart.

When I was using Slash GraphQL, the generated schema retained the casing in my type names. However, when I introspect the generated schema in my own cluster, the names of types in the Payloads of resolvers (e.g. AddXXX and UpdateXXX) are now all lowercase.

e.g. what used to be

UpdateTaxonomyNodePayload { 
    numUids: Int
    taxonomyNode: TaxonomyNode
}

is now:

UpdateTaxonomyNodePayload { 
    numUids: Int
    taxonomynode: TaxonomyNode
}

Note taxonomyNode changing to taxonomynode.

Does anyone know why this is happening?

This is interesting. What version of Dgraph are you using in your own cluster and how are you introspecting your schema?

Heya, I’m using this image: docker.io/dgraph/dgraph:v20.03.4

I’m using the getIntrospectionQuery function of the graphql npm package.

Pretty vanilla… no special options.

import axios from 'axios';
import {getIntrospectionQuery} from 'graphql';

export const getIntrospection = async (url: string) => {
  const query = getIntrospectionQuery({});
  const data = JSON.stringify({
    query,
    variables: {},
  });

  return await axios({
    method: 'post',
    url,
    headers: {
      'Content-Type': 'application/json',
    },
    data: data,
  });
};

This is a known bug in v20.03.x, and has already been fixed in v20.07.x. That is the reason you are getting the correct result with Slash GraphQL because it is running the newer version.

3 Likes

That fixed it, thanks very much!