-
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.
Allow @required to bubble to client edge resolvers.
Reviewed By: voideanvalue Differential Revision: D47338425 fbshipit-source-id: 06cc7c06685223849f95d92ad261c5f420eef393
- Loading branch information
1 parent
35f3299
commit b2dcbfe
Showing
5 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
...-compiler/tests/compile_relay_artifacts/fixtures/required-bubbles-to-client-edge.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,68 @@ | ||
==================================== INPUT ==================================== | ||
fragment requiredBubblesToClientEdge_user on User { | ||
best_friend { | ||
# This will bubble nullability to the parent which is a client edge. | ||
# Under the hood that adds a metadata directive to that node, which | ||
# this test is designed to assert is allowed. | ||
name @required(action: NONE) | ||
} | ||
} | ||
|
||
# %extensions% | ||
|
||
type ClientUser { | ||
name: String | ||
} | ||
|
||
extend type User { | ||
best_friend: ClientUser @relay_resolver(import_path: "BestFriendResolver") | ||
} | ||
==================================== OUTPUT =================================== | ||
{ | ||
"argumentDefinitions": [], | ||
"kind": "Fragment", | ||
"metadata": { | ||
"hasClientEdges": true | ||
}, | ||
"name": "requiredBubblesToClientEdge_user", | ||
"selections": [ | ||
{ | ||
"kind": "ClientEdgeToClientObject", | ||
"concreteType": "ClientUser", | ||
"backingField": { | ||
"alias": null, | ||
"args": null, | ||
"fragment": null, | ||
"kind": "RelayResolver", | ||
"name": "best_friend", | ||
"resolverModule": require('BestFriendResolver'), | ||
"path": "best_friend" | ||
}, | ||
"linkedField": { | ||
"alias": null, | ||
"args": null, | ||
"concreteType": "ClientUser", | ||
"kind": "LinkedField", | ||
"name": "best_friend", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"kind": "RequiredField", | ||
"field": { | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "name", | ||
"storageKey": null | ||
}, | ||
"action": "NONE", | ||
"path": "best_friend.name" | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
} | ||
], | ||
"type": "User", | ||
"abstractKey": null | ||
} |
18 changes: 18 additions & 0 deletions
18
...y-compiler/tests/compile_relay_artifacts/fixtures/required-bubbles-to-client-edge.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,18 @@ | ||
fragment requiredBubblesToClientEdge_user on User { | ||
best_friend { | ||
# This will bubble nullability to the parent which is a client edge. | ||
# Under the hood that adds a metadata directive to that node, which | ||
# this test is designed to assert is allowed. | ||
name @required(action: NONE) | ||
} | ||
} | ||
|
||
# %extensions% | ||
|
||
type ClientUser { | ||
name: String | ||
} | ||
|
||
extend type User { | ||
best_friend: ClientUser @relay_resolver(import_path: "BestFriendResolver") | ||
} |
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
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