Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mixed field types #35

Open
ettzzi opened this issue Mar 29, 2020 · 2 comments
Open

Mixed field types #35

ettzzi opened this issue Mar 29, 2020 · 2 comments

Comments

@ettzzi
Copy link

ettzzi commented Mar 29, 2020

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'
@ettzzi
Copy link
Author

ettzzi commented Mar 29, 2020

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?

@brybeecher
Copy link

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)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants