HotChocolate:To apply Sort/filter using extended attribute from stitched schema

spurthinaveli

Spurthinaveli

Posted on August 29, 2022

HotChocolate:To apply Sort/filter using extended attribute from stitched schema

[GraphQl]: Here is the problem statement
We have performed schema stitching using the federated approach in hot chocolate.
Say we have three downstream services(i.e separate APIs) Customer, Order, and Product. A scenario that we are trying to handle is that the Order must be sorted/filtered using the field which is extended from the Product(Say product serial number). Basically, I need to apply sort/filter on the parent node based on child attributes where the child node is extended from stitched schema.
Structure of Query 1:

Order(order: {ProductSerialNumber: DESC}){
  OrderNumber
  Products{. // Products is extended from product services using schema stitching
    ProductName
    ProductPrice
    ProductSerialNumber
  }
}
Enter fullscreen mode Exit fullscreen mode

Structure of Query 2:

Order(order: {ProductSerialNumber: DESC}){
  OrderNumber
  ProductSerialNumber// This is extended from product service using schema stitching
}
Enter fullscreen mode Exit fullscreen mode

How to handle anyone/both of the above-mentioned queries?

💖 💪 🙅 🚩
spurthinaveli
Spurthinaveli

Posted on August 29, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related