Make root query operation type optional
At a glance​
- Identifier: #631
- Stage: RFC0: Strawman
- Champion: @victorandree
- PR: Make root query operation type optional
Timeline​
- Added to 2019-12-05 WG agenda
- Mentioned in 2019-12-05 WG notes
- Spec PR created on 2019-10-23 by victorandree
- Commit pushed: Make root query operation type optional on 2019-10-11 by @victorandree
This change would make the root
query
operation type optional, consistent withmutation
andsubscription
. In this proposal, schema introspection would still work as before, by allowing a "default"query
type if one is not defined, exposing only the implicit fields__schema
and__types
(in response to PR feedback).The change is worded so that a "schema must define at least one root operation type.". See below for motivation and alternatives.
See #490 for background on this issue.
Motivation​
Not all GraphQL APIs need a
query
interface but do fine with justmutation
orsubscription
. This becomes especially apparent for micro services. Such services are forced to expose dummy query fields, with real world examples such as_
,version
,helloWorld
, ordontQueryMe
.Alternative: Allow root query operation type to be empty