File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -201,19 +201,31 @@ fragment definedOnImplementorsButNotInterface on Pet {
201201}
202202```
203203
204- Because fields are not declared on unions, direct field selection on
205- union-typed selection set. This is true even if concrete
206- implementors of the union define the fieldName.
204+ Because unions do not define fields, fields may not be directly selected from a
205+ union-typed selection set, with the exception of the meta-field {__ typename}.
206+ Fields from a union-typed selection set must only be queried indirectly via
207+ a fragment.
207208
208- For example the following is invalid
209+ For example the following is valid:
209210
210- ``` !graphql
211- fragment directFieldSelectionOnUnion on CatOrDog {
212- directField
211+ ``` graphql
212+ fragment inDirectFieldSelectionOnUnion on CatOrDog {
213+ __typename
214+ ... on Pet {
215+ name
216+ }
217+ ... on Dog {
218+ barkVolume
219+ }
213220}
221+ ```
222+
223+ But the following is invalid:
214224
215- fragment definedOnImplementorsQueriedOnUnion on CatOrDog {
225+ ``` !graphql
226+ fragment directFieldSelectionOnUnion on CatOrDog {
216227 name
228+ barkVolume
217229}
218230```
219231
You can’t perform that action at this time.
0 commit comments