RFC 1 / Proposal

Service capabilities

Opened on
Updated on

At a glance

Project
GraphQL Spec
Identifier
#1208
Stage
RFC 1 / Proposal
Champion
@benjie
Updated
2026-06-23
Latest activity
5 commits pushed on
Source
Related RFCs

Pull request description

(Extracted and reworked from the error behaviors PR (#1163) to stand alone, since it has broader utility and can progress faster alone.)

This PR introduces "service capabilities" - a mechanism for GraphQL services to advertise features and configuration that exist outside the type system - for example support for syntax features (executable descriptions, fragment arguments, document directives, etc), details of transport support (websocket endpoint, SSE endpoint, how to be notified of new schema versions), and other details that can enable automated client configuration.

Motivation

In addition to being a prerequisite of the error behaviors proposal, this is a desired feature for composite schemas and a key component of The GraphQL Golden Path Initiative (specifically enabling client auto-configuration).

The goal is that a user can point tooling at a GraphQL endpoint and much of the configuration can be implied based on the service's advertised capabilities - this massively reduces the amount of "out of band" communication required.

Example use cases:

  • Does the service support fragment arguments, or must the client transpile them?
  • Does it support customizing error propagation behavior?
  • Are subscriptions available over WebSockets? If so, what endpoint and protocol?
  • Does it support incremental delivery (@defer/@stream)? Which version?
  • Does it support automated document persistence? Which protocol?

Why "capabilities" not "metadata"?

Capabilities inform automated tooling/client decisions and actions. Metadata is ancillary and often intended for human consumption. The name "capabilities" is intentional - it signals the purpose and discourages using this system as a dumping ground for arbitrary metadata. Every capability should be actionable by clients or tooling.

Design

Introspection via __service: __Service meta-field (similar to __schema: __Schema):

type __Service {
  capabilities: [__Capability!]!
}

type __Capability {
  identifier: String!
  description: String
  value: String
}

Support can be probed via: { __type(name: "__Service") { name } } - if no result, then the service does not support service capabilities.

SDL syntax

Slightly changed from previous proposals, here's the syntax I now propose:

service {
  "Descriptions on operations and fragments are supported"
  capability graphql.operationDescriptions

  "WebSocket transport is supported via the given endpoint"
  capability example.transport.ws("wss://api.example.com/graphql")
}

extend service {
  capability com.example.customFeature
}

Notes on this choice:

  • Capabilities without "values" should look neat
  • Capabilities with values followed by capabilities without descriptions should not introduce easy syntax clashes (service { capability foo.bar "Value" capability foo.baz } would apply "Value" as the description for foo.baz rather than the value for foo.bar)
  • The extend syntax feels very natural
  • Avoids double-nesting of curly braces
  • Leaves space for additional service properties in future
  • Inserting other keywords between capabilities is acceptable, in the same way that inserting different directives between repeatable directives is acceptable
  • A directive-based syntax could be used (service @capability(identifier: "...", value: "...")), but the service keyword already introduces new syntax so it doesn't seem necessary to be constrained to using ugly directives when a neater and more palatable syntax is available; this also allows for descriptions for each capability.

Capability identifiers

A QualifiedName syntax (Name(.Name)+) inspired by reverse-domain notation encourages global uniqueness. The graphql. prefix is reserved for official GraphQL Foundation specifications (not just the main spec; e.g. graphql.http.* could be used by the GraphQL-over-HTTP spec).

Timeline

April 2026

  • 5 commits pushed on
  • Advanced to RFC 1 on by leebyron
  • Discussed in GraphQL WG

    The GraphQL Technical Specification Committee (TSC) meeting focused on reviewing several specification updates and proposals. The team discussed and approved a change to leaf field definitions in the specification, with Martin leading the discussion on formatting improvements. Benoit presented updates on directives on directives, which is currently at RFC1 stage, and the group agreed on the syntax approach despite some concerns about readability. Pascal provided an update on the OpenTelemetry working group, presenting a new specification for GraphQL semantic conventions that has been submitted for review. The team then extensively discussed the GraphQL over HTTP specification, with Benjie explaining the new 294 status code for partial success and the decision to move application/json media type details to an appendix before the first release. The conversation ended with Benjie presenting service capabilities as a new RFC1 item, discussing potential implementation approaches and future considerations for handling deprecation in the schema.

    Zoom summary · GraphQL WG · 2026-04-02
    Next Steps

    Benjie: Create GraphQLJS implementation of Service Capabilities (separate from on-error handling)

    Zoom summary · GraphQL WG · 2026-04-02

    The team discussed two main topics: GraphQL over HTTP specification and service capabilities. For GraphQL over HTTP, they agreed to make one final pass through the TSC for approval before moving to RFC3, with Martin suggesting a weekly meeting cadence in April to focus on completion. Benjie presented service capabilities as a new RFC1 item, which the team approved. The discussion included considerations about handling deprecation in the schema and potential future service capabilities, with Lee suggesting adding deprecation handling to the __schema field rather than __service.

    Zoom summary · GraphQL WG · 2026-04-02

February 2026

January 2026