0

I am trying to get result when I query like below in fusion gateway, basically join of Product and Review like for each product get the review details for each product,I know Fusion is in .Net but I thinks as long as introspection work it can work with spring boot graphql service also, so I tried to use @lookup for my use case running query like this way :

 query Products {
 products {
 id
 name
 reviews {
 comment
 productId
 rating
 }
 }
 }
individual subgraph data fetching is working but unable to run above query, getting below error 
{

 "errors": [
 {
 "message": "Unexpected Execution Error"
 }
 ]
 }
-----------------------------------------------------
product subgraph schema.graphqls
 directive @lookup(by: String) on FIELD_DEFINITION
 
 type Product
 {
 id: ID!
 name: String
 }
 
 type Query
 {
 products: [Product]
 productById(id: ID!): Product @lookup(by: "id")
 }
-----------------------------
review subgraph schema.graphqls
directive @lookup(by: String) on FIELD_DEFINITION
 
 type Review
 {
 productId: ID!
 rating: Int
 comment: String
 }
 
 type Query
 {
 reviews: [Review]
 reviewsByProductId(productId: ID!): [Review!]! @lookup(by: "productId")
 }
 
 type Product {
 id: ID!
 } 
 extend type Product {
 reviews: [Review!]! @lookup(by: "productId")
 }

both the subgraphs I am running in spring boot graphql and merging these subgraphs using fusion gateway

tried @lookup in schema to make the join and byId resolver

I was expecting to get

{
 "data": {
 "products": [
 {
 "id": "1",
 "name": "Product A",
 "reviews": [
 { "comment": "Excellent", "productId": "1", "rating": 5 },
 { "comment": "Very Good", "productId": "1", "rating": 4 }
 ]
 },
 {
 "id": "2",
 "name": "Product B",
 "reviews": [
 { "comment": "Average", "productId": "2", "rating": 3 }
 ]
 }
 ]
 }
}
asked Jul 23, 2025 at 13:33

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.