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

Add example for building schema from IDL #142

Merged
merged 1 commit into from
Jul 11, 2017
Merged

Add example for building schema from IDL #142

merged 1 commit into from
Jul 11, 2017

Conversation

symm
Copy link
Contributor

@symm symm commented Jul 10, 2017

I couldn't find it documented so wrote an example of how to use BuildSchema with IDL shorthand and then wire it up to some resolvers.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 93.874% when pulling 81376e7 on symm:shorthand-docs into bc6a7a3 on webonyx:master.

@vladar vladar merged commit 5e6acb6 into webonyx:master Jul 11, 2017
@vladar
Copy link
Member

vladar commented Jul 11, 2017

Thanks a lot!

@jasonbahl
Copy link

@symm This is pretty sweet. . .but doesn't this cause all the resolve functions in the rootValue to be executed every time GraphQL is executed whether the field is queried for or not? Or is the GraphQL internals smart enough to only execute the resolvers for that rootValue the same it does for the rest of the resolvers?

@symm
Copy link
Contributor Author

symm commented Aug 10, 2017

@jasonbahl The anonymous functions will only be executed if the GraphQL lib needs to resolve them. You can verify by putting a sleep call on the Addition resolver and calling the echo method 👍

That said, it's just a demo and I'd fetch the resolvers from a DI container in a real app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants