-
Notifications
You must be signed in to change notification settings - Fork 10
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
Next Steps #34
Comments
This plan sounds wonderful to me. Some thoughts:
|
Thanks for the input!
I tried to find some but I had no luck. That said, I'm more than happy to check out a project if someone finds something.
I'll be honest, I'm not sure what this means in the context of Mirage. Do you mean generating resolvers, e.g., generating resolvers for mutations? I'm intrigued. |
Yeah, exactly. Generating a bunch of javascript that implements all the resolvers (for mutations and queries). I don’t really know what the advantage of this is but it does seem to be a popular approach (at least in Go projects). |
Ah, ok. I think it doesn't apply to queries, at least so far, since this addon basically assumes it knows how to fetch anything from Mirage but mutations are another story. This idea might actually be really nice for mutations. Chad and I were pairing on this addon during the early stages and we actually implemented default mutations. Then we thought about it more and decided mutations were too broad to implement a default. We assumed everyone would basically override our default behavior for most of the mutations. But... if we could generate a default mutation on demand, this could be really, really nice. For example, at kloeckner.i we have tons of mutations that are basically doing things like: "Create or update a record of type These mutations are super simple and this pattern could be common enough that a generator for this case might be a big time saver. |
I've been looking into this a bit more and have an update... It seems like I may not need to create 2 separate libraries. I'll experiment more with this approach and see how far I can get. So far, it's looking promising. Related: In my experimentation I'm dropping usage of mocks for resolvers. I'm also allowing for resolvers to be passed into the options hash. I think this will make the ability to map args and variables to functions redundant. This approach would also change how mutations are expected in the options. Instead of mutations having their own key in the options, they would be added to the resolvers. I'm thinking backward compatibility should be fine and the old options should be dropped in |
I have the idea to separate this addon into multiple libraries by its logical parts. Those being:
My tentative plan is to create a GraphQL auto-resolver library that expects a resolution strategy to be supplied to it and separately a Mirage auto-resolution strategy. The Ember addon would then become a thin wrapper around these two libraries or it would be deprecated.
I see several advantages here:
I've already started experimenting with these ideas. As I spend more time working on the separate libraries the implementation details will become more clear. So far, these are my thoughts:
GraphQLObjectType
,GraphQLInterfaceType
,GraphQLList
, etc.The text was updated successfully, but these errors were encountered: