Open flowen opened 3 years ago
If I understand this correctly, fixing this would be a prerequisite to making this plugin compatible with Gatsby v3?
The issue is caused by references to other objects not being explicitly defined as links. Example:
schemas: {
jobs: `[job]`,
job: `
title: String!
absolute_url: String!
`,
}
This follows the instructions in the README, but that method is no longer valid and will result in the following error:
warn Deprecation warning: adding inferred extension `link` for field `jobs.job`.
In Gatsby v3, only fields with an explicit directive/extension will be resolved correctly.
Add the following type definition to fix this:
type jobs implements Node {
jobs: job @link(by: "id", from: "job___NODE")
}
The issue is that so far Gatsby has inferred the @link
type itself, but Gatsby v3 will no longer support this. Right now, it's possible to get rid of most warnings by changing the schema as follows:
schemas: {
jobs: `[job] @link(by: "id", from: "job___NODE")`
job: `
title: String!
absolute_url: String!
`,
}
It's a bit messy and would be better handled by the plugin, but I haven't been able to figure out how. Simply adding @infer
to getTypeDefs.js as suggested above doesn't work. While that does remove the warnings, it also returns an empty object in the GraphQL schema.
There is a separate error for local files:
warn Deprecation warning: adding inferred extension `link` for field `original.local`.
In Gatsby v3, only fields with an explicit directive/extension will be resolved correctly.
Add the following type definition to fix this:
type original implements Node {
local: File @link(by: "id", from: "local___NODE")
}
Because local files are handled internally by the plugin, there is no way to fix this in gatsby-config.js
. I have created PR #22 to address this issue. The main issue will need to be fixed by someone who understands the plugin better, however.
thanks for this great plugin first of all!
I noticed getting these warnings:
warn Deprecation warning - adding inferred resolver for field .... In Gatsby v3, only fields with an explicit directive/extension will get a resolver.
So I went into getTypeDef.js and edited line 4 to this:
type ${name} implements Node @infer{
(adding @infer) now my warnings were gone but honestly.. I'm a beginner at this and not sure if this would break anything. Would love to see an update if you are still working on this plugin and help anywhere if I can