Branch/Environment/Version
- Branch/Version: 4.3.3
- Environment: On-prem
Describe the bug
I tried using multiple and compound key entity, but the tyk gateway does not resolve by that key properly
Reproduction steps
Steps to reproduce the behaviour:
- Add subgraph cart api
type CartItem @key(fields: "id") {
id: ID!
qty: String!
notes: String!
product: Product!
}
extend type Product @key(fields: "id variants { id } productAddOns { productAddOnVariants { id } }") {
id:ID! @external
variants: [ProductVariant!]! @external
productAddOns: [ProductAddOn!] @external
}
extend type ProductVariant {
id: ID! @external
}
extend type ProductAddOn {
id: ID! @external
productAddOnVariants: [ProductAddOnVariant!]! @external
}
extend type ProductAddOnVariant {
id: ID! @external
}
- add the subgraph Product
type Product @key(fields: "id variants { id } productAddOns { productAddOnVariants { id } }") {
id: ID!
name: String!
category: String!
variants: [ProductVariant!]!
productAddOns: [ProductAddOn!]
}
type ProductVariant {
id: ID!
name: String!
}
type ProductAddOn {
id: ID!
name: String!
productAddOnVariants: [ProductAddOnVariant!]!
}
type ProductAddOnVariant {
id: ID!
name: String!
}
Actual behaviour
The tyk resolve only by product id entity fields and not the complete key
/data/cartList/items/0/product (beforeFetchHook): {“method”:“POST”,“url”:“http://subgraph-product”,“header”:{“X-Tyk-Internal”:[“true”]},“body”:{“query”:“query($representations: [_Any!]!){_entities(representations: $representations){… on Product {name}}}”,“variables”:{“representations”:[{“id”:“productid1”,“__typename”:“Product”},{“id”:“productid2”,“__typename”:“Product”}]}}}
Expected behaviour
it behave like this query
query resolveEntity {
_entities(
representations: [{__typename: "Product", id: "productid1", variants: {id: "variantid1"}, productAddOns: {productAddOnVariants:{id:"addonvariantid1"}}}]
) {
... on Product {
id
name
category
variants {
id
name
}
productAddOns {
id
name
productAddOnVariants {
id
name
}
}
}
}
}