You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An user is building a subgraph with the Ruby library that supports federation. As part of this library, they don't just support a resolve_reference function to resolve a single entity reference but they also have support to resolve multiple with resolve_references (plural): Gusto/apollo-federation-ruby#206
With this new feature, the subgraph now gets the entire entity array and is asked to resolve the specific fields.
Normally you would only be called once for each entity and the array order could never change but with this method you could now change the order of the elements. You can still keep the ids the same but you can now return a response to the gateway with the fields filled out but the order changed from what the gateway sent
In theory the Gateway should be able to do a id match but instead it assume the order is the same so the data returned to clients shows the Product:1 in stock is true and Product:3 in stock is false which is not correct
The text was updated successfully, but these errors were encountered:
smyrick
changed the title
Gateway will merge data for incorrect ids if subgraph changes reference resolve order
Gateway will merge data for incorrect ids if subgraph changes entity order
Feb 23, 2024
smyrick
changed the title
Gateway will merge data for incorrect ids if subgraph changes entity order
Gateway will merge incorrect data if subgraph changes entity order
Feb 23, 2024
After discussing with the Apollo team, this is actually expected behaviour for Federation, and there fore we are going to close a won't fix.
I will however open up an issue on the Ruby library to maybe see if there is something they can implement on their end since this is a non-standard way of exposing the entities array
Issue Description
An user is building a subgraph with the Ruby library that supports federation. As part of this library, they don't just support a
resolve_reference
function to resolve a single entity reference but they also have support to resolve multiple withresolve_references
(plural): Gusto/apollo-federation-ruby#206With this new feature, the subgraph now gets the entire entity array and is asked to resolve the specific fields.
Normally you would only be called once for each entity and the array order could never change but with this method you could now change the order of the elements. You can still keep the ids the same but you can now return a response to the gateway with the fields filled out but the order changed from what the gateway sent
In theory the Gateway should be able to do a id match but instead it assume the order is the same so the data returned to clients shows the
Product:1
in stock istrue
andProduct:3
in stock isfalse
which is not correctLink to Reproduction
https://github.com/Gusto/apollo-federation-ruby/compare/main...smyrick:apollo-federation-ruby:shane-gateway-bug?expand=1
Reproduction Steps
yarn start-services
yarn start-gateway
See how the data is mismatched
The data is defined like so
but the client sees this
The text was updated successfully, but these errors were encountered: