diff --git a/gatsby-node.js b/gatsby-node.js index 02cbf5d..40aa13a 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -63,7 +63,8 @@ exports.createSchemaCustomization = function () { createTypes = actions.createTypes; contentTypes.forEach(function (contentType) { - var name = typePrefix + '_' + contentType.uid; + var contentTypeUid = contentType.uid.replace(/-/g, '_'); + var name = typePrefix + '_' + contentTypeUid; var result = buildCustomSchema(contentType.schema, [], name, typePrefix); if ((0, _keys2.default)(result.references).length === 0) { var typeDefs = ['type linktype{\n title: String\n href: String\n }', schema.buildObjectType({ diff --git a/package.json b/package.json index 6f49b81..7872e05 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gatsby-source-contentstack", - "version": "2.2.3", + "version": "2.2.4", "description": "Gatsby source plugin for building websites using Contentstack as a data source", "scripts": { "prepublish": "npm run build", diff --git a/src/gatsby-node.js b/src/gatsby-node.js index 156a238..5f93847 100644 --- a/src/gatsby-node.js +++ b/src/gatsby-node.js @@ -30,7 +30,8 @@ exports.createSchemaCustomization = async ({ createTypes, } = actions; contentTypes.forEach((contentType) => { - const name = `${typePrefix}_${contentType.uid}`; + const contentTypeUid = ((contentType.uid).replace(/-/g, '_')); + const name = `${typePrefix}_${contentTypeUid}`; const result = buildCustomSchema(contentType.schema, [], name, typePrefix); if (Object.keys(result.references).length === 0) { const typeDefs = [