-
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.
transform to convert fragments and linked fields on abstract types to…
… inline fragment Summary: ## context https://fburl.com/gdoc/3cv4msxz ## this diff Converts selections on fragments and linked fields on abstract types to selections on inline fragments on the concrete type. This is just a starting point, i.e. fragment spreads are tbd. Reviewed By: captbaritone Differential Revision: D52861037 fbshipit-source-id: ff2ec2a3a44f2a6ec25246a52ce130993cb57e77
- Loading branch information
1 parent
396a1db
commit 5718ca9
Showing
8 changed files
with
285 additions
and
5 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
37 changes: 37 additions & 0 deletions
37
...y-transforms/tests/relay_resolvers_abstract_types/fixtures/edge_to_abstract_type.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,37 @@ | ||
==================================== INPUT ==================================== | ||
# relay-resolver-enable-interface-output-type | ||
|
||
query edgeToAbstractTypeQuery { | ||
cat { | ||
description | ||
} | ||
} | ||
|
||
# %extensions% | ||
|
||
interface Cat { | ||
description: String | ||
} | ||
|
||
type Tabby implements Cat { | ||
description: String | ||
} | ||
|
||
type Persian implements Cat { | ||
description: String | ||
} | ||
|
||
extend type Query { | ||
cat: Cat | ||
} | ||
==================================== OUTPUT =================================== | ||
query edgeToAbstractTypeQuery { | ||
cat { | ||
... on Tabby { | ||
description | ||
} | ||
... on Persian { | ||
description | ||
} | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...ay-transforms/tests/relay_resolvers_abstract_types/fixtures/edge_to_abstract_type.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 @@ | ||
# relay-resolver-enable-interface-output-type | ||
|
||
query edgeToAbstractTypeQuery { | ||
cat { | ||
description | ||
} | ||
} | ||
|
||
# %extensions% | ||
|
||
interface Cat { | ||
description: String | ||
} | ||
|
||
type Tabby implements Cat { | ||
description: String | ||
} | ||
|
||
type Persian implements Cat { | ||
description: String | ||
} | ||
|
||
extend type Query { | ||
cat: Cat | ||
} |
30 changes: 30 additions & 0 deletions
30
...rms/tests/relay_resolvers_abstract_types/fixtures/edge_to_abstract_type_disabled.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,30 @@ | ||
==================================== INPUT ==================================== | ||
query edgeToAbstractTypeDisabledQuery { | ||
cat { | ||
description | ||
} | ||
} | ||
|
||
# %extensions% | ||
|
||
interface Cat { | ||
description: String | ||
} | ||
|
||
type Tabby implements Cat { | ||
description: String | ||
} | ||
|
||
type Persian implements Cat { | ||
description: String | ||
} | ||
|
||
extend type Query { | ||
cat: Cat | ||
} | ||
==================================== OUTPUT =================================== | ||
query edgeToAbstractTypeDisabledQuery { | ||
cat { | ||
description | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...orms/tests/relay_resolvers_abstract_types/fixtures/edge_to_abstract_type_disabled.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 edgeToAbstractTypeDisabledQuery { | ||
cat { | ||
description | ||
} | ||
} | ||
|
||
# %extensions% | ||
|
||
interface Cat { | ||
description: String | ||
} | ||
|
||
type Tabby implements Cat { | ||
description: String | ||
} | ||
|
||
type Persian implements Cat { | ||
description: String | ||
} | ||
|
||
extend type Query { | ||
cat: Cat | ||
} |
43 changes: 43 additions & 0 deletions
43
.../tests/relay_resolvers_abstract_types/fixtures/fragment_on_abstract_type_enabled.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,43 @@ | ||
==================================== INPUT ==================================== | ||
# relay-resolver-enable-interface-output-type | ||
|
||
fragment fragmentOnAbstractTypeDisabledFragment on Cat { | ||
description | ||
} | ||
|
||
# %extensions% | ||
|
||
interface Cat { | ||
description: String | ||
} | ||
|
||
type Tabby implements Cat { | ||
description: String | ||
} | ||
|
||
type Persian implements Cat { | ||
description: String | ||
} | ||
|
||
type Siberian implements Cat { | ||
description: String | ||
} | ||
|
||
type Aegean implements Cat { | ||
description: String | ||
} | ||
==================================== OUTPUT =================================== | ||
fragment fragmentOnAbstractTypeDisabledFragment on Cat { | ||
... on Tabby { | ||
description | ||
} | ||
... on Persian { | ||
description | ||
} | ||
... on Siberian { | ||
description | ||
} | ||
... on Aegean { | ||
description | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
...s/tests/relay_resolvers_abstract_types/fixtures/fragment_on_abstract_type_enabled.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 @@ | ||
# relay-resolver-enable-interface-output-type | ||
|
||
fragment fragmentOnAbstractTypeDisabledFragment on Cat { | ||
description | ||
} | ||
|
||
# %extensions% | ||
|
||
interface Cat { | ||
description: String | ||
} | ||
|
||
type Tabby implements Cat { | ||
description: String | ||
} | ||
|
||
type Persian implements Cat { | ||
description: String | ||
} | ||
|
||
type Siberian implements Cat { | ||
description: String | ||
} | ||
|
||
type Aegean implements Cat { | ||
description: String | ||
} |
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