apollographql / federation-next

Moved to the Router repository
https://github.com/apollographql/router/tree/dev/apollo-federation
Other
19 stars 1 forks source link

Add terse display impls for OpPath, FetchDependencyGraph #296

Closed goto-bus-stop closed 4 months ago

goto-bus-stop commented 4 months ago

Ports FetchDependencyGraph::toString() from JS. One difference: JS only displays the subgraph name, here I used the terse display for fetch dependency nodes, as subgraph name alone was not enough for the println debugging I was doing.

For OpPath, I don't think the JS side had an exact equivalent, it would just stringify the array directly which is equivalent to calling .toString() on all its elements and separating by commas.

For this test query:

---- query_plan::query_planner::tests::it_does_not_crash stdout ----
{
  userById(id: 1) {
    name
    email
  }
}

The two op paths in this operation are displayed as:

userById(id: 1), name
userById(id: 1), email

The fetch dependency graph is displayed as:

[0] accounts[{}] <-

(The {} is a bug because we are missing the implementation for addAtPath: once implemented, the output would be [0] accounts[{ userById(id: 1) { name email } }].)