+31
-7
lines changedFilter options
+31
-7
lines changed Original file line number Diff line number Diff line change
@@ -113,13 +113,13 @@ Argument : Name : Value
113
113
114
114
FragmentSpread : ... FragmentName Directives?
115
115
116
-
InlineFragment : ... on TypeCondition Directives? SelectionSet
116
+
InlineFragment : ... TypeCondition? Directives? SelectionSet
117
117
118
-
FragmentDefinition : fragment FragmentName on TypeCondition Directives? SelectionSet
118
+
FragmentDefinition : fragment FragmentName TypeCondition Directives? SelectionSet
119
119
120
120
FragmentName : Name but not `on`
121
121
122
-
TypeCondition : NamedType
122
+
TypeCondition : on NamedType
123
123
124
124
Value[Const] :
125
125
- [~Const] Variable
Original file line number Diff line number Diff line change
@@ -431,7 +431,7 @@ otherwise the field's name.
431
431
432
432
FragmentSpread : ... FragmentName Directives?
433
433
434
-
FragmentDefinition : fragment FragmentName on TypeCondition Directives? SelectionSet
434
+
FragmentDefinition : fragment FragmentName TypeCondition Directives? SelectionSet
435
435
436
436
FragmentName : Name but not `on`
437
437
@@ -519,7 +519,7 @@ produce the same response object.
519
519
520
520
#### Type Conditions
521
521
522
-
TypeCondition : NamedType
522
+
TypeCondition : on NamedType
523
523
524
524
Fragments must specify the type they apply to. In this example, `friendFields`
525
525
can be used in the context of querying a `User`.
@@ -578,7 +578,7 @@ will be present and `friends` will not.
578
578
579
579
#### Inline Fragments
580
580
581
-
InlineFragment : ... on TypeCondition Directives? SelectionSet
581
+
InlineFragment : ... TypeCondition? Directives? SelectionSet
582
582
583
583
Fragments can be defined inline within a selection set. This is done to
584
584
conditionally include fields based on their runtime type. This feature of
@@ -603,6 +603,24 @@ query inlineFragmentTyping {
603
603
}
604
604
```
605
605
606
+
Inline fragments may also be used to apply a directive to a group of fields.
607
+
If the TypeCondition is omitted, an inline fragment is considered to be of the
608
+
same type as the enclosing context.
609
+
610
+
```graphql
611
+
query inlineFragmentNoType($expandedInfo: Boolean) {
612
+
user(handle: "zuck") {
613
+
id
614
+
name
615
+
... @include(if: $expandedInfo) {
616
+
firstName
617
+
lastName
618
+
birthday
619
+
}
620
+
}
621
+
}
622
+
```
623
+
606
624
607
625
### Input Values
608
626
Original file line number Diff line number Diff line change
@@ -650,6 +650,12 @@ fragment inlineFragment on Dog {
650
650
name
651
651
}
652
652
}
653
+
654
+
fragment inlineFragment on Dog {
655
+
... @include(if: true) {
656
+
name
657
+
}
658
+
}
653
659
```
654
660
655
661
and the following do not validate:
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ CollectFields(objectType, selectionSet, visitedFragments):
77
77
* Append all items in {fragmentGroup} to {groupForResponseKey}.
78
78
* If {selection} is an inline fragment:
79
79
* Let {fragmentType} be the type condition on {selection}.
80
-
* If {doesFragmentTypeApply(objectType, fragmentType)} is false, continue
80
+
* If {fragmentType} is not {null} and {doesFragmentTypeApply(objectType, fragmentType)} is false, continue
81
81
with the next {selection} in {selectionSet}.
82
82
* Let {fragmentSelectionSet} be the top-level selection set of {selection}.
83
83
* Let {fragmentGroupedFields} be the result of calling {CollectFields(objectType, fragmentSelectionSet)}.
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4