From f624173252c45883e81a52d1480ff4f0ae7540ae Mon Sep 17 00:00:00 2001 From: Shintaro Kaneko Date: Wed, 16 Dec 2020 18:07:25 +0900 Subject: [PATCH] fix(gatsbu-source-contentful): apply useNameForId when creating the graphql schema --- packages/gatsby-source-contentful/src/gatsby-node.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/gatsby-source-contentful/src/gatsby-node.js b/packages/gatsby-source-contentful/src/gatsby-node.js index 71e4b69c6bbc9..751808f6ce4d3 100644 --- a/packages/gatsby-source-contentful/src/gatsby-node.js +++ b/packages/gatsby-source-contentful/src/gatsby-node.js @@ -346,7 +346,15 @@ exports.sourceNodes = async ( const gqlTypes = contentTypeItems.map(contentTypeItem => schema.buildObjectType({ - name: _.upperFirst(_.camelCase(`Contentful ${contentTypeItem.name}`)), + name: _.upperFirst( + _.camelCase( + `Contentful ${ + pluginConfig.get(`useNameForId`) + ? contentTypeItem.name + : contentTypeItem.sys.id + }` + ) + ), fields: { contentful_id: { type: `String!` }, id: { type: `ID!` },