-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support fragment spreads on abstract types defined in client schema e…
…xtensions Reviewed By: alunyov Differential Revision: D37944141 fbshipit-source-id: 6149ecc78a523768139000fa040b31b279b5900d
- Loading branch information
1 parent
4264743
commit a121b33
Showing
36 changed files
with
1,712 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
...ts/client_extensions_abstract_types/fixtures/fragment_spread_on_client_interface.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
==================================== INPUT ==================================== | ||
query Foo { | ||
client_type { | ||
...MyFragment | ||
} | ||
} | ||
|
||
fragment MyFragment on ClientNamed { | ||
name | ||
} | ||
|
||
# %extensions% | ||
|
||
extend type Query { | ||
client_type: ClientType | ||
} | ||
|
||
type ClientType implements ClientNamed { | ||
name: String | ||
} | ||
|
||
interface ClientNamed { | ||
name: String | ||
} | ||
==================================== OUTPUT =================================== | ||
{ | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "MyFragment", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "name", | ||
"storageKey": null | ||
} | ||
], | ||
"type": "ClientNamed", | ||
"abstractKey": "__isClientNamed" | ||
} | ||
|
||
{ | ||
"argumentDefinitions": [], | ||
"kind": "Operation", | ||
"name": "Foo", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"concreteType": "ClientType", | ||
"kind": "LinkedField", | ||
"name": "client_type", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"args": null, | ||
"kind": "FragmentSpread", | ||
"name": "MyFragment" | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
], | ||
"clientAbstractTypes": { | ||
"__isClientNamed": [ | ||
"ClientType" | ||
] | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...sts/client_extensions_abstract_types/fixtures/fragment_spread_on_client_interface.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
query Foo { | ||
client_type { | ||
...MyFragment | ||
} | ||
} | ||
|
||
fragment MyFragment on ClientNamed { | ||
name | ||
} | ||
|
||
# %extensions% | ||
|
||
extend type Query { | ||
client_type: ClientType | ||
} | ||
|
||
type ClientType implements ClientNamed { | ||
name: String | ||
} | ||
|
||
interface ClientNamed { | ||
name: String | ||
} |
91 changes: 91 additions & 0 deletions
91
...ensions_abstract_types/fixtures/fragment_spread_on_client_interface_transitively.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
==================================== INPUT ==================================== | ||
query Foo { | ||
...QueryFragment | ||
} | ||
|
||
fragment QueryFragment on Query { | ||
client_type { | ||
...MyFragment | ||
} | ||
} | ||
|
||
fragment MyFragment on ClientNamed { | ||
name | ||
} | ||
|
||
# %extensions% | ||
|
||
extend type Query { | ||
client_type: ClientType | ||
} | ||
|
||
type ClientType implements ClientNamed { | ||
name: String | ||
} | ||
|
||
interface ClientNamed { | ||
name: String | ||
} | ||
==================================== OUTPUT =================================== | ||
{ | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "MyFragment", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "name", | ||
"storageKey": null | ||
} | ||
], | ||
"type": "ClientNamed", | ||
"abstractKey": "__isClientNamed" | ||
} | ||
|
||
{ | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "QueryFragment", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"concreteType": "ClientType", | ||
"kind": "LinkedField", | ||
"name": "client_type", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"args": null, | ||
"kind": "FragmentSpread", | ||
"name": "MyFragment" | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
], | ||
"type": "Query", | ||
"abstractKey": null | ||
} | ||
|
||
{ | ||
"argumentDefinitions": [], | ||
"kind": "Operation", | ||
"name": "Foo", | ||
"selections": [ | ||
{ | ||
"args": null, | ||
"kind": "FragmentSpread", | ||
"name": "QueryFragment" | ||
} | ||
], | ||
"clientAbstractTypes": { | ||
"__isClientNamed": [ | ||
"ClientType" | ||
] | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...tensions_abstract_types/fixtures/fragment_spread_on_client_interface_transitively.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
query Foo { | ||
...QueryFragment | ||
} | ||
|
||
fragment QueryFragment on Query { | ||
client_type { | ||
...MyFragment | ||
} | ||
} | ||
|
||
fragment MyFragment on ClientNamed { | ||
name | ||
} | ||
|
||
# %extensions% | ||
|
||
extend type Query { | ||
client_type: ClientType | ||
} | ||
|
||
type ClientType implements ClientNamed { | ||
name: String | ||
} | ||
|
||
interface ClientNamed { | ||
name: String | ||
} |
74 changes: 74 additions & 0 deletions
74
.../tests/client_extensions_abstract_types/fixtures/fragment_spread_on_client_union.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
==================================== INPUT ==================================== | ||
query Foo { | ||
client_type { | ||
...MyFragment | ||
} | ||
} | ||
|
||
fragment MyFragment on ClientUnion { | ||
__typename | ||
} | ||
|
||
# %extensions% | ||
|
||
extend type Query { | ||
client_type: ClientType | ||
} | ||
|
||
type ClientType { | ||
name: String | ||
} | ||
|
||
type OtherClientType { | ||
name: String | ||
} | ||
|
||
union ClientUnion = ClientType | OtherClientType | ||
==================================== OUTPUT =================================== | ||
{ | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "MyFragment", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "__typename", | ||
"storageKey": null | ||
} | ||
], | ||
"type": "ClientUnion", | ||
"abstractKey": "__isClientUnion" | ||
} | ||
|
||
{ | ||
"argumentDefinitions": [], | ||
"kind": "Operation", | ||
"name": "Foo", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"concreteType": "ClientType", | ||
"kind": "LinkedField", | ||
"name": "client_type", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"args": null, | ||
"kind": "FragmentSpread", | ||
"name": "MyFragment" | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
], | ||
"clientAbstractTypes": { | ||
"__isClientUnion": [ | ||
"ClientType", | ||
"OtherClientType" | ||
] | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...n/tests/client_extensions_abstract_types/fixtures/fragment_spread_on_client_union.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
query Foo { | ||
client_type { | ||
...MyFragment | ||
} | ||
} | ||
|
||
fragment MyFragment on ClientUnion { | ||
__typename | ||
} | ||
|
||
# %extensions% | ||
|
||
extend type Query { | ||
client_type: ClientType | ||
} | ||
|
||
type ClientType { | ||
name: String | ||
} | ||
|
||
type OtherClientType { | ||
name: String | ||
} | ||
|
||
union ClientUnion = ClientType | OtherClientType |
Oops, something went wrong.