-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds field selection RFC #35
Adds field selection RFC #35
Conversation
From the meeting on May 2, @benjie has a comparable solution defined that builds on top of the schema coordinates proposal In short, this pathing operator https://github.com/graphql/graphql-wg/blob/main/rfcs/OperationExpressions.md |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've included some comments below, but I like the direction of the last solution.
To my mind the system knows if the input is a scalar or not. If it's a scalar, we expect a "single field" expression. If it's an input object, we expect a "multi field" expression (key1: expression1 key2: expression2
); and for each of these expressions we apply the same heuristics: if it's a scalar, a single field expression, if an input object then a multi field expression wrapped in {}
to avoid ambiguity.
My main concern is that the "expression" should use GraphQL syntax to explicitly select a single value. It's not terrible that this is implied via selection sets and the system knowing to traverse, but it would be better if this just "fell out" of the GraphQL syntax automatically, so I'm keen to see if exploring the flat chain syntax would get us any closer.
|
||
```graphql | ||
extend type Query { | ||
mediaById(id: ID! @is(field: "<Movie>.id | <Book>.id")): MovieOrBook @lookup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With operation expressions this would be:
mediaById(id: ID! @is(field: "<Movie>.id | <Book>.id")): MovieOrBook @lookup | |
mediaById(id: ID! @is(field: "Movie.id Book.id")): MovieOrBook @lookup |
That would effectively compile out to: ... Movie { id } ... Book { id }
.
Co-authored-by: Glen <[email protected]>
Co-authored-by: Glen <[email protected]>
Co-authored-by: Glen <[email protected]>
Co-authored-by: Glen <[email protected]>
Co-authored-by: Glen <[email protected]>
Co-authored-by: Glen <[email protected]>
Co-authored-by: Glen <[email protected]>
No description provided.