Skip to content

Commit b47598f

Browse files
benjieleebyron
andauthored
Prettier pre-work: formatting tweaks (#832)
* Pre-prettier tweaks * Mark incorrectly formatted GraphQL blocks as raw Co-authored-by: Lee Byron <[email protected]>
1 parent d716d84 commit b47598f

7 files changed

+43
-31
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,8 +824,8 @@ Wow, that's a lot of types! What are they? Let's group them:
824824
defined in our type system.
825825
- **String, Boolean** - These are built-in scalars that the type system
826826
provided.
827-
- **__Schema, __Type, __TypeKind, __Field, __InputValue, __EnumValue,
828-
__Directive** - These all are preceded with a double underscore, indicating
827+
- **`__Schema`, `__Type`, `__TypeKind`, `__Field`, `__InputValue`, `__EnumValue`,
828+
`__Directive`** - These all are preceded with a double underscore, indicating
829829
that they are part of the introspection system.
830830

831831
Now, let's try and figure out a good place to start exploring what queries are

spec/GraphQL.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
GraphQL
2-
-------
1+
# GraphQL
32

43
*Current Working Draft*
54

spec/Section 2 -- Language.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -647,11 +647,11 @@ will be present and `friends` will not.
647647
"profiles": [
648648
{
649649
"handle": "zuck",
650-
"friends": { "count" : 1234 }
650+
"friends": { "count": 1234 }
651651
},
652652
{
653653
"handle": "cocacola",
654-
"likers": { "count" : 90234512 }
654+
"likers": { "count": 90234512 }
655655
}
656656
]
657657
}
@@ -839,7 +839,7 @@ indentation and blank initial and trailing lines via {BlockStringValue()}.
839839

840840
For example, the following operation containing a block string:
841841

842-
```graphql example
842+
```raw graphql example
843843
mutation {
844844
sendEmail(message: """
845845
Hello,
@@ -1200,13 +1200,17 @@ Directives may be provided in a specific syntactic order which may have semantic
12001200
These two type definitions may have different semantic meaning:
12011201

12021202
```graphql example
1203-
type Person @addExternalFields(source: "profiles") @excludeField(name: "photo") {
1203+
type Person
1204+
@addExternalFields(source: "profiles")
1205+
@excludeField(name: "photo") {
12041206
name: String
12051207
}
12061208
```
12071209

12081210
```graphql example
1209-
type Person @excludeField(name: "photo") @addExternalFields(source: "profiles") {
1211+
type Person
1212+
@excludeField(name: "photo")
1213+
@addExternalFields(source: "profiles") {
12101214
name: String
12111215
}
12121216
```

spec/Section 3 -- Type System.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ self descriptive.
5959

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

62-
```graphql example
62+
```raw graphql example
6363
"""
6464
A simple GraphQL schema which is well described.
6565
"""
@@ -1071,7 +1071,7 @@ interface. Querying for `age` is only valid when the result of `entity` is a
10711071
... on Person {
10721072
age
10731073
}
1074-
},
1074+
}
10751075
phoneNumber
10761076
}
10771077
```
@@ -1083,7 +1083,7 @@ interface must define each field that is specified by the implemented interface.
10831083
For example, the interface Resource must define the field id to implement the
10841084
Node interface:
10851085

1086-
```graphql example
1086+
```raw graphql example
10871087
interface Node {
10881088
id: ID!
10891089
}
@@ -1099,7 +1099,7 @@ that is being implemented) must also be defined on an implementing type or
10991099
interface. For example, `Image` cannot implement `Resource` without also
11001100
implementing `Node`:
11011101

1102-
```graphql example
1102+
```raw graphql example
11031103
interface Node {
11041104
id: ID!
11051105
}
@@ -1298,7 +1298,7 @@ Instead, the query would be:
12981298
Union members may be defined with an optional leading `|` character to aid
12991299
formatting when representing a longer list of possible types:
13001300

1301-
```graphql example
1301+
```raw graphql example
13021302
union SearchResult =
13031303
| Photo
13041304
| Person
@@ -1847,7 +1847,7 @@ fragment SomeFragment on SomeType {
18471847
Directive locations may be defined with an optional leading `|` character to aid
18481848
formatting when representing a longer list of possible locations:
18491849

1850-
```graphql example
1850+
```raw graphql example
18511851
directive @example on
18521852
| FIELD
18531853
| FRAGMENT_SPREAD

spec/Section 4 -- Introspection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ would return
5050
{
5151
"name": "birthday",
5252
"type": { "name": "Date" }
53-
},
53+
}
5454
]
5555
}
5656
}

spec/Section 5 -- Validation.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ type Query {
4040
dog: Dog
4141
}
4242

43-
enum DogCommand { SIT, DOWN, HEEL }
43+
enum DogCommand {
44+
SIT
45+
DOWN
46+
HEEL
47+
}
4448

4549
type Dog implements Pet {
4650
name: String!
@@ -69,7 +73,9 @@ type Human implements Sentient {
6973
pets: [Pet!]
7074
}
7175

72-
enum CatCommand { JUMP }
76+
enum CatCommand {
77+
JUMP
78+
}
7379

7480
type Cat implements Pet {
7581
name: String!
@@ -952,7 +958,7 @@ Defined fragments must be used within a document.
952958

953959
For example the following is an invalid document:
954960

955-
```graphql counter-example
961+
```raw graphql counter-example
956962
fragment nameFragment on Dog { # unused
957963
name
958964
}
@@ -1272,7 +1278,7 @@ interface scope which it implements.
12721278
In the example below, the `...resourceFragment` fragments spreads is valid,
12731279
since `Resource` implements `Node`.
12741280

1275-
```graphql example
1281+
```raw graphql example
12761282
interface Node {
12771283
id: ID!
12781284
}
@@ -1493,7 +1499,7 @@ directive is allowed per location.
14931499
For example, the following query will not pass validation because `@skip` has
14941500
been used twice for the same field:
14951501

1496-
```graphql counter-example
1502+
```raw graphql counter-example
14971503
query ($foo: Boolean = true, $bar: Boolean = false) {
14981504
field @skip(if: $foo) @skip(if: $bar)
14991505
}
@@ -1502,7 +1508,7 @@ query ($foo: Boolean = true, $bar: Boolean = false) {
15021508
However the following example is valid because `@skip` has been used only once
15031509
per location, despite being used twice in the query and on the same named field:
15041510

1505-
```graphql example
1511+
```raw graphql example
15061512
query ($foo: Boolean = true, $bar: Boolean = false) {
15071513
field @skip(if: $foo) {
15081514
subfieldA
@@ -1579,7 +1585,10 @@ used as inputs.
15791585
For these examples, consider the following typesystem additions:
15801586

15811587
```graphql example
1582-
input ComplexInput { name: String, owner: String }
1588+
input ComplexInput {
1589+
name: String
1590+
owner: String
1591+
}
15831592

15841593
extend type Query {
15851594
findDog(complex: ComplexInput): Dog

spec/Section 7 -- Response.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ The response might look like:
113113
"errors": [
114114
{
115115
"message": "Name for character with ID 1002 could not be fetched.",
116-
"locations": [ { "line": 6, "column": 7 } ],
117-
"path": [ "hero", "heroFriends", 1, "name" ]
116+
"locations": [{ "line": 6, "column": 7 }],
117+
"path": ["hero", "heroFriends", 1, "name"]
118118
}
119119
],
120120
"data": {
@@ -153,8 +153,8 @@ be the same:
153153
"errors": [
154154
{
155155
"message": "Name for character with ID 1002 could not be fetched.",
156-
"locations": [ { "line": 6, "column": 7 } ],
157-
"path": [ "hero", "heroFriends", 1, "name" ]
156+
"locations": [{ "line": 6, "column": 7 }],
157+
"path": ["hero", "heroFriends", 1, "name"]
158158
}
159159
],
160160
"data": {
@@ -186,8 +186,8 @@ there are no additional restrictions on its contents.
186186
"errors": [
187187
{
188188
"message": "Name for character with ID 1002 could not be fetched.",
189-
"locations": [ { "line": 6, "column": 7 } ],
190-
"path": [ "hero", "heroFriends", 1, "name" ],
189+
"locations": [{ "line": 6, "column": 7 }],
190+
"path": ["hero", "heroFriends", 1, "name"],
191191
"extensions": {
192192
"code": "CAN_NOT_FETCH_BY_ID",
193193
"timestamp": "Fri Feb 9 14:33:09 UTC 2018"
@@ -210,8 +210,8 @@ still discouraged.
210210
"errors": [
211211
{
212212
"message": "Name for character with ID 1002 could not be fetched.",
213-
"locations": [ { "line": 6, "column": 7 } ],
214-
"path": [ "hero", "heroFriends", 1, "name" ],
213+
"locations": [{ "line": 6, "column": 7 }],
214+
"path": ["hero", "heroFriends", 1, "name"],
215215
"code": "CAN_NOT_FETCH_BY_ID",
216216
"timestamp": "Fri Feb 9 14:33:09 UTC 2018"
217217
}

0 commit comments

Comments
 (0)