gatsby-source-google-sheets
gatsby-source-google-sheets copied to clipboard
Mixed field types
Hello, I am trying to receive data from a list of shops. The column "name" contains the names of all shops. I have a name that is called 128 and I think is breaking the plugin:
I receive the following error:
warn There are conflicting field types in your data.
If you have explicitly defined a type for those fields, you can safely ignore this warning message.
Otherwise, Gatsby will omit those fields from the GraphQL schema.
If you know all field types in advance, the best strategy is to explicitly define them with the `createTypes` action, and skip inference with the `@dontInfer` directive.
See https://www.gatsbyjs.org/docs/actions/#createTypes
googleSheetEsercentiRow.name:
- type: number
value: 128
- type: string
value: 'Clothing Company'
Looks like following the advice in the warning message I have solved the issue by defining a custom type.
type googleSheetEsercentiRow implements Node {
address: String
children: NodeFilterListInput
id: String
name: String
phone1: String,
phone2: String
internal: InternalFilterInput
neighborhood: String
parent: NodeFilterInput
type: String
}
Is this the best solution?
Worked for me. In my gatsby-node.js:
exports.createSchemaCustomization = ({ actions }) => {
const { createTypes } = actions
const typeDefs = `
type googleSheetWebsiteDataSourceRow implements Node @dontInfer {
zip: String!
businessname: String!
}
`
createTypes(typeDefs)
}