-
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.
Preserve correct resolver path across client edges
Reviewed By: voideanvalue Differential Revision: D45283146 fbshipit-source-id: 3af0c8a931c5b0cd119c94de5f276ce6aab557f1
- Loading branch information
1 parent
6f2f4cf
commit fd06faa
Showing
26 changed files
with
378 additions
and
92 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
90 changes: 90 additions & 0 deletions
90
compiler/crates/relay-transforms/tests/client_edges/fixtures/nested-path-with-alias.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,90 @@ | ||
==================================== INPUT ==================================== | ||
fragment Foo_user on ClientUser { | ||
bff: best_friend { | ||
bffs_bff: best_friend { | ||
id | ||
} | ||
} | ||
} | ||
|
||
fragment BestFriendFragment on ClientUser { | ||
id | ||
} | ||
|
||
# %extensions% | ||
|
||
type ClientUser { | ||
id: ID | ||
} | ||
|
||
extend type ClientUser { | ||
best_friend: ClientUser | ||
@relay_resolver( | ||
fragment_name: "BestFriendFragment" | ||
import_path: "BestFriendResolver" | ||
) | ||
} | ||
==================================== OUTPUT =================================== | ||
fragment BestFriendFragment on ClientUser { | ||
id | ||
} | ||
|
||
fragment Foo_user on ClientUser { | ||
... @__ClientEdgeMetadataDirective | ||
# ClientObject { | ||
# type_name: Some( | ||
# ObjectName( | ||
# "ClientUser", | ||
# ), | ||
# ), | ||
# unique_id: 1, | ||
# } | ||
{ | ||
...BestFriendFragment @__RelayResolverMetadata | ||
# RelayResolverMetadata { | ||
# field_id: FieldID(518), | ||
# import_path: "BestFriendResolver", | ||
# import_name: None, | ||
# field_alias: Some( | ||
# "bff", | ||
# ), | ||
# field_path: "bff", | ||
# field_arguments: [], | ||
# live: false, | ||
# output_type_info: EdgeTo, | ||
# fragment_data_injection_mode: None, | ||
# } | ||
|
||
bff: best_friend { | ||
... @__ClientEdgeMetadataDirective | ||
# ClientObject { | ||
# type_name: Some( | ||
# ObjectName( | ||
# "ClientUser", | ||
# ), | ||
# ), | ||
# unique_id: 0, | ||
# } | ||
{ | ||
...BestFriendFragment @__RelayResolverMetadata | ||
# RelayResolverMetadata { | ||
# field_id: FieldID(518), | ||
# import_path: "BestFriendResolver", | ||
# import_name: None, | ||
# field_alias: Some( | ||
# "bffs_bff", | ||
# ), | ||
# field_path: "bff.bffs_bff", | ||
# field_arguments: [], | ||
# live: false, | ||
# output_type_info: EdgeTo, | ||
# fragment_data_injection_mode: None, | ||
# } | ||
|
||
bffs_bff: best_friend { | ||
id | ||
} | ||
} | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
compiler/crates/relay-transforms/tests/client_edges/fixtures/nested-path-with-alias.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 @@ | ||
fragment Foo_user on ClientUser { | ||
bff: best_friend { | ||
bffs_bff: best_friend { | ||
id | ||
} | ||
} | ||
} | ||
|
||
fragment BestFriendFragment on ClientUser { | ||
id | ||
} | ||
|
||
# %extensions% | ||
|
||
type ClientUser { | ||
id: ID | ||
} | ||
|
||
extend type ClientUser { | ||
best_friend: ClientUser | ||
@relay_resolver( | ||
fragment_name: "BestFriendFragment" | ||
import_path: "BestFriendResolver" | ||
) | ||
} |
86 changes: 86 additions & 0 deletions
86
compiler/crates/relay-transforms/tests/client_edges/fixtures/nested-path.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,86 @@ | ||
==================================== INPUT ==================================== | ||
fragment Foo_user on ClientUser { | ||
best_friend { | ||
best_friend { | ||
id | ||
} | ||
} | ||
} | ||
|
||
fragment BestFriendFragment on ClientUser { | ||
id | ||
} | ||
|
||
# %extensions% | ||
|
||
type ClientUser { | ||
id: ID | ||
} | ||
|
||
extend type ClientUser { | ||
best_friend: ClientUser | ||
@relay_resolver( | ||
fragment_name: "BestFriendFragment" | ||
import_path: "BestFriendResolver" | ||
) | ||
} | ||
==================================== OUTPUT =================================== | ||
fragment BestFriendFragment on ClientUser { | ||
id | ||
} | ||
|
||
fragment Foo_user on ClientUser { | ||
... @__ClientEdgeMetadataDirective | ||
# ClientObject { | ||
# type_name: Some( | ||
# ObjectName( | ||
# "ClientUser", | ||
# ), | ||
# ), | ||
# unique_id: 1, | ||
# } | ||
{ | ||
...BestFriendFragment @__RelayResolverMetadata | ||
# RelayResolverMetadata { | ||
# field_id: FieldID(518), | ||
# import_path: "BestFriendResolver", | ||
# import_name: None, | ||
# field_alias: None, | ||
# field_path: "best_friend", | ||
# field_arguments: [], | ||
# live: false, | ||
# output_type_info: EdgeTo, | ||
# fragment_data_injection_mode: None, | ||
# } | ||
|
||
best_friend { | ||
... @__ClientEdgeMetadataDirective | ||
# ClientObject { | ||
# type_name: Some( | ||
# ObjectName( | ||
# "ClientUser", | ||
# ), | ||
# ), | ||
# unique_id: 0, | ||
# } | ||
{ | ||
...BestFriendFragment @__RelayResolverMetadata | ||
# RelayResolverMetadata { | ||
# field_id: FieldID(518), | ||
# import_path: "BestFriendResolver", | ||
# import_name: None, | ||
# field_alias: None, | ||
# field_path: "best_friend.best_friend", | ||
# field_arguments: [], | ||
# live: false, | ||
# output_type_info: EdgeTo, | ||
# fragment_data_injection_mode: None, | ||
# } | ||
|
||
best_friend { | ||
id | ||
} | ||
} | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
compiler/crates/relay-transforms/tests/client_edges/fixtures/nested-path.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 @@ | ||
fragment Foo_user on ClientUser { | ||
best_friend { | ||
best_friend { | ||
id | ||
} | ||
} | ||
} | ||
|
||
fragment BestFriendFragment on ClientUser { | ||
id | ||
} | ||
|
||
# %extensions% | ||
|
||
type ClientUser { | ||
id: ID | ||
} | ||
|
||
extend type ClientUser { | ||
best_friend: ClientUser | ||
@relay_resolver( | ||
fragment_name: "BestFriendFragment" | ||
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
6 changes: 3 additions & 3 deletions
6
...ct-relay/__tests__/__generated__/RelayResolverModelTestFieldWithArgumentsQuery.graphql.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
...relay/__tests__/__generated__/RelayResolverModelTestFieldWithRootFragmentQuery.graphql.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
packages/react-relay/__tests__/__generated__/RelayResolverModelTestFragment.graphql.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
...es/react-relay/__tests__/__generated__/RelayResolverModelTestInterfaceFragment.graphql.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.