When I use the @requires directive, the parent parameter only has directive fields, it does not have its own fields
Any solution?
#Subgraph carts
type Cart @key(fields: "id") {
id: ID!
items: [CartItem]!
totalPrice: Price! @requires(fields: "items { product { price { value }}}") #Bug Here
}
type CartItem @key(fields: "id") {
id: ID!
product: Product!
qty: Int!
totalPrice: Price! @requires(fields: "product { price { value }}") #Bug here
}
type Product @key(fields: "sku", resolvable: false) {
sku: String!
price: Price! @external
}
Log:
Cart totalPrice parent {
"__typename":"Cart",
"items":[{
"product":{
"price":{
"value":20
}
}
}],
"id":"998e04b3-2fc6-44b6-b061-2d7d389cf9fb"
}
CartItem totalPrice parent {
"__typename":"CartItem",
"product":{
"price":{
"value":20
}
},
"id":"8c51cb66-a976-481d-adbe-0f0e336b01c1"
}