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

import types of schema A into schema B #1

Closed
bsr203 opened this issue Oct 22, 2016 · 7 comments
Closed

import types of schema A into schema B #1

bsr203 opened this issue Oct 22, 2016 · 7 comments

Comments

@bsr203
Copy link

bsr203 commented Oct 22, 2016

Thank you for more idiomatic graphql option for go.

I am currently using https://github.com/graphql-go/graphql, though it is incredibly verbose, I could structure the schema so it is kept at module level.

I see one thread in graphql-js regarding the same, in which lee says
graphql/graphql-js#223

If you're using the schema language to build a schema than you need to first combine it into a single string before calling buildSchema. That typically is a nice developer experience for small to medium sized schema, though for more complex schema we recommend building the schema programmatically. Even in this case you still need to collect all the types to assemble the schema. A similar operation to collecting all the strings before calling buildSchema

I wonder what is the best approach you propose with this library. Any plan for incrementally building the schema by registering the graphql schema and resolve functions for isolated modules ?

thanks again for providing this library.

@neelance
Copy link
Collaborator

Hi @bsr203, thanks for looking into my project.

My current plan is to not expose the schema data structures. The only way to create a schema is via the schema language. However, at some point I want to add a way to load multiple schema strings and have one schema import types from another schema. Then each schema still has its own namespace, but you can use them together as one big schema.

Does that sound good to you? Do you need such a feature soon?

@bsr203
Copy link
Author

bsr203 commented Oct 22, 2016

Thank you for the quick response. What you described would be ideal, and I am in no rush :-) I just wanted to make sure it is considered so we may add it in the future without much of breaking the existing implementation. Do you want to keep this open till it is implemented?

Thank you for all your effort on this.

@neelance neelance changed the title schema management import types of schema A into schema B Oct 22, 2016
@neelance
Copy link
Collaborator

Yes, we can keep it open. I've changed the title accordingly.

@bsr203
Copy link
Author

bsr203 commented Dec 7, 2016

Just adding reference to an approach I saw.
apollostack/graphql-tools allows easy mocking of resolvers, and uses graphql language and resolver very similar to this library. see the example on readme. There is a section about modularization.

I currently modularize the schema by exporting the schema of the module and concatenate before pass to ParseSchema. Resolvers work naturally. AFAIK, the order of type def in schema doesn't matter, hence not much trouble splitting and referencing the schema. I am happy with this approach and you are free to close this.

@neelance
Copy link
Collaborator

neelance commented Dec 7, 2016

Happy to hear that! String concatenation sounds like a very clear and simple way of implementing modularization. Do you see any potential limitations?

@bsr203
Copy link
Author

bsr203 commented Dec 7, 2016

not really, it works great for me as the order of types within schema doesn't matter. Also, namespacing is not supported by graphql. There been need for this, but for the moment, we are good :-)

@neelance
Copy link
Collaborator

neelance commented Dec 7, 2016

Cool, I'll close this issue. Maybe I'll even replace SchemaBuilder with some simpler API at some point.

@neelance neelance closed this as completed Dec 7, 2016
dvic pushed a commit to dvic/graphql-go that referenced this issue Feb 5, 2018
Fixed failed tests and restored `language/parser` and `testutil` packages
bitshiftza pushed a commit to bitshiftza/graphql-go that referenced this issue Nov 3, 2020
Limit the number of concurrent list nodes processed
aarondl0 referenced this issue in ProlificLabs/graphql-go Jan 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants