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

fix(gatsby): improve deprecation text for missing childOf directive #28532

Merged
merged 3 commits into from
Dec 8, 2020

Conversation

vladar
Copy link
Contributor

@vladar vladar commented Dec 8, 2020

Description

This PR addresses a confusing deprecation warning when the @childOf directive is not set for some parent. Warning text before this PR:

The type `Parent` does not explicitly define the field `childChild`.
On types with the `@dontInfer` directive, or with the `infer ` extension set to `false`, automatically adding fields for
children types is deprecated. In Gatsby v3, only children fields explicitly set with the `childOf` extension will be added.`

After this PR:

Deprecation warning: In Gatsby v3 field `Parent.childChild` will not be added automatically
because type `Child` does not explicitly list type `Parent` in `childOf` extension.
Add the following type definition to fix this:

  type Child implements Node @childOf(types: ["Parent"]) {
    id
  }

https://www.gatsbyjs.com/docs/actions/#createTypes

Related issues

See #19674 (comment) as one example where it was confusing

Also related PR: #28483 (it fixes this warning in gatsby-plugin-schema-snapshot):

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Dec 8, 2020
@vladar vladar added topic: GraphQL Related to Gatsby's GraphQL layer and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Dec 8, 2020
@vladar vladar added the bot: merge on green Gatsbot will merge these PRs automatically when all tests passes label Dec 8, 2020
@gatsbybot gatsbybot merged commit f733f4e into master Dec 8, 2020
@delete-merged-branch delete-merged-branch bot deleted the vladar/fix-inference-warning2 branch December 8, 2020 13:57
pieh pushed a commit that referenced this pull request Dec 8, 2020
…28532)

* fix(gatsby): improve deprecation text for missing childOf directive

* text formatting

* Add "many" argument

(cherry picked from commit f733f4e)
pieh pushed a commit that referenced this pull request Dec 9, 2020
…28532) (#28543)

* fix(gatsby): improve deprecation text for missing childOf directive

* text formatting

* Add "many" argument

(cherry picked from commit f733f4e)

Co-authored-by: Vladimir Razuvaev <[email protected]>
@pieh
Copy link
Contributor

pieh commented Dec 10, 2020

Published in [email protected]

pragmaticpat pushed a commit to pragmaticpat/gatsby that referenced this pull request Apr 28, 2022
…atsbyjs#28532)

* fix(gatsby): improve deprecation text for missing childOf directive

* text formatting

* Add "many" argument
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes topic: GraphQL Related to Gatsby's GraphQL layer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants