Gatsby: [gatsby-transformer-react-docgen] throws conflicting field types warning

Created on 5 Aug 2018  路  18Comments  路  Source: gatsbyjs/gatsby

Description

gatsby-transformer-react-docgen throws "There are conflicting field types in your data" warning depending on the PropTypes.

Here are two components that conflict:

Button.propTypes = {
  type: PropTypes.oneOf(['button', 'submit']),
}
DatePicker.propTypes = {
  lastMonth: PropTypes.instanceOf(Date),
}



md5-9f412e013ee2af60fc555f6b9592434e



warning There are conflicting field types in your data. GraphQL schema will omit those fields.
ComponentProp.type.value:
 - type: array<object>
   value: [ { value: '\'button\'', computed: false }, ... ]
   source: File "conflicting-components/Button.jsx"
 - type: string
   value: 'Date'
   source: File "conflicting-components/DatePicker.jsx"
ComponentProp.parentType.value:
 - type: array<object>
   value: [ { value: '\'button\'', computed: false }, ... ]
   source: File "conflicting-components/Button.jsx"
 - type: string
   value: 'Date'
   source: File "conflicting-components/DatePicker.jsx"



md5-985a290412b6bd8c047d9e104993f270



  System:
    OS: macOS High Sierra 10.13.6
    CPU: x64 Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
    Shell: 5.5.1 - /usr/local/bin/zsh
  Binaries:
    Node: 8.11.3 - ~/.nvm/versions/node/v8.11.3/bin/node
    Yarn: 1.7.0 - /usr/local/bin/yarn
    npm: 5.6.0 - ~/.nvm/versions/node/v8.11.3/bin/npm
  Browsers:
    Chrome: 68.0.3440.84
    Firefox: 61.0.1
    Safari: 11.1.2
  npmPackages:
    gatsby: next => 2.0.0-beta.69
    gatsby-source-filesystem: next => 2.0.1-beta.10
    gatsby-transformer-react-docgen: next => 2.1.1-beta.4

File contents (if changed)

gatsby-config.js: N/A
package.json: N/A
gatsby-node.js: N/A
gatsby-browser.js: N/A
gatsby-ssr.js: N/A

help wanted not stale bug

All 18 comments

Hmmm that's no good. @jquense know of any easy way to fiddle with the schema to allow for this?

Same error noticed when I ran reproduction.

warning There are conflicting field types in your data. GraphQL schema will omit those fields.
ComponentProp.type.value:
 - type: array<object>
   value: [ { value: '\'button\'', computed: false }, ... ]
   source: File "conflicting-components/Button.jsx"
 - type: string
   value: 'Date'
   source: File "conflicting-components/DatePicker.jsx"
ComponentProp.parentType.value:
 - type: array<object>
   value: [ { value: '\'button\'', computed: false }, ... ]
   source: File "conflicting-components/Button.jsx"
 - type: string
   value: 'Date'
   source: File "conflicting-components/DatePicker.jsx"

Hi! I think I'd like to work on this but I'm trying to understand the issue first. Is it that the types aren't actually conflicting, or that it compiles successfully even with the conflict?

They types aren't conflicting, there is a false positive because the fields in question are JSON scalars but the Gatsby inference logic thinks they are objects and lists. I actually "fixed" this problem previously, where it wasn't compiling but it seems like it's still starting to print a warning even tho there aren't any conflicts to print

Old issues will be closed after 30 days of inactivity. This issue has been quiet for 20 days and is being marked as stale. Reply here or add the label "not stale" to keep this issue open!

This issue is being closed due to inactivity. Is this a mistake? Please re-open this issue or create a new issue.

Hi all -- I still get this (https://github.com/gatsbyjs/gatsby/issues/7027#issuecomment-410878317) very same issue. I can't see this having been solved or addressed directly anywhere?

Package.json:
"gatsby": "^2.23.0",
"gatsby-cli": "^2.12.43",
"gatsby-plugin-mdx": "^1.2.14",
"gatsby-plugin-postcss": "^2.3.3",
"gatsby-plugin-sass": "^2.3.3",
"gatsby-source-filesystem": "^2.3.10",
"gatsby-transformer-react-docgen": "^5.2.3",

Thanks in advance for getting back to me!

yes this is still broken

Thanks for the reply. I've worked my way around the problem (basically, using react-docgen as a dependency in itself, and not as a gatsby plugin), so there is no direct need for its solution anymore.

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

still an issue

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

still broken

Hiya!

This issue has gone quiet. Spooky quiet. 馃懟

We get a lot of issues, so we currently close issues after 30 days of inactivity. It鈥檚 been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 馃挭馃挏

Hey again!

It鈥檚 been 30 days since anything happened on this issue, so our friendly neighborhood robot (that鈥檚 me!) is going to close it.
Please keep in mind that I鈥檓 only a robot, so if I鈥檝e closed this issue in error, I鈥檓 HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community! 馃挭馃挏

Converting this plugin using schema-customization should fix these issues as no inference will be done.

The plugin already explicitly types the fields.the warnings are happening because gatsby still tried to infer explicit JSON fields. Using dontInfer creates unfixable issues with auto added child fields (either warnings that can't be silenced, or broken code bc the fields are necessary for inactions with other plugins)

The repo created to reproduce this issue no longer exists. Does anybody have a copy/fork I can clone?

I recreated the issue the best I can. See gatsby-transformer-react-docgen-fix

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Oppenheimer1 picture Oppenheimer1  路  3Comments

dustinhorton picture dustinhorton  路  3Comments

theduke picture theduke  路  3Comments

rossPatton picture rossPatton  路  3Comments

signalwerk picture signalwerk  路  3Comments