-
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.
Reviewed By: tyao1 Differential Revision: D58212880 fbshipit-source-id: 074ad6ba8396d327095ae86ee405851cb46a5b6f
- Loading branch information
1 parent
dd9d3a0
commit 868183c
Showing
12 changed files
with
255 additions
and
15 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
51 changes: 51 additions & 0 deletions
51
...s/tests/fragment_alias_directive/fixtures/alias_not_required_on_module_fragments.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,51 @@ | ||
==================================== INPUT ==================================== | ||
fragment NameRendererFragment on User { | ||
id | ||
nameRenderer @match { | ||
...PlainUserNameRenderer_name @module(name: "PlainUserNameRenderer.react") | ||
...MarkdownUserNameRenderer_name | ||
@module(name: "MarkdownUserNameRenderer.react") | ||
} | ||
plainNameRenderer: nameRenderer @match { | ||
...PlainUserNameRenderer_name @module(name: "PlainUserNameRenderer.react") | ||
} | ||
} | ||
|
||
fragment PlainUserNameRenderer_name on PlainUserNameRenderer { | ||
plaintext | ||
data { | ||
text | ||
} | ||
} | ||
|
||
fragment MarkdownUserNameRenderer_name on MarkdownUserNameRenderer { | ||
markdown | ||
data { | ||
markup | ||
} | ||
} | ||
==================================== OUTPUT =================================== | ||
fragment MarkdownUserNameRenderer_name on MarkdownUserNameRenderer { | ||
markdown | ||
data { | ||
markup | ||
} | ||
} | ||
|
||
fragment NameRendererFragment on User { | ||
id | ||
nameRenderer @match { | ||
...PlainUserNameRenderer_name @module(name: "PlainUserNameRenderer.react") | ||
...MarkdownUserNameRenderer_name @module(name: "MarkdownUserNameRenderer.react") | ||
} | ||
plainNameRenderer: nameRenderer @match { | ||
...PlainUserNameRenderer_name @module(name: "PlainUserNameRenderer.react") | ||
} | ||
} | ||
|
||
fragment PlainUserNameRenderer_name on PlainUserNameRenderer { | ||
plaintext | ||
data { | ||
text | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...ms/tests/fragment_alias_directive/fixtures/alias_not_required_on_module_fragments.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 NameRendererFragment on User { | ||
id | ||
nameRenderer @match { | ||
...PlainUserNameRenderer_name @module(name: "PlainUserNameRenderer.react") | ||
...MarkdownUserNameRenderer_name | ||
@module(name: "MarkdownUserNameRenderer.react") | ||
} | ||
plainNameRenderer: nameRenderer @match { | ||
...PlainUserNameRenderer_name @module(name: "PlainUserNameRenderer.react") | ||
} | ||
} | ||
|
||
fragment PlainUserNameRenderer_name on PlainUserNameRenderer { | ||
plaintext | ||
data { | ||
text | ||
} | ||
} | ||
|
||
fragment MarkdownUserNameRenderer_name on MarkdownUserNameRenderer { | ||
markdown | ||
data { | ||
markup | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...ias_directive/fixtures/alias_not_required_within_aliased_refined_inline_fragment.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,36 @@ | ||
==================================== INPUT ==================================== | ||
fragment RelayReaderNamedFragmentsTest_user on User { | ||
name | ||
} | ||
|
||
query RelayReaderNamedFragmentsTest2Query { | ||
node { | ||
... on User @alias { | ||
...RelayReaderNamedFragmentsTest_user | ||
} | ||
} | ||
} | ||
==================================== OUTPUT =================================== | ||
query RelayReaderNamedFragmentsTest2Query { | ||
node { | ||
... on User @alias @__FragmentAliasMetadata | ||
# FragmentAliasMetadata { | ||
# alias: WithLocation { | ||
# location: alias_not_required_within_aliased_refined_inline_fragment.graphql:133:139, | ||
# item: "User", | ||
# }, | ||
# type_condition: Some( | ||
# Object(70), | ||
# ), | ||
# non_nullable: false, | ||
# selection_type: Object(70), | ||
# } | ||
{ | ||
...RelayReaderNamedFragmentsTest_user | ||
} | ||
} | ||
} | ||
|
||
fragment RelayReaderNamedFragmentsTest_user on User { | ||
name | ||
} |
11 changes: 11 additions & 0 deletions
11
...lias_directive/fixtures/alias_not_required_within_aliased_refined_inline_fragment.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,11 @@ | ||
fragment RelayReaderNamedFragmentsTest_user on User { | ||
name | ||
} | ||
|
||
query RelayReaderNamedFragmentsTest2Query { | ||
node { | ||
... on User @alias { | ||
...RelayReaderNamedFragmentsTest_user | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...t_alias_directive/fixtures/alias_required_within_refined_inline_fragment.invalid.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,24 @@ | ||
==================================== INPUT ==================================== | ||
# expected-to-throw | ||
fragment RelayReaderNamedFragmentsTest_user on User { | ||
name | ||
} | ||
|
||
query RelayReaderNamedFragmentsTest2Query { | ||
node { | ||
# Relay is not reliable in modeling this as a discriminated union in its | ||
# typescript/flow types. To be safe we need the user to supply an alias. | ||
... on User { | ||
# This might not match! | ||
...RelayReaderNamedFragmentsTest_user | ||
} | ||
} | ||
} | ||
==================================== ERROR ==================================== | ||
✖︎ Expected `@alias` directive. `RelayReaderNamedFragmentsTest_user` is defined on `User` which might not match this selection type of `Node`. Add `@alias` to this spread to expose the fragment reference as a nullable property. NOTE: The selection type inferred here does not include inline fragments because Relay does not always model inline fragment type refinements in its generated types. | ||
|
||
alias_required_within_refined_inline_fragment.invalid.graphql:12:10 | ||
11 │ # This might not match! | ||
12 │ ...RelayReaderNamedFragmentsTest_user | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
13 │ } |
15 changes: 15 additions & 0 deletions
15
...nt_alias_directive/fixtures/alias_required_within_refined_inline_fragment.invalid.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,15 @@ | ||
# expected-to-throw | ||
fragment RelayReaderNamedFragmentsTest_user on User { | ||
name | ||
} | ||
|
||
query RelayReaderNamedFragmentsTest2Query { | ||
node { | ||
# Relay is not reliable in modeling this as a discriminated union in its | ||
# typescript/flow types. To be safe we need the user to supply an alias. | ||
... on User { | ||
# This might not match! | ||
...RelayReaderNamedFragmentsTest_user | ||
} | ||
} | ||
} |
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
Oops, something went wrong.