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

field level resolvers #230

Closed
RajuTirumalaraju opened this issue May 31, 2019 · 2 comments
Closed

field level resolvers #230

RajuTirumalaraju opened this issue May 31, 2019 · 2 comments

Comments

@RajuTirumalaraju
Copy link

RajuTirumalaraju commented May 31, 2019

Library version: 0.0.33

This is more of "how to" type of question. Our current code working fine as mostly query is resolved by a single data source. But now we have a requirement that, clients can add a new field sometimes in same query where response for that field should be coming from another data source(another REST API). Kotlin reflection doing magic to match a query(root) name with concern data fetcher( kotlin suspend function) without explicitly using any of library data fetcher classes. but not sure how to call a second resolver suspend function when a field exists in a query. Can i get some samples please?. Our full code block is in this Stack Overflow link. Thanks.

@rickfast
Copy link
Contributor

Example using Spring:
https://github.com/ExpediaDotCom/graphql-kotlin/blob/master/example/src/main/kotlin/com/expedia/graphql/sample/query/SubQueries.kt

Since graphql-kotlin reflectively generates resolvers, you'll have to do something like the above example, or use KGraphQL or graphql-java directly

@smyrick
Copy link
Contributor

smyrick commented May 31, 2019

Another example to get the data from further up the query chain is to use the DataFetcherEnvironment. It was added here: #173

I am going to close this issue. We can continue the discussion here and re-open if you still have concerns.

@smyrick smyrick closed this as completed May 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants