Skip to content
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

RFC: SchemaExtension #428

Merged
merged 2 commits into from
Apr 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion spec/Appendix B -- Grammar Summary.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ Document : Definition+
Definition :
- ExecutableDefinition
- TypeSystemDefinition
- TypeSystemExtension

ExecutableDefinition :
- OperationDefinition
Expand Down Expand Up @@ -187,11 +188,18 @@ Directive[Const] : @ Name Arguments[?Const]?
TypeSystemDefinition :
- SchemaDefinition
- TypeDefinition
- TypeExtension
- DirectiveDefinition

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
11 changes: 6 additions & 5 deletions spec/Section 2 -- Language.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ Document : Definition+
Definition :
- ExecutableDefinition
- TypeSystemDefinition
- TypeSystemExtension

ExecutableDefinition :
- OperationDefinition
Expand All @@ -181,9 +182,9 @@ by a GraphQL service or client. A document contains multiple definitions, either
executable or representative of a GraphQL type system.

Documents are only executable by a GraphQL service if they contain an
{OperationDefinition}, only contain {ExecutableDefinition} and do not contain
{TypeSystemDefinition}. However documents which do not contain
{OperationDefinition} or do contain {TypeSystemDefinition} may still be parsed
{OperationDefinition} and otherwise only contain {ExecutableDefinition}.
However documents which do not contain {OperationDefinition} or do contain
{TypeSystemDefinition} or {TypeSystemExtension} may still be parsed
and validated to allow client tools to represent many GraphQL uses which may
appear across many individual files.

Expand All @@ -195,8 +196,8 @@ multiple operations to a GraphQL service, the name of the desired operation to
be executed must also be provided.

GraphQL services which only seek to provide GraphQL query execution may choose
to only include {ExecutableDefinition} and omit the {TypeSystemDefinition} rule
from {Definition}.
to only include {ExecutableDefinition} and omit the {TypeSystemDefinition} and
{TypeSystemExtension} rules from {Definition}.


## Operations
Expand Down
30 changes: 25 additions & 5 deletions spec/Section 3 -- Type System.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ are valid.
TypeSystemDefinition :
- SchemaDefinition
- TypeDefinition
- TypeExtension
- DirectiveDefinition

The GraphQL language includes an
Expand All @@ -27,6 +26,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 +150,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 +282,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