Scenario :
We have two subgraphs - cart & products and given the product model as an entity in the cart subgraph below
extend type Product @key(fields: "id") { id: ID! @external }
And then from the cart
resolver.js, we are trying to send the Product ID & extra info
ProductLineItem: { product(productLineItem) { return { __typename: "Product", id: productLineItem.productId, siteInfo: { siteId: "INT", locale: "en-NL", currency: "EUR" } }; } },
But we are only getting __typename and id.
We even tried adding siteInfo property to the product entity in cart graphql like below
extend type Product @key(fields: "id") { id: ID! @external siteInfo: SiteInfo! }
but getting the GraphQL validation error,
AggregateGraphQLError [GraphQLError]: The schema is not a valid GraphQL schema.. Caused by: The type of "Product.siteInfo" must be Output Type but got "SiteInfo!", a NonNullType.
Here is our request body which is been triggered from supergraph - http://127.0.0.1:4000/.
query ExampleQuery($id: String!, $siteInfo: SiteInfo!) { getCart(id: $id, siteInfo: $siteInfo) { productLineItems { itemId product { id name categoryId } } } }
{ "id": "619d86f8acfdb406bba53e3718", "siteInfo": { "siteId": "INT", "locale": "en-NL", "currency": "EUR" } }
We are using router as a gateway.
Could you please assist in getting the SiteInfo values into the Product subgraph?