diff --git a/spec/GraphQL.md b/spec/GraphQL.md index 3633f4351..f8602a61b 100644 --- a/spec/GraphQL.md +++ b/spec/GraphQL.md @@ -1,5 +1,4 @@ -GraphQL -------- +# **GraphQL** *Current Working Draft* diff --git a/spec/Section 2 -- Language.md b/spec/Section 2 -- Language.md index e58c299e8..9e71cdc12 100644 --- a/spec/Section 2 -- Language.md +++ b/spec/Section 2 -- Language.md @@ -646,11 +646,11 @@ will be present and `friends` will not. "profiles": [ { "handle": "zuck", - "friends": { "count" : 1234 } + "friends": { "count": 1234 } }, { "handle": "cocacola", - "likers": { "count" : 90234512 } + "likers": { "count": 90234512 } } ] } @@ -838,7 +838,7 @@ indentation and blank initial and trailing lines via {BlockStringValue()}. For example, the following operation containing a block string: -```graphql example +```rawgraphql example mutation { sendEmail(message: """ Hello, @@ -1199,13 +1199,17 @@ Directives may be provided in a specific syntactic order which may have semantic These two type definitions may have different semantic meaning: ```graphql example -type Person @addExternalFields(source: "profiles") @excludeField(name: "photo") { +type Person + @addExternalFields(source: "profiles") + @excludeField(name: "photo") { name: String } ``` ```graphql example -type Person @excludeField(name: "photo") @addExternalFields(source: "profiles") { +type Person + @excludeField(name: "photo") + @addExternalFields(source: "profiles") { name: String } ``` diff --git a/spec/Section 3 -- Type System.md b/spec/Section 3 -- Type System.md index 94b91e6a6..3dd939e74 100644 --- a/spec/Section 3 -- Type System.md +++ b/spec/Section 3 -- Type System.md @@ -59,7 +59,7 @@ self descriptive. As an example, this simple GraphQL schema is well described: -```graphql example +```rawgraphql example """ A simple GraphQL schema which is well described. """ @@ -1071,7 +1071,7 @@ interface. Querying for `age` is only valid when the result of `entity` is a ... on Person { age } - }, + } phoneNumber } ``` @@ -1083,7 +1083,7 @@ interface must define each field that is specified by the implemented interface. For example, the interface Resource must define the field id to implement the Node interface: -```graphql example +```rawgraphql example interface Node { id: ID! } @@ -1099,7 +1099,7 @@ that is being implemented) must also be defined on an implementing type or interface. For example, `Image` cannot implement `Resource` without also implementing `Node`: -```graphql example +```rawgraphql example interface Node { id: ID! } @@ -1297,7 +1297,7 @@ Instead, the query would be: Union members may be defined with an optional leading `|` character to aid formatting when representing a longer list of possible types: -```graphql example +```rawgraphql example union SearchResult = | Photo | Person @@ -1787,7 +1787,7 @@ fragment SomeFragment on SomeType { Directive locations may be defined with an optional leading `|` character to aid formatting when representing a longer list of possible locations: -```graphql example +```rawgraphql example directive @example on | FIELD | FRAGMENT_SPREAD diff --git a/spec/Section 4 -- Introspection.md b/spec/Section 4 -- Introspection.md index d1920cc63..fafc4006f 100644 --- a/spec/Section 4 -- Introspection.md +++ b/spec/Section 4 -- Introspection.md @@ -50,7 +50,7 @@ would return { "name": "birthday", "type": { "name": "Date" } - }, + } ] } } diff --git a/spec/Section 5 -- Validation.md b/spec/Section 5 -- Validation.md index 317e88de6..cd71ca12c 100644 --- a/spec/Section 5 -- Validation.md +++ b/spec/Section 5 -- Validation.md @@ -40,7 +40,11 @@ type Query { dog: Dog } -enum DogCommand { SIT, DOWN, HEEL } +enum DogCommand { + SIT + DOWN + HEEL +} type Dog implements Pet { name: String! @@ -69,7 +73,9 @@ type Human implements Sentient { pets: [Pet!] } -enum CatCommand { JUMP } +enum CatCommand { + JUMP +} type Cat implements Pet { name: String! @@ -950,7 +956,7 @@ Defined fragments must be used within a document. For example the following is an invalid document: -```graphql counter-example +```rawgraphql counter-example fragment nameFragment on Dog { # unused name } @@ -1270,7 +1276,7 @@ interface scope which it implements. In the example below, the `...resourceFragment` fragments spreads is valid, since `Resource` implements `Node`. -```graphql example +```rawgraphql example interface Node { id: ID! } @@ -1492,7 +1498,7 @@ For example, the following query will not pass validation because `@skip` has been used twice for the same field: ```graphql counter-example -query ($foo: Boolean = true, $bar: Boolean = false) { +query($foo: Boolean = true, $bar: Boolean = false) { field @skip(if: $foo) @skip(if: $bar) } ``` @@ -1501,7 +1507,7 @@ However the following example is valid because `@skip` has been used only once per location, despite being used twice in the query and on the same named field: ```graphql example -query ($foo: Boolean = true, $bar: Boolean = false) { +query($foo: Boolean = true, $bar: Boolean = false) { field @skip(if: $foo) { subfieldA } @@ -1577,7 +1583,10 @@ used as inputs. For these examples, consider the following typesystem additions: ```graphql example -input ComplexInput { name: String, owner: String } +input ComplexInput { + name: String + owner: String +} extend type Query { findDog(complex: ComplexInput): Dog diff --git a/spec/Section 7 -- Response.md b/spec/Section 7 -- Response.md index f51fb5982..a57e67683 100644 --- a/spec/Section 7 -- Response.md +++ b/spec/Section 7 -- Response.md @@ -113,8 +113,8 @@ The response might look like: "errors": [ { "message": "Name for character with ID 1002 could not be fetched.", - "locations": [ { "line": 6, "column": 7 } ], - "path": [ "hero", "heroFriends", 1, "name" ] + "locations": [{ "line": 6, "column": 7 }], + "path": ["hero", "heroFriends", 1, "name"] } ], "data": { @@ -153,8 +153,8 @@ be the same: "errors": [ { "message": "Name for character with ID 1002 could not be fetched.", - "locations": [ { "line": 6, "column": 7 } ], - "path": [ "hero", "heroFriends", 1, "name" ] + "locations": [{ "line": 6, "column": 7 }], + "path": ["hero", "heroFriends", 1, "name"] } ], "data": { @@ -186,8 +186,8 @@ there are no additional restrictions on its contents. "errors": [ { "message": "Name for character with ID 1002 could not be fetched.", - "locations": [ { "line": 6, "column": 7 } ], - "path": [ "hero", "heroFriends", 1, "name" ], + "locations": [{ "line": 6, "column": 7 }], + "path": ["hero", "heroFriends", 1, "name"], "extensions": { "code": "CAN_NOT_FETCH_BY_ID", "timestamp": "Fri Feb 9 14:33:09 UTC 2018" @@ -210,8 +210,8 @@ still discouraged. "errors": [ { "message": "Name for character with ID 1002 could not be fetched.", - "locations": [ { "line": 6, "column": 7 } ], - "path": [ "hero", "heroFriends", 1, "name" ], + "locations": [{ "line": 6, "column": 7 }], + "path": ["hero", "heroFriends", 1, "name"], "code": "CAN_NOT_FETCH_BY_ID", "timestamp": "Fri Feb 9 14:33:09 UTC 2018" }