Open lrlna opened 1 year ago
Would be interesting to see how we'd select a nickname
field here as it can refer to two different definitions.
{
human {
pets {
... on Cat { nickname }
... on Dog { nickname }
}
}
}
Apollo federation internals in TypeScript has an OperationPath
API to represent this and they heavily use it as well in query planning, we could have something similar.
I'm not sure a query language is the best way to frame it as I think in practice you'll almost always work with dynamic paths, so having a structured representation in memory is more important than writing a particular path by hand. Though we could always have a OperationPath::parse("human.pets.@Cat.nickname")
for example.
There is a spec proposal for operation paths: https://github.com/graphql/graphql-wg/blob/main/rfcs/OperationExpressions.md
Would kind of be interesting to explore querying executable definition types with a smaller query language that we can use in the database.
Given a schema:
and a query like this:
it would be interesting to be able to do something like this
compiler.db.query.find("human.pets.name")
.