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

Pull GraphQL schema inference out into a separate module #1116

Closed
asolove opened this issue Jun 7, 2017 · 2 comments
Closed

Pull GraphQL schema inference out into a separate module #1116

asolove opened this issue Jun 7, 2017 · 2 comments
Labels
type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@asolove
Copy link

asolove commented Jun 7, 2017

As discussed on Twitter, I'd like to help take the Gatsby GraphQL schema inference code and make it into a more generally usable module that Gatsby and other tools could consume.

That said, I know nothing about Gatsby, so it's gonna take me a bit to figure out where things are and how the GraphQL bits currently interact with it. Would appreciate pointers there.

@KyleAMathews
Copy link
Contributor

Hey! This is going to be awesome! It'll be great for Gatsby to make things more modular + it'll be cool to see other people make use of the code for whatever it is they make use of it for.

The code is already fairly well abstracted in the schema directory https://github.com/gatsbyjs/gatsby/tree/1.0/packages/gatsby/src/schema

The main decoupling work I think is right now it knows how to reach into Gatsby's internals to pull out "nodes". Those would have to be passed in.

One possible interface.

const makeServer = require(`json-graphql-server`)

const schema = makeServer(nodes)

Any data passed in would need to conform to the Gatsby node format (or abstract this away somehow) https://www.gatsbyjs.org/docs/node-interface/

Thinking about this more, it wouldn't be the best for Gatsby to pull this out completely — that'd mean copying over all nodes into GraphQL which would eat up a lot more memory plus slow things down with all the copying... hmmm... yeah, instead of taking a nodes array, it'd need to take a getNodes function I think.

Some interesting files to look at:

I'd suggest also following the getting started guide for v1 @ https://www.gatsbyjs.org/docs/ and installing the gatsby-starter-blog and playing around in graphiql (it's included with the Gatsby dev server).

@jbolda jbolda added GraphQL help wanted Issue with a clear description that the community can help with. type: question or discussion Issue discussing or asking a question about Gatsby labels Jun 8, 2017
Zalastax added a commit to Zalastax/gatsby that referenced this issue Nov 2, 2017
See gatsbyjs#1116 for the reason behind this change.
@KyleAMathews KyleAMathews removed the help wanted Issue with a clear description that the community can help with. label Nov 3, 2017
@KyleAMathews
Copy link
Contributor

Due to the high volume of issues, we're closing out older ones without recent activity. Please open a new issue if you need help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

No branches or pull requests

4 participants