Skip to content

Commit

Permalink
fix(gatsbu-source-contentful): apply useNameForId when creating the g…
Browse files Browse the repository at this point in the history
…raphql schema (#28649)
  • Loading branch information
kaneshin committed Jan 14, 2021
1 parent a03e862 commit a3ad6d7
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/gatsby-source-contentful/src/gatsby-node.js
Expand Up @@ -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!` },
Expand Down

0 comments on commit a3ad6d7

Please sign in to comment.