[gatsby-transformer-json] add graphql-type-json to allow better handling of JSON files
See original GitHub issueSummary
I’m currently trying to add my package.json
file to GraphQL. I already created a plugin which sources single files instead of directories with helpers from gatsby-source-filesystem
. But this plugin does not allow me to get all from the key dependencies
since GraphQL is explicit. After searching, I found a type plugin for graphql which adds this cap.
https://github.com/taion/graphql-type-json
It would be great if this plugin could be added to gatsby-transformer-json
or if we could extend the documentation so that someone can add it by himself.
Here is an Apollo tutorial: https://www.apollographql.com/docs/apollo-server/schema/scalars-enums/#using-a-package
I tried to add it with createResolvers
but still get some errors (I know it tells we what exactly is wrong but I don’t know what exactly it means). I’m just starting with GraphQL in deep and don’t really know how to add custom scalars. Would appreciate any help and would create a PR if I get a working version for my portfolio as soon as I get free time for it.
ERROR #11321 PLUGIN
"gatsby-node.js" threw an error while running the createResolvers lifecycle:
Cannot find ObjectTypeComposer with name JSON
Basic example
If the proposal involves a new or changed API, include a basic code example. Omit this section if it’s not applicable.
Motivation
This would enable easier transformation of JSON files and handling like when using require
syntax.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@muuvmuuv
package.json
file should be available out of the box with:graphql-compose
) already includes aJSON
scalar. Did that not work for you?Thanks @stefanprobst ❤️
@muuvmuuv Looks like this is resolved for the moment. Closing this issue for now. Thanks!