-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Labels
🗑 Rejected (RFC X)RFC Stage X (See CONTRIBUTING.md)RFC Stage X (See CONTRIBUTING.md)
Description
Assume a simple schema like this:
interface Character {name:String!}
type Human implements Character {name:String!}
type Droid implements Character {name:String!}
type Query {
characters: [Character!]
}
This query is not valid because it does not select down to leaf (scalar) fields (see https://graphql.github.io/graphql-spec/draft/#sec-Leaf-Field-Selections):
{characters {
}}
Then why is this query valid? It selects a scalar field, but only for Human. It'd return Droids without any fields i.e. {}
.
{characters {
... on Human {name}
}}
I asked the question on:
- StackOverflow #graphql: https://stackoverflow.com/questions/57623570/is-this-graphql-query-valid
- ReactiFlux #graphql: https://discordapp.com/channels/102860784329052160/103315563073269760
- Slack: https://graphql.slack.com/archives/C044QJ51J/p1566553730281700
andrewingram replied: it's valid, which can seem counter-intuitive. it's valid in graphql-js, which is aligned with the spec.
I think the query exposes an omission in the spec?
Metadata
Metadata
Assignees
Labels
🗑 Rejected (RFC X)RFC Stage X (See CONTRIBUTING.md)RFC Stage X (See CONTRIBUTING.md)