-
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.
Summary: This adds a new option to the Rust compiler, `nodeInterfaceIdField`, which allows customization of the `Node` interface's `id` field. I initially tried to determine this via inference, but it's entirely possible that the `Node` interface has multiple `id` fields, so I figured explicitly specifying it made more sense. Pull Request resolved: #3638 Reviewed By: josephsavona Differential Revision: D33131805 Pulled By: alunyov fbshipit-source-id: ffbdfebf7bd958e0f81f281a291f1e579702d4ed
- Loading branch information
1 parent
995bb87
commit c3f0292
Showing
62 changed files
with
5,464 additions
and
66 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
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
280 changes: 280 additions & 0 deletions
280
...tests/compile_relay_artifacts_with_custom_id/fixtures/fragment-on-node-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,280 @@ | ||
==================================== INPUT ==================================== | ||
fragment fragmentOnNodeInterface_RefetchableFragment on Node | ||
@refetchable(queryName: "RefetchableFragmentQuery") { | ||
global_id | ||
... on User { | ||
name | ||
...fragmentOnNodeInterface_ProfilePicture | ||
} | ||
} | ||
|
||
fragment fragmentOnNodeInterface_ProfilePicture on User { | ||
profilePicture(size: $size) { | ||
uri | ||
} | ||
} | ||
==================================== OUTPUT =================================== | ||
{ | ||
"fragment": { | ||
"argumentDefinitions": [ | ||
{ | ||
"defaultValue": null, | ||
"kind": "LocalArgument", | ||
"name": "global_id" | ||
}, | ||
{ | ||
"defaultValue": null, | ||
"kind": "LocalArgument", | ||
"name": "size" | ||
} | ||
], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "RefetchableFragmentQuery", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": [ | ||
{ | ||
"kind": "Variable", | ||
"name": "global_id", | ||
"variableName": "global_id" | ||
} | ||
], | ||
"concreteType": null, | ||
"kind": "LinkedField", | ||
"name": "node", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"args": null, | ||
"kind": "FragmentSpread", | ||
"name": "fragmentOnNodeInterface_RefetchableFragment" | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
], | ||
"type": "Query", | ||
"abstractKey": null | ||
}, | ||
"kind": "Request", | ||
"operation": { | ||
"argumentDefinitions": [ | ||
{ | ||
"defaultValue": null, | ||
"kind": "LocalArgument", | ||
"name": "size" | ||
}, | ||
{ | ||
"defaultValue": null, | ||
"kind": "LocalArgument", | ||
"name": "global_id" | ||
} | ||
], | ||
"kind": "Operation", | ||
"name": "RefetchableFragmentQuery", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": [ | ||
{ | ||
"kind": "Variable", | ||
"name": "global_id", | ||
"variableName": "global_id" | ||
} | ||
], | ||
"concreteType": null, | ||
"kind": "LinkedField", | ||
"name": "node", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "__typename", | ||
"storageKey": null | ||
}, | ||
{ | ||
"kind": "TypeDiscriminator", | ||
"abstractKey": "__isNode" | ||
}, | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "global_id", | ||
"storageKey": null | ||
}, | ||
{ | ||
"kind": "InlineFragment", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "name", | ||
"storageKey": null | ||
}, | ||
{ | ||
"alias": null, | ||
"args": [ | ||
{ | ||
"kind": "Variable", | ||
"name": "size", | ||
"variableName": "size" | ||
} | ||
], | ||
"concreteType": "Image", | ||
"kind": "LinkedField", | ||
"name": "profilePicture", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "uri", | ||
"storageKey": null | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
], | ||
"type": "User", | ||
"abstractKey": null | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
] | ||
}, | ||
"params": { | ||
"id": null, | ||
"metadata": {}, | ||
"name": "RefetchableFragmentQuery", | ||
"operationKind": "query", | ||
"text": null | ||
} | ||
} | ||
|
||
QUERY: | ||
|
||
query RefetchableFragmentQuery( | ||
$size: [Int] | ||
$global_id: ID! | ||
) { | ||
node(global_id: $global_id) { | ||
__typename | ||
...fragmentOnNodeInterface_RefetchableFragment | ||
global_id | ||
} | ||
} | ||
|
||
fragment fragmentOnNodeInterface_ProfilePicture on User { | ||
profilePicture(size: $size) { | ||
uri | ||
} | ||
} | ||
|
||
fragment fragmentOnNodeInterface_RefetchableFragment on Node { | ||
__isNode: __typename | ||
global_id | ||
... on User { | ||
name | ||
...fragmentOnNodeInterface_ProfilePicture | ||
} | ||
} | ||
|
||
|
||
{ | ||
"argumentDefinitions": [ | ||
{ | ||
"kind": "RootArgument", | ||
"name": "size" | ||
} | ||
], | ||
"kind": "Fragment", | ||
"metadata": null, | ||
"name": "fragmentOnNodeInterface_ProfilePicture", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": [ | ||
{ | ||
"kind": "Variable", | ||
"name": "size", | ||
"variableName": "size" | ||
} | ||
], | ||
"concreteType": "Image", | ||
"kind": "LinkedField", | ||
"name": "profilePicture", | ||
"plural": false, | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "uri", | ||
"storageKey": null | ||
} | ||
], | ||
"storageKey": null | ||
} | ||
], | ||
"type": "User", | ||
"abstractKey": null | ||
} | ||
|
||
{ | ||
"argumentDefinitions": [ | ||
{ | ||
"kind": "RootArgument", | ||
"name": "size" | ||
} | ||
], | ||
"kind": "Fragment", | ||
"metadata": { | ||
"refetch": { | ||
"connection": null, | ||
"fragmentPathInResult": [ | ||
"node" | ||
], | ||
"operation": require('RefetchableFragmentQuery.graphql'), | ||
"identifierField": "global_id" | ||
} | ||
}, | ||
"name": "fragmentOnNodeInterface_RefetchableFragment", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "global_id", | ||
"storageKey": null | ||
}, | ||
{ | ||
"kind": "InlineFragment", | ||
"selections": [ | ||
{ | ||
"alias": null, | ||
"args": null, | ||
"kind": "ScalarField", | ||
"name": "name", | ||
"storageKey": null | ||
}, | ||
{ | ||
"args": null, | ||
"kind": "FragmentSpread", | ||
"name": "fragmentOnNodeInterface_ProfilePicture" | ||
} | ||
], | ||
"type": "User", | ||
"abstractKey": null | ||
} | ||
], | ||
"type": "Node", | ||
"abstractKey": "__isNode" | ||
} |
14 changes: 14 additions & 0 deletions
14
.../tests/compile_relay_artifacts_with_custom_id/fixtures/fragment-on-node-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,14 @@ | ||
fragment fragmentOnNodeInterface_RefetchableFragment on Node | ||
@refetchable(queryName: "RefetchableFragmentQuery") { | ||
global_id | ||
... on User { | ||
name | ||
...fragmentOnNodeInterface_ProfilePicture | ||
} | ||
} | ||
|
||
fragment fragmentOnNodeInterface_ProfilePicture on User { | ||
profilePicture(size: $size) { | ||
uri | ||
} | ||
} |
Oops, something went wrong.