-
-
Notifications
You must be signed in to change notification settings - Fork 815
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
overhaul resolver validation #53
Comments
It would be great if resolvers and mocks can be mixed. I've written a pretty large schema, and tested it with mocks. It would be great if I could now start to add resolvers and any broken fields keep returning mocked values. (With warnings / errors in the console or graphQL output.) |
Can you elaborate a bit? What do you mean by broken fields returning mocked values? Are those fields with a resolver that returns undefined, or fields without a resolver at all? I think the latter would be useful, but the former sounds like a recipe for trouble. |
The latter. I actually just saw this commit e83226a and I'm wondering if I just need to update my graphql-tools. |
That PR was actually just fixing another issue, which is to apply the resolvers before the mocks, to make sure the mocking of union types works (union types need the __resolveType function, which is not a resolver, but still has to be provided in the resolvers argument to apolloServer) |
I think the easiest way to get this to work is for apolloServer to pass I'd be open to a PR in that direction, if you'd like to see that feature implemented. |
This works great for me, thanks. Would you like this to be a config option? Naming suggestions? |
I think mixing mocks and resolvers kind of implies that this is what I want to do, so I'm inclined to just leave this turned on by default. |
I think rather than making it an option (and adding more arguments to the server), I would just turn it on by default like you suggested. I just moved all the apolloServer code to apollo-server, so can you make your PR against the apollo-server repo? It would be a one-line change here, I think. Make sure to also add a test: https://github.com/apollostack/apollo-server/blob/2a4a41982d66d4a8502f2cff6a07018a9df8f1c4/src/apolloServer.js#L87 |
Closing this because we moved the server and the issue no longer exists here. |
The text was updated successfully, but these errors were encountered: