Skip to content

Commit

Permalink
RFC: SchemaExtension
Browse files Browse the repository at this point in the history
This adds new grammar to the GraphQL SDL:

```graphql
extend schema {
  mutation: MutationType
}
```

This feels like the missing piece of the type system extension framework. In addition to extending types in a type system, the top level schema should be extendable as well.
  • Loading branch information
leebyron committed Apr 18, 2018
1 parent 1d56b88 commit a86d3d0
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 6 deletions.
10 changes: 9 additions & 1 deletion spec/Appendix B -- Grammar Summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,11 +187,19 @@ Directive[Const] : @ Name Arguments[?Const]?
TypeSystemDefinition :
- SchemaDefinition
- TypeDefinition
- TypeExtension
- DirectiveDefinition
- TypeSystemExtension

TypeSystemExtension :
- SchemaExtension
- TypeExtension

SchemaDefinition : schema Directives[Const]? { OperationTypeDefinition+ }

SchemaExtension :
- extend schema Directives[Const]? { OperationTypeDefinition+ }
- extend schema Directives[Const]

OperationTypeDefinition : OperationType : NamedType

Description : StringValue
Expand Down
31 changes: 26 additions & 5 deletions spec/Section 3 -- Type System.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ are valid.
TypeSystemDefinition :
- SchemaDefinition
- TypeDefinition
- TypeExtension
- DirectiveDefinition
- TypeSystemExtension

The GraphQL language includes an
[IDL](https://en.wikipedia.org/wiki/Interface_description_language) used to
Expand All @@ -27,6 +27,18 @@ Note: The type system definition language is used throughout the remainder of
this specification document when illustrating example type systems.


## Type System Extensions

TypeSystemExtension :
- SchemaExtension
- TypeExtension

Type system extensions are used to represent a GraphQL type system which has been
extended from some original type system. For example, this might be used by a
local service to represent data a GraphQL client only accesses locally, or by a
GraphQL service which is itself an extension of another GraphQL service.


## Schema

SchemaDefinition : schema Directives[Const]? { RootOperationTypeDefinition+ }
Expand Down Expand Up @@ -139,6 +151,16 @@ type Query {
}
```

### Schema Extension

SchemaExtension :
- extend schema Directives[Const]? { OperationTypeDefinition+ }
- extend schema Directives[Const]

Schema extensions are used to represent a schema which has been extended from
an original schema. For example, this might be used by a GraphQL service which
adds additional operation types, or additional directives to an existing schema.


## Descriptions

Expand Down Expand Up @@ -261,10 +283,9 @@ TypeExtension :
- EnumTypeExtension
- InputObjectTypeExtension

Type extensions are used to represent a GraphQL type system which has been
extended from some original type system. For example, this might be used by a
local service to represent data a GraphQL client only accesses locally, or by a
GraphQL service which is itself an extension of another GraphQL service.
Type extensions are used to represent a GraphQL type which has been extended
from some original type. For example, this might be used by a local service to
represent additional fields a GraphQL client only accesses locally.


## Scalars
Expand Down

0 comments on commit a86d3d0

Please sign in to comment.