AndreasFaust / gatsby-source-custom-api

Source data from any API and transform it to (File-)Nodes.
52 stars 25 forks source link

add explicit resolver to fix deprecation warnings for local files in Gatsby v2 #22

Closed jdahdah closed 3 years ago

jdahdah commented 3 years ago

This prepares the plugin for use with Gatsby v3 by fixing the deprecation warning in Gatsby v2 that is caused by 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")
  }

As far as I can tell, this is not something that can be fixed by the user in gatsby-config.js, since it's handled internally by the plugin.

dmotan commented 3 years ago

That's very good, this has been driving me crazy. Thanks for the fix.