Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
17 changes: 17 additions & 0 deletions cspell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
language: en
words:
# Terms of art
- endianness
- interoperation
- monospace
- openwebfoundation
- parallelization
- structs
- subselection
# Fictional characters / examples
- hagrid
- leia
- othername
- skywalker
- zuck
- zuckerberg
1,693 changes: 1,639 additions & 54 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@
"url": "http://github.com/graphql/graphql-spec.git"
},
"scripts": {
"test": "spec-md spec/GraphQL.md > /dev/null",
"test": "npm run test:build && npm run test:spellcheck",
"test:build": "spec-md spec/GraphQL.md > /dev/null",
"test:spellcheck": "cspell 'spec/**/*.md'",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might as well spellcheck the README and the RFCs too?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README yes. RFCs have a zillion spurious errors (like flagging github usernames) so I'll exclude those

"build": "mkdir -p out; spec-md --githubSource 'https://github.com/graphql/graphql-spec/blame/main/' spec/GraphQL.md > out/index.html",
"watch": "nodemon -e json,md --exec 'npm run build'"
},
"devDependencies": {
"cspell": "5.3.12",
"nodemon": "2.0.7",
"spec-md": "3.0.2"
}
Expand Down
2 changes: 1 addition & 1 deletion spec/Appendix A -- Notation Conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ and their expanded definitions in the context-free grammar.
A grammar production may specify that certain expansions are not permitted by
using the phrase "but not" and then indicating the expansions to be excluded.

For example, the following production means that the nonterminal {SafeWord} may
For example, the following production means that the non-terminal {SafeWord} may
be replaced by any sequence of characters that could replace {Word} provided
that the same sequence of characters could not replace {SevenCarlinWords}.

Expand Down
6 changes: 3 additions & 3 deletions spec/Section 2 -- Language.md
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ For example in this operation using the Facebook data model:

```graphql example
query FragmentTyping {
profiles(handles: ["zuck", "cocacola"]) {
profiles(handles: ["zuck", "coca-cola"]) {
handle
...userFragment
...pageFragment
Expand Down Expand Up @@ -654,7 +654,7 @@ will be present and `friends` will not.
"friends": { "count": 1234 }
},
{
"handle": "cocacola",
"handle": "coca-cola",
"likers": { "count": 90234512 }
}
]
Expand All @@ -673,7 +673,7 @@ example. We could accomplish the same thing using inline fragments.

```graphql example
query inlineFragmentTyping {
profiles(handles: ["zuck", "cocacola"]) {
profiles(handles: ["zuck", "coca-cola"]) {
handle
... on User {
friends {
Expand Down
104 changes: 52 additions & 52 deletions spec/Section 5 -- Validation.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ type Dog implements Pet {
nickname: String
barkVolume: Int
doesKnowCommand(dogCommand: DogCommand!): Boolean!
isHousetrained(atOtherHomes: Boolean): Boolean!
isHouseTrained(atOtherHomes: Boolean): Boolean!
owner: Human
}

Expand Down Expand Up @@ -255,7 +255,7 @@ query getName {
* Let {variableValues} be the empty set.
* Let {groupedFieldSet} be the result of
{CollectFields(subscriptionType, selectionSet, variableValues)}.
* {groupedFieldSet} must have exactly one entry, which must not be an
* {groupedFieldSet} must have exactly one entry, which must not be an
introspection field.

**Explanatory Text**
Expand Down Expand Up @@ -660,7 +660,7 @@ fragment argOnRequiredArg on Dog {
}

fragment argOnOptional on Dog {
isHousetrained(atOtherHomes: true) @include(if: true)
isHouseTrained(atOtherHomes: true) @include(if: true)
}
```

Expand All @@ -676,7 +676,7 @@ and this is also invalid as `unless` is not defined on `@include`.

```graphql counter-example
fragment invalidArgName on Dog {
isHousetrained(atOtherHomes: true) @include(unless: false)
isHouseTrained(atOtherHomes: true) @include(unless: false)
}
```

Expand All @@ -685,7 +685,7 @@ to our type system:

```graphql example
type Arguments {
multipleReqs(x: Int!, y: Int!): Int!
multipleRequirements(x: Int!, y: Int!): Int!
booleanArgField(booleanArg: Boolean): Boolean
floatArgField(floatArg: Float): Float
intArgField(intArg: Int): Int
Expand All @@ -703,11 +703,11 @@ Order does not matter in arguments. Therefore both the following examples are va

```graphql example
fragment multipleArgs on Arguments {
multipleReqs(x: 1, y: 2)
multipleRequirements(x: 1, y: 2)
}

fragment multipleArgsReverseOrder on Arguments {
multipleReqs(y: 2, x: 1)
multipleRequirements(y: 2, x: 1)
}
```

Expand Down Expand Up @@ -973,7 +973,7 @@ fragment nameFragment on Dog { # unused
### Fragment Spreads

Field selection is also determined by spreading fragments into one
another. The selection set of the target fragment is unioned with
another. The selection set of the target fragment is combined into
the selection set at the level at which the target fragment is
referenced.

Expand Down Expand Up @@ -1542,7 +1542,7 @@ is the same.
```graphql counter-example
query houseTrainedQuery($atOtherHomes: Boolean, $atOtherHomes: Boolean) {
dog {
isHousetrained(atOtherHomes: $atOtherHomes)
isHouseTrained(atOtherHomes: $atOtherHomes)
}
}
```
Expand All @@ -1562,7 +1562,7 @@ query B($atOtherHomes: Boolean) {

fragment HouseTrainedFragment on Query {
dog {
isHousetrained(atOtherHomes: $atOtherHomes)
isHouseTrained(atOtherHomes: $atOtherHomes)
}
}
```
Expand All @@ -1582,7 +1582,7 @@ fragment HouseTrainedFragment on Query {
Variables can only be input types. Objects, unions, and interfaces cannot be
used as inputs.

For these examples, consider the following typesystem additions:
For these examples, consider the following type system additions:

```graphql example
input ComplexInput {
Expand All @@ -1601,7 +1601,7 @@ The following operations are valid:
```graphql example
query takesBoolean($atOtherHomes: Boolean) {
dog {
isHousetrained(atOtherHomes: $atOtherHomes)
isHouseTrained(atOtherHomes: $atOtherHomes)
}
}

Expand Down Expand Up @@ -1659,7 +1659,7 @@ For example:
```graphql example
query variableIsDefined($atOtherHomes: Boolean) {
dog {
isHousetrained(atOtherHomes: $atOtherHomes)
isHouseTrained(atOtherHomes: $atOtherHomes)
}
}
```
Expand All @@ -1671,7 +1671,7 @@ By contrast the following document is invalid:
```graphql counter-example
query variableIsNotDefined {
dog {
isHousetrained(atOtherHomes: $atOtherHomes)
isHouseTrained(atOtherHomes: $atOtherHomes)
}
}
```
Expand All @@ -1688,16 +1688,16 @@ For example the following is valid:
```graphql example
query variableIsDefinedUsedInSingleFragment($atOtherHomes: Boolean) {
dog {
...isHousetrainedFragment
...isHouseTrainedFragment
}
}

fragment isHousetrainedFragment on Dog {
isHousetrained(atOtherHomes: $atOtherHomes)
fragment isHouseTrainedFragment on Dog {
isHouseTrained(atOtherHomes: $atOtherHomes)
}
```

since {isHousetrainedFragment} is used within the context of the operation
since {isHouseTrainedFragment} is used within the context of the operation
{variableIsDefinedUsedInSingleFragment} and the variable is defined by that
operation.

Expand All @@ -1707,12 +1707,12 @@ not define a referenced variable, the document is invalid.
```graphql counter-example
query variableIsNotDefinedUsedInSingleFragment {
dog {
...isHousetrainedFragment
...isHouseTrainedFragment
}
}

fragment isHousetrainedFragment on Dog {
isHousetrained(atOtherHomes: $atOtherHomes)
fragment isHouseTrainedFragment on Dog {
isHouseTrained(atOtherHomes: $atOtherHomes)
}
```

Expand All @@ -1721,62 +1721,62 @@ This applies transitively as well, so the following also fails:
```graphql counter-example
query variableIsNotDefinedUsedInNestedFragment {
dog {
...outerHousetrainedFragment
...outerHouseTrainedFragment
}
}

fragment outerHousetrainedFragment on Dog {
...isHousetrainedFragment
fragment outerHouseTrainedFragment on Dog {
...isHouseTrainedFragment
}

fragment isHousetrainedFragment on Dog {
isHousetrained(atOtherHomes: $atOtherHomes)
fragment isHouseTrainedFragment on Dog {
isHouseTrained(atOtherHomes: $atOtherHomes)
}
```

Variables must be defined in all operations in which a fragment
is used.

```graphql example
query housetrainedQueryOne($atOtherHomes: Boolean) {
query houseTrainedQueryOne($atOtherHomes: Boolean) {
dog {
...isHousetrainedFragment
...isHouseTrainedFragment
}
}

query housetrainedQueryTwo($atOtherHomes: Boolean) {
query houseTrainedQueryTwo($atOtherHomes: Boolean) {
dog {
...isHousetrainedFragment
...isHouseTrainedFragment
}
}

fragment isHousetrainedFragment on Dog {
isHousetrained(atOtherHomes: $atOtherHomes)
fragment isHouseTrainedFragment on Dog {
isHouseTrained(atOtherHomes: $atOtherHomes)
}
```

However the following does not validate:

```graphql counter-example
query housetrainedQueryOne($atOtherHomes: Boolean) {
query houseTrainedQueryOne($atOtherHomes: Boolean) {
dog {
...isHousetrainedFragment
...isHouseTrainedFragment
}
}

query housetrainedQueryTwoNotDefined {
query houseTrainedQueryTwoNotDefined {
dog {
...isHousetrainedFragment
...isHouseTrainedFragment
}
}

fragment isHousetrainedFragment on Dog {
isHousetrained(atOtherHomes: $atOtherHomes)
fragment isHouseTrainedFragment on Dog {
isHouseTrained(atOtherHomes: $atOtherHomes)
}
```

This is because {housetrainedQueryTwoNotDefined} does not define
a variable ${atOtherHomes} but that variable is used by {isHousetrainedFragment}
This is because {houseTrainedQueryTwoNotDefined} does not define
a variable ${atOtherHomes} but that variable is used by {isHouseTrainedFragment}
which is included in that operation.


Expand All @@ -1801,7 +1801,7 @@ For example the following is invalid:
```graphql counter-example
query variableUnused($atOtherHomes: Boolean) {
dog {
isHousetrained
isHouseTrained
}
}
```
Expand All @@ -1813,29 +1813,29 @@ These rules apply to transitive fragment spreads as well:
```graphql example
query variableUsedInFragment($atOtherHomes: Boolean) {
dog {
...isHousetrainedFragment
...isHouseTrainedFragment
}
}

fragment isHousetrainedFragment on Dog {
isHousetrained(atOtherHomes: $atOtherHomes)
fragment isHouseTrainedFragment on Dog {
isHouseTrained(atOtherHomes: $atOtherHomes)
}
```

The above is valid since ${atOtherHomes} is used in {isHousetrainedFragment}
The above is valid since ${atOtherHomes} is used in {isHouseTrainedFragment}
which is included by {variableUsedInFragment}.

If that fragment did not have a reference to ${atOtherHomes} it would be not valid:

```graphql counter-example
query variableNotUsedWithinFragment($atOtherHomes: Boolean) {
dog {
...isHousetrainedWithoutVariableFragment
...isHouseTrainedWithoutVariableFragment
}
}

fragment isHousetrainedWithoutVariableFragment on Dog {
isHousetrained
fragment isHouseTrainedWithoutVariableFragment on Dog {
isHouseTrained
}
```

Expand All @@ -1846,18 +1846,18 @@ As a result, the following document does not validate.
```graphql counter-example
query queryWithUsedVar($atOtherHomes: Boolean) {
dog {
...isHousetrainedFragment
...isHouseTrainedFragment
}
}

query queryWithExtraVar($atOtherHomes: Boolean, $extra: Int) {
dog {
...isHousetrainedFragment
...isHouseTrainedFragment
}
}

fragment isHousetrainedFragment on Dog {
isHousetrained(atOtherHomes: $atOtherHomes)
fragment isHouseTrainedFragment on Dog {
isHouseTrained(atOtherHomes: $atOtherHomes)
}
```

Expand Down
5 changes: 2 additions & 3 deletions spec/Section 7 -- Response.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ in a response during debugging.

The `data` entry in the response will be the result of the execution of the
requested operation. If the operation was a query, this output will be an
object of the schema's query root operation type; if the operation was a
mutation, this output will be an object of the schema's mutation root
operation type.
object of the query root operation type; if the operation was a
mutation, this output will be an object of the mutation root operation type.

If an error was raised before execution begins, the `data` entry should
not be present in the result.
Expand Down