-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'apply-rename-transformer' into add-deferred-executions-…
…to-rename-transform
- Loading branch information
Showing
8 changed files
with
310 additions
and
4 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...tures/defer/DeferredFieldIsRenamedTest.kt → .../transforms/DeferredFieldIsRenamedTest.kt
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
2 changes: 1 addition & 1 deletion
2
...fer/DeferredFieldIsRenamedTestSnapshot.kt → ...rms/DeferredFieldIsRenamedTestSnapshot.kt
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
77 changes: 77 additions & 0 deletions
77
.../nadel/tests/next/fixtures/defer/transforms/MultipleRenamedFieldsAreDeferredSeparately.kt
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,77 @@ | ||
package graphql.nadel.tests.next.fixtures.defer.transforms | ||
|
||
import graphql.nadel.NadelExecutionHints | ||
import graphql.nadel.tests.next.NadelIntegrationTest | ||
|
||
open class MultipleRenamedFieldsAreDeferredSeparately : NadelIntegrationTest( | ||
query = """ | ||
query { | ||
defer { | ||
hello | ||
...@defer(label: "defer1") { | ||
overallString | ||
} | ||
...@defer(label: "defer2") { | ||
overallString | ||
} | ||
} | ||
} | ||
""".trimIndent(), | ||
services = listOf( | ||
Service( | ||
name = "defer", | ||
overallSchema = """ | ||
directive @defer(if: Boolean, label: String) on FRAGMENT_SPREAD | INLINE_FRAGMENT | ||
|
||
type Query { | ||
defer: DeferApi | ||
} | ||
type DeferApi { | ||
hello: String | ||
overallString: String @renamed(from: "underlyingString") | ||
overallString2: String @renamed(from: "underlyingString2") | ||
} | ||
|
||
""".trimIndent(), | ||
underlyingSchema = """ | ||
directive @defer(if: Boolean, label: String) on FRAGMENT_SPREAD | INLINE_FRAGMENT | ||
|
||
type Query { | ||
defer: DeferApi | ||
} | ||
type DeferApi { | ||
hello: String | ||
underlyingString: String | ||
underlyingString2: String | ||
} | ||
|
||
""".trimIndent(), | ||
runtimeWiring = { wiring -> | ||
wiring | ||
.type("Query") { type -> | ||
type | ||
.dataFetcher("defer") { env -> | ||
Any() | ||
} | ||
} | ||
.type("DeferApi") { type -> | ||
type | ||
.dataFetcher("hello") { env -> | ||
"hello there" | ||
} | ||
.dataFetcher("underlyingString") { env -> | ||
"deferred string 1" | ||
} | ||
.dataFetcher("underlyingString2") { env -> | ||
"deferred string 2" | ||
} | ||
} | ||
}, | ||
), | ||
), | ||
) { | ||
override fun makeExecutionHints(): NadelExecutionHints.Builder { | ||
return super.makeExecutionHints() | ||
.deferSupport { true } | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
...ests/next/fixtures/defer/transforms/MultipleRenamedFieldsAreDeferredSeparatelySnapshot.kt
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,74 @@ | ||
// @formatter:off | ||
package graphql.nadel.tests.next.fixtures.defer.transforms | ||
|
||
import graphql.nadel.tests.next.ExpectedNadelResult | ||
import graphql.nadel.tests.next.ExpectedServiceCall | ||
import graphql.nadel.tests.next.TestSnapshot | ||
import graphql.nadel.tests.next.listOfJsonStrings | ||
import kotlin.Suppress | ||
import kotlin.collections.List | ||
import kotlin.collections.listOf | ||
|
||
/** | ||
* This class is generated. Do NOT modify. | ||
* | ||
* Refer to [graphql.nadel.tests.next.UpdateTestSnapshots | ||
*/ | ||
@Suppress("unused") | ||
public class MultipleRenamedFieldsAreDeferredSeparatelySnapshot : TestSnapshot() { | ||
override val calls: List<ExpectedServiceCall> = listOf( | ||
ExpectedServiceCall( | ||
service = "defer", | ||
query = """ | ||
| { | ||
| defer { | ||
| hello | ||
| rename__overallString__underlyingString: underlyingString | ||
| __typename__rename__overallString: __typename | ||
| } | ||
| } | ||
""".trimMargin(), | ||
variables = "{}", | ||
result = """ | ||
| { | ||
| "data": { | ||
| "defer": { | ||
| "hello": "hello there", | ||
| "rename__overallString__underlyingString": "deferred string 1", | ||
| "__typename__rename__overallString": "DeferApi" | ||
| } | ||
| } | ||
| } | ||
""".trimMargin(), | ||
delayedResults = listOfJsonStrings( | ||
), | ||
), | ||
) | ||
|
||
/** | ||
* ```json | ||
* { | ||
* "data": { | ||
* "defer": { | ||
* "hello": "hello there", | ||
* "overallString": "deferred string 1" | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
override val result: ExpectedNadelResult = ExpectedNadelResult( | ||
result = """ | ||
| { | ||
| "data": { | ||
| "defer": { | ||
| "hello": "hello there", | ||
| "overallString": "deferred string 1" | ||
| } | ||
| } | ||
| } | ||
""".trimMargin(), | ||
delayedResults = listOfJsonStrings( | ||
), | ||
) | ||
} |
75 changes: 75 additions & 0 deletions
75
...ql/nadel/tests/next/fixtures/defer/transforms/MultipleRenamedFieldsAreDeferredTogether.kt
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,75 @@ | ||
package graphql.nadel.tests.next.fixtures.defer.transforms | ||
|
||
import graphql.nadel.NadelExecutionHints | ||
import graphql.nadel.tests.next.NadelIntegrationTest | ||
|
||
open class MultipleRenamedFieldsAreDeferredTogether : NadelIntegrationTest( | ||
query = """ | ||
query { | ||
defer { | ||
hello | ||
...@defer { | ||
overallString | ||
overallString2 | ||
} | ||
} | ||
} | ||
""".trimIndent(), | ||
services = listOf( | ||
Service( | ||
name = "defer", | ||
overallSchema = """ | ||
directive @defer(if: Boolean, label: String) on FRAGMENT_SPREAD | INLINE_FRAGMENT | ||
|
||
type Query { | ||
defer: DeferApi | ||
} | ||
type DeferApi { | ||
hello: String | ||
overallString: String @renamed(from: "underlyingString") | ||
overallString2: String @renamed(from: "underlyingString2") | ||
} | ||
|
||
""".trimIndent(), | ||
underlyingSchema = """ | ||
directive @defer(if: Boolean, label: String) on FRAGMENT_SPREAD | INLINE_FRAGMENT | ||
|
||
type Query { | ||
defer: DeferApi | ||
} | ||
type DeferApi { | ||
hello: String | ||
underlyingString: String | ||
underlyingString2: String | ||
} | ||
|
||
""".trimIndent(), | ||
runtimeWiring = { wiring -> | ||
wiring | ||
.type("Query") { type -> | ||
type | ||
.dataFetcher("defer") { env -> | ||
Any() | ||
} | ||
} | ||
.type("DeferApi") { type -> | ||
type | ||
.dataFetcher("hello") { env -> | ||
"hello there" | ||
} | ||
.dataFetcher("underlyingString") { env -> | ||
"deferred string 1" | ||
} | ||
.dataFetcher("underlyingString2") { env -> | ||
"deferred string 2" | ||
} | ||
} | ||
}, | ||
), | ||
), | ||
) { | ||
override fun makeExecutionHints(): NadelExecutionHints.Builder { | ||
return super.makeExecutionHints() | ||
.deferSupport { true } | ||
} | ||
} |
80 changes: 80 additions & 0 deletions
80
.../tests/next/fixtures/defer/transforms/MultipleRenamedFieldsAreDeferredTogetherSnapshot.kt
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,80 @@ | ||
// @formatter:off | ||
package graphql.nadel.tests.next.fixtures.defer.transforms | ||
|
||
import graphql.nadel.tests.next.ExpectedNadelResult | ||
import graphql.nadel.tests.next.ExpectedServiceCall | ||
import graphql.nadel.tests.next.TestSnapshot | ||
import graphql.nadel.tests.next.listOfJsonStrings | ||
import kotlin.Suppress | ||
import kotlin.collections.List | ||
import kotlin.collections.listOf | ||
|
||
/** | ||
* This class is generated. Do NOT modify. | ||
* | ||
* Refer to [graphql.nadel.tests.next.UpdateTestSnapshots | ||
*/ | ||
@Suppress("unused") | ||
public class MultipleRenamedFieldsAreDeferredTogetherSnapshot : TestSnapshot() { | ||
override val calls: List<ExpectedServiceCall> = listOf( | ||
ExpectedServiceCall( | ||
service = "defer", | ||
query = """ | ||
| { | ||
| defer { | ||
| hello | ||
| rename__overallString__underlyingString: underlyingString | ||
| __typename__rename__overallString: __typename | ||
| rename__overallString2__underlyingString2: underlyingString2 | ||
| __typename__rename__overallString2: __typename | ||
| } | ||
| } | ||
""".trimMargin(), | ||
variables = "{}", | ||
result = """ | ||
| { | ||
| "data": { | ||
| "defer": { | ||
| "hello": "hello there", | ||
| "rename__overallString__underlyingString": "deferred string 1", | ||
| "__typename__rename__overallString": "DeferApi", | ||
| "rename__overallString2__underlyingString2": "deferred string 2", | ||
| "__typename__rename__overallString2": "DeferApi" | ||
| } | ||
| } | ||
| } | ||
""".trimMargin(), | ||
delayedResults = listOfJsonStrings( | ||
), | ||
), | ||
) | ||
|
||
/** | ||
* ```json | ||
* { | ||
* "data": { | ||
* "defer": { | ||
* "hello": "hello there", | ||
* "overallString": "deferred string 1", | ||
* "overallString2": "deferred string 2" | ||
* } | ||
* } | ||
* } | ||
* ``` | ||
*/ | ||
override val result: ExpectedNadelResult = ExpectedNadelResult( | ||
result = """ | ||
| { | ||
| "data": { | ||
| "defer": { | ||
| "hello": "hello there", | ||
| "overallString": "deferred string 1", | ||
| "overallString2": "deferred string 2" | ||
| } | ||
| } | ||
| } | ||
""".trimMargin(), | ||
delayedResults = listOfJsonStrings( | ||
), | ||
) | ||
} |
2 changes: 1 addition & 1 deletion
2
...gDeferButNonDeferredFieldIsRenamedTest.kt → ...gDeferButNonDeferredFieldIsRenamedTest.kt
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
2 changes: 1 addition & 1 deletion
2
...tNonDeferredFieldIsRenamedTestSnapshot.kt → ...tNonDeferredFieldIsRenamedTestSnapshot.kt
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