-
Notifications
You must be signed in to change notification settings - Fork 434
Implement support for dynamic schemas #66
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
Conversation
Looks like the Appveyor tests have problems with SSL currently:
Perhaps if you find the time you could re-run them. |
Thanks for your feedback, @theduke. A review on this from either you or @mhallin would be great! As for performance, I have just pushed an update to the PR that removes the single .clone() I added that would have been called per-request (in the validation logic). So in terms of allocations/operations on data types there should be virtually no change in performance here. Also, since the But of course if you have specific concerns about negative impacts on performance, I'd be happy to run a few benchmarks and see where that takes us. |
Overall, I like the direction and the feature it's adding. However, I want to raise some concerns:
That being said, thanks for this PR! Let us know if you want to make these changes, or if it something we could do instead. |
These concerns make a lot of sense, @mhallin, thanks for raising them! Regarding the pollution of the I'll go and add a couple of tests in the meantime... |
I've implemented your suggestions, @mhallin, would appreciate a second review! |
I didn't realize that you had added a test here, so I was waiting for that :) I think this looks good and ready for merging. |
🎉 |
We haven't configured appveyor properly yet, but this shouldn't make any difference here, so I'm merging. Thanks for the big contirbution, @srijs . |
Hi!
Apologies in advance for the somewhat large patch.
This is my first attempt at a feature contribution. The feature I'm trying to implement scratches an itch of my own, and has been in-use in a project of mine for quite some time now and I thought it might be nice to try and contribute it back up-stream. So I took the time today to rebase it and clean it up.
To frame the problem, I'm working on a database that provides a GraphQL-based API. The objects stored in the database are defined using a schema which the user can configure. The schema will be loaded from a configuration file at start-up.
Previously, it was only possible to define the GraphQL schema at compile time, due to the fact that the
name
andtype
methods in theGraphQLType
trait do not take any objects as arguments which could carry any sort of schema information, i.e. they are effectively "static" functions.This patch changes this so that a
GraphQLType
has an associated typeTypeInfo
, which can hold schema information that can be loaded at runtime and passed when constructing aRootNode
.I have not added support for custom
TypeInfo
when using the macros yet, so in order to leverageTypeInfo
the traits need to be implemented manually. In practice this has proven not to be an issue at all, and I'm not even sure if it's a good idea to make the macros more powerful in that sense.Let me know what you think!
Also, no worries at all if you feel this does not fit within your vision for the
juniper
project, it would just mean that my fork would diverge more and more, which would be sad but also acceptable for me.But of course, my preference would be to upstream this, so if you are generally interested in the feature, but have a completely different implementation in mind, I'm happy to explore it as well!