Skip to content

Commit

Permalink
Move description section
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanGoncharov committed Sep 21, 2018
1 parent 4a70722 commit be9d5c6
Showing 1 changed file with 57 additions and 57 deletions.
114 changes: 57 additions & 57 deletions spec/Section 3 -- Type System.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,63 @@ 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.


## Descriptions

Description : StringValue

Documentation is first-class feature of GraphQL type systems. To ensure
the documentation of a GraphQL service remains consistent with its capabilities,
descriptions of GraphQL definitions are provided alongside their definitions and
made available via introspection.

To allow GraphQL service designers to easily publish documentation alongside the
capabilities of a GraphQL service, GraphQL descriptions are defined using the
Markdown syntax (as specified by [CommonMark](http://commonmark.org/)). In the
type system definition language, these description strings (often {BlockString})
occur immediately before the definition they describe.

All GraphQL types, fields, arguments and other definitions which can be
described should provide a {Description} unless they are considered self
descriptive.

As an example, this simple GraphQL schema is well described:

```graphql example
"""
A simple GraphQL schema which is well described.
"""
type Query {
"""
Translates a string from a given language into a different language.
"""
translate(
"The original language that `text` is provided in."
fromLanguage: Language

"The translated language to be returned."
toLanguage: Language

"The text to be translated."
text: String
): String
}

"""
The set of languages supported by `translate`.
"""
enum Language {
"English"
EN

"French"
FR

"Chinese"
CH
}
```


## Schema

SchemaDefinition : schema Directives[Const]? { RootOperationTypeDefinition+ }
Expand Down Expand Up @@ -168,63 +225,6 @@ Schema extensions have the potential to be invalid if incorrectly defined.
2. Any directives provided must not already apply to the original Schema.


## Descriptions

Description : StringValue

Documentation is first-class feature of GraphQL type systems. To ensure
the documentation of a GraphQL service remains consistent with its capabilities,
descriptions of GraphQL definitions are provided alongside their definitions and
made available via introspection.

To allow GraphQL service designers to easily publish documentation alongside the
capabilities of a GraphQL service, GraphQL descriptions are defined using the
Markdown syntax (as specified by [CommonMark](http://commonmark.org/)). In the
type system definition language, these description strings (often {BlockString})
occur immediately before the definition they describe.

All GraphQL types, fields, arguments and other definitions which can be
described should provide a {Description} unless they are considered self
descriptive.

As an example, this simple GraphQL schema is well described:

```graphql example
"""
A simple GraphQL schema which is well described.
"""
type Query {
"""
Translates a string from a given language into a different language.
"""
translate(
"The original language that `text` is provided in."
fromLanguage: Language

"The translated language to be returned."
toLanguage: Language

"The text to be translated."
text: String
): String
}

"""
The set of languages supported by `translate`.
"""
enum Language {
"English"
EN

"French"
FR

"Chinese"
CH
}
```


## Types

TypeDefinition :
Expand Down

0 comments on commit be9d5c6

Please sign in to comment.