-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Service capabilities / error behaviors #1163
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
base: main
Are you sure you want to change the base?
Changes from all commits
31c90e7
f4fab96
692d811
94446ab
3c63355
7056690
0fa7a33
1f975e4
8c40086
641a786
026982b
a7c6ad5
fe559ea
b5f64ae
1c3f0cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,13 +85,14 @@ operation. | |
|
||
## Schema Introspection | ||
|
||
The schema introspection system is accessible from the meta-fields `__schema` | ||
and `__type` which are accessible from the type of the root of a query | ||
operation. | ||
The schema introspection system is accessible from the meta-fields `__schema`, | ||
`__type` and `__service` which are accessible from the type of the root of a | ||
query operation. | ||
|
||
```graphql | ||
__schema: __Schema! | ||
__type(name: String!): __Type | ||
__service: __Service! | ||
``` | ||
|
||
Like all meta-fields, these are implicit and do not appear in the fields list in | ||
|
@@ -218,6 +219,15 @@ enum __DirectiveLocation { | |
INPUT_OBJECT | ||
INPUT_FIELD_DEFINITION | ||
} | ||
|
||
type __Service { | ||
capabilities: [__Capability!]! | ||
} | ||
|
||
type __Capability { | ||
identifier: String! | ||
value: String | ||
} | ||
``` | ||
|
||
### The \_\_Schema Type | ||
|
@@ -500,3 +510,74 @@ Fields\: | |
{true}, deprecated arguments are also returned. | ||
- `isRepeatable` must return a Boolean that indicates if the directive may be | ||
used repeatedly at a single location. | ||
|
||
### The \_\_Service Type | ||
|
||
The `__Service` type is returned from the `__service` meta-field and provides | ||
information about the GraphQL service, most notably about its capabilities. This | ||
type was added after the original release of GraphQL, so older schemas may not | ||
support it. | ||
|
||
Fields\: | ||
|
||
- `capabilities` must return a list of `__Capability` indicating the | ||
capabilities supported by the service. | ||
|
||
### The \_\_Capability Type | ||
|
||
:: A _capability_ describes a feature supported by the GraphQL service but not | ||
directly expressible in the type system. This may include experimental GraphQL | ||
features (such as new syntax or behavior), protocol support (such as GraphQL | ||
over WebSockets), or additional operational metadata (such as release | ||
identifiers). Capabilities may be supplied by the GraphQL implementation, the | ||
service, or both. | ||
|
||
The `__Service.capabilities` field exposes a _capability_ list. A _capability_ | ||
consists of a capability identifier and optionally a string value. | ||
|
||
**Capability identifier** | ||
|
||
A capability identifier is a string value composed of two or more segments | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarify that this is a suggestion There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Governed by the "preserve option value" guiding principle:
I think we should keep this as a requirement rather than a suggestion/recommendation. It's quite simple to comply with, and we can always loosen it up in future if need be. E.g. maybe we might want to add an SDL syntax for this in future, it would be a shame to have to wrap all the keys in strings:
That said, I'm not too bothered and happy to remove it if there's a good reason. |
||
separated by a period (`.`). Each segment must begin with an ASCII letter, and | ||
must contain only ASCII letters, digits and hyphens. These constraints are | ||
inspired by reverse domain name notation to encourage global uniqueness and | ||
collision-resistance. Unlike the domain name system, capability identifiers are | ||
Comment on lines
+542
to
+544
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like this! |
||
case sensitive. Identifiers beginning with the prefix {"org.graphql."} are | ||
reserved and must not be used outside of official GraphQL Foundation | ||
specifications. Identifiers beginning with the prefix {"org.graphql.rfc."} are | ||
reserved for RFC proposals. | ||
|
||
Identifiers defined by specific projects, vendors, or implementations should | ||
begin with a prefix derived from a DNS name they control (e.g., | ||
{"com.example."}). | ||
|
||
Clients should compare identifiers using exact string equality and should ignore | ||
unknown identifiers. | ||
|
||
Implementers should not change the meaning of capability identifiers; instead, a | ||
new capability identifier should be used when the meaning changes. Implementers | ||
should ensure that capability identifiers remain stable and version-agnostic | ||
where possible; capability versioning, if needed, can be indicated using dot | ||
suffixes (e.g.{ "org.example.capability.v2"}). | ||
|
||
This system enables incremental feature adoption and richer tooling | ||
interoperability, while avoiding tight coupling to specific implementations. | ||
|
||
**Capability value** | ||
|
||
The value assigned to a given capability may either be {null} to simply indicate | ||
the capability is supported, or a string to provide additional information. For | ||
example {"org.graphql.onError"} does not require additional information and thus | ||
uses the value {null}, whereas {"org.graphql.defaultErrorBehavior"} needs the | ||
{value} to indicate which _error behavior_ is the default. | ||
|
||
**Specified capabilities** | ||
|
||
This version of the specification defines the following capabilities: | ||
|
||
- {"org.graphql.defaultErrorBehavior"} - indicates the _default error behavior_ | ||
of the service via the {value}. If not present, must be assumed to be | ||
{"PROPAGATE"}. | ||
- {"org.graphql.onError"} - indicates that the service allows the client to | ||
specify {onError} in a request to indicate the _error behavior_ the service | ||
should use for the request. {value} is {null}. | ||
martinbonnin marked this conversation as resolved.
Show resolved
Hide resolved
|
Uh oh!
There was an error while loading. Please reload this page.