diff --git a/lib/src/main/java/graphql/nadel/NadelExecutionHints.kt b/lib/src/main/java/graphql/nadel/NadelExecutionHints.kt index d1a294f26..83c89375e 100644 --- a/lib/src/main/java/graphql/nadel/NadelExecutionHints.kt +++ b/lib/src/main/java/graphql/nadel/NadelExecutionHints.kt @@ -12,7 +12,6 @@ import graphql.nadel.hints.NadelNoInterfaceToObjectFragmentExpansionHint import graphql.nadel.hints.NadelReachableUnderlyingServiceTypesHint import graphql.nadel.hints.NadelShadowUnderlyingTypeNameInvestigation import graphql.nadel.hints.NadelSharedTypeRenamesHint -import graphql.nadel.hints.NadelShortCircuitEmptyQueryHint import graphql.nadel.hints.NadelVirtualTypeSupportHint data class NadelExecutionHints( @@ -20,7 +19,6 @@ data class NadelExecutionHints( val allDocumentVariablesHint: AllDocumentVariablesHint, val deferSupport: NadelDeferSupportHint, val sharedTypeRenames: NadelSharedTypeRenamesHint, - val shortCircuitEmptyQuery: NadelShortCircuitEmptyQueryHint, val virtualTypeSupport: NadelVirtualTypeSupportHint, val executeOnEngineSchema: NadelExecuteOnEngineSchemaHint, val hydrationFilterObjectTypes: NadelHydrationFilterObjectTypesHint, @@ -45,7 +43,6 @@ data class NadelExecutionHints( private var legacyOperationNames = LegacyOperationNamesHint { false } private var allDocumentVariablesHint = AllDocumentVariablesHint { false } private var deferSupport = NadelDeferSupportHint { false } - private var shortCircuitEmptyQuery = NadelShortCircuitEmptyQueryHint { false } private var sharedTypeRenames = NadelSharedTypeRenamesHint { false } private var virtualTypeSupport = NadelVirtualTypeSupportHint { false } private var executeOnEngineSchema = NadelExecuteOnEngineSchemaHint { false } @@ -63,7 +60,6 @@ data class NadelExecutionHints( legacyOperationNames = nadelExecutionHints.legacyOperationNames allDocumentVariablesHint = nadelExecutionHints.allDocumentVariablesHint deferSupport = nadelExecutionHints.deferSupport - shortCircuitEmptyQuery = nadelExecutionHints.shortCircuitEmptyQuery sharedTypeRenames = nadelExecutionHints.sharedTypeRenames virtualTypeSupport = nadelExecutionHints.virtualTypeSupport executeOnEngineSchema = nadelExecutionHints.executeOnEngineSchema @@ -91,11 +87,6 @@ data class NadelExecutionHints( return this } - fun shortCircuitEmptyQuery(flag: NadelShortCircuitEmptyQueryHint): Builder { - shortCircuitEmptyQuery = flag - return this - } - fun sharedTypeRenames(flag: NadelSharedTypeRenamesHint): Builder { sharedTypeRenames = flag return this @@ -152,7 +143,6 @@ data class NadelExecutionHints( allDocumentVariablesHint, deferSupport, sharedTypeRenames, - shortCircuitEmptyQuery, virtualTypeSupport, executeOnEngineSchema, hydrationFilterObjectTypes, diff --git a/lib/src/main/java/graphql/nadel/NextgenEngine.kt b/lib/src/main/java/graphql/nadel/NextgenEngine.kt index 2b33de980..1de915663 100644 --- a/lib/src/main/java/graphql/nadel/NextgenEngine.kt +++ b/lib/src/main/java/graphql/nadel/NextgenEngine.kt @@ -26,6 +26,7 @@ import graphql.nadel.engine.transform.query.DynamicServiceResolution import graphql.nadel.engine.transform.query.NadelFieldToService import graphql.nadel.engine.transform.query.NadelQueryTransformer import graphql.nadel.engine.transform.result.NadelResultTransformer +import graphql.nadel.engine.transform.skipInclude.NadelSkipIncludeTransform.Companion.isSkipIncludeArtificialField import graphql.nadel.engine.util.MutableJsonMap import graphql.nadel.engine.util.beginExecute import graphql.nadel.engine.util.compileToDocument @@ -411,7 +412,7 @@ internal class NextgenEngine( .firstOrNull() ?: topLevelFields.first(), ) - val serviceExecution = getServiceExecution(service, topLevelFields, executionContext.hints) + val serviceExecution = getServiceExecution(service, topLevelFields) val serviceExecResult = try { serviceExecution.execute(serviceExecParams) .asDeferred() @@ -469,13 +470,12 @@ internal class NextgenEngine( private fun getServiceExecution( service: Service, topLevelFields: List, - hints: NadelExecutionHints, ): ServiceExecution { - if (hints.shortCircuitEmptyQuery(service) && isOnlyTopLevelFieldTypename(topLevelFields, service)) { - return engineSchemaIntrospectionService.serviceExecution + return if (isOnlyTopLevelFieldTypename(topLevelFields, service)) { + engineSchemaIntrospectionService.serviceExecution + } else { + service.serviceExecution } - - return service.serviceExecution } private fun isOnlyTopLevelFieldTypename( @@ -491,6 +491,7 @@ internal class NextgenEngine( return isNamespacedFieldLike(service, topLevelField) && topLevelField.hasChildren() && topLevelField.children.all { it.name == TypeNameMetaFieldDef.name } + && topLevelField.children.none(::isSkipIncludeArtificialField) } private fun getDocumentVariablePredicate(hints: NadelExecutionHints, service: Service): VariablePredicate { diff --git a/lib/src/main/java/graphql/nadel/engine/transform/skipInclude/NadelSkipIncludeTransform.kt b/lib/src/main/java/graphql/nadel/engine/transform/skipInclude/NadelSkipIncludeTransform.kt index 7ff909a55..6ce3c6694 100644 --- a/lib/src/main/java/graphql/nadel/engine/transform/skipInclude/NadelSkipIncludeTransform.kt +++ b/lib/src/main/java/graphql/nadel/engine/transform/skipInclude/NadelSkipIncludeTransform.kt @@ -38,10 +38,16 @@ import graphql.schema.GraphQLSchema internal class NadelSkipIncludeTransform : NadelTransform { companion object { private const val skipFieldName = "__skip" + private const val skipIncludeTag = "skip_include" fun isSkipIncludeSpecialField(enf: ExecutableNormalizedField): Boolean { return enf.name == skipFieldName } + + fun isSkipIncludeArtificialField(enf: ExecutableNormalizedField): Boolean { + return enf.name == Introspection.TypeNameMetaFieldDef.name + && enf.resultKey == "${Introspection.TypeNameMetaFieldDef.name}__${skipIncludeTag}__${skipFieldName}" + } } class State( @@ -81,7 +87,7 @@ internal class NadelSkipIncludeTransform : NadelTransform { return if (overallField.name == skipFieldName) { State( aliasHelper = NadelAliasHelper.forField( - tag = "skip_include", + tag = skipIncludeTag, field = overallField, ), ) diff --git a/lib/src/main/java/graphql/nadel/hints/NadelShortCircuitEmptyQueryHint.kt b/lib/src/main/java/graphql/nadel/hints/NadelShortCircuitEmptyQueryHint.kt deleted file mode 100644 index 2bcd94830..000000000 --- a/lib/src/main/java/graphql/nadel/hints/NadelShortCircuitEmptyQueryHint.kt +++ /dev/null @@ -1,14 +0,0 @@ -package graphql.nadel.hints - -import graphql.nadel.Service - -fun interface NadelShortCircuitEmptyQueryHint { - /** - * Determines whether empty queries containing only top level __typename fields should be short-circuited without - * calling the underlying service and executed on the internal introspection service - * - * @param service the service we are sending the query to - * @return true to execute the query on the internal introspection service - */ - operator fun invoke(service: Service): Boolean -} diff --git a/test/src/test/kotlin/graphql/nadel/tests/hooks/remove-fields.kt b/test/src/test/kotlin/graphql/nadel/tests/hooks/remove-fields.kt index 1b319f4df..d46db40a8 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/hooks/remove-fields.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/hooks/remove-fields.kt @@ -3,7 +3,6 @@ package graphql.nadel.tests.hooks import graphql.ErrorClassification import graphql.GraphQLError import graphql.nadel.Nadel -import graphql.nadel.NadelExecutionHints import graphql.nadel.hooks.NadelExecutionHooks import graphql.nadel.tests.EngineTestHook import graphql.nadel.tests.UseHook @@ -98,61 +97,46 @@ class `one-of-top-level-fields-is-removed` : EngineTestHook { @UseHook class `top-level-field-is-removed` : EngineTestHook { override val customTransforms = listOf(RemoveFieldTestTransform()) - override fun makeExecutionHints(builder: NadelExecutionHints.Builder) = builder.shortCircuitEmptyQuery { true } } @UseHook class `top-level-field-is-removed-for-a-subscription` : EngineTestHook { override val customTransforms = listOf(RemoveFieldTestTransform()) - override fun makeExecutionHints(builder: NadelExecutionHints.Builder) = builder.shortCircuitEmptyQuery { true } } @UseHook class `top-level-field-is-removed-for-a-subscription-with-namespaced-field` : EngineTestHook { override val customTransforms = listOf(RemoveFieldTestTransform()) - override fun makeExecutionHints(builder: NadelExecutionHints.Builder) = builder.shortCircuitEmptyQuery { true } -} - -@UseHook -class `top-level-field-is-removed-hint-is-off` : EngineTestHook { - override val customTransforms = listOf(RemoveFieldTestTransform()) - override fun makeExecutionHints(builder: NadelExecutionHints.Builder) = builder.shortCircuitEmptyQuery { false } } @UseHook class `hydration-top-level-field-is-removed` : EngineTestHook { override val customTransforms = listOf(RemoveFieldTestTransform()) - override fun makeExecutionHints(builder: NadelExecutionHints.Builder) = builder.shortCircuitEmptyQuery { true } } @UseHook class `namespaced-hydration-top-level-field-is-removed` : EngineTestHook { override val customTransforms = listOf(RemoveFieldTestTransform()) - override fun makeExecutionHints(builder: NadelExecutionHints.Builder) = builder.shortCircuitEmptyQuery { true } } @UseHook class `hidden-namespaced-hydration-top-level-field-is-removed` : EngineTestHook { override val customTransforms = listOf(RemoveFieldTestTransform()) - override fun makeExecutionHints(builder: NadelExecutionHints.Builder) = builder.shortCircuitEmptyQuery { true } } @UseHook class `namespaced-field-is-removed` : EngineTestHook { override val customTransforms = listOf(RemoveFieldTestTransform()) - override fun makeExecutionHints(builder: NadelExecutionHints.Builder) = builder.shortCircuitEmptyQuery { true } } @UseHook class `namespaced-field-is-removed-with-renames` : EngineTestHook { override val customTransforms = listOf(RemoveFieldTestTransform()) - override fun makeExecutionHints(builder: NadelExecutionHints.Builder) = builder.shortCircuitEmptyQuery { true } } @UseHook class `renamed-top-level-field-is-not-removed-short-circuit-hint-is-on` : EngineTestHook { override val customTransforms = listOf(RemoveFieldTestTransform()) - override fun makeExecutionHints(builder: NadelExecutionHints.Builder) = builder.shortCircuitEmptyQuery { true } } // @UseHook diff --git a/test/src/test/kotlin/graphql/nadel/tests/legacy/field removed/top level field is removed hint is off snapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/legacy/field removed/top level field is removed hint is off snapshot.kt deleted file mode 100644 index 4ff483c3e..000000000 --- a/test/src/test/kotlin/graphql/nadel/tests/legacy/field removed/top level field is removed hint is off snapshot.kt +++ /dev/null @@ -1,82 +0,0 @@ -// @formatter:off -package graphql.nadel.tests.legacy.`field removed` - -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 - -private suspend fun main() { - graphql.nadel.tests.next.update<`top level field is removed hint is off`>() -} - -/** - * This class is generated. Do NOT modify. - * - * Refer to [graphql.nadel.tests.next.UpdateTestSnapshots - */ -@Suppress("unused") -public class `top level field is removed hint is off snapshot` : TestSnapshot() { - override val calls: List = listOf( - ExpectedServiceCall( - service = "CommentService", - query = """ - | { - | uuid_typename: __typename - | } - """.trimMargin(), - variables = "{}", - result = """ - | { - | "data": { - | "uuid_typename": "Query" - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), - ) - - /** - * ```json - * { - * "errors": [ - * { - * "message": "field `Query.commentById` has been removed by RemoveFieldTestTransform", - * "locations": [], - * "extensions": { - * "classification": "DataFetchingException" - * } - * } - * ], - * "data": { - * "commentById": null - * } - * } - * ``` - */ - override val result: ExpectedNadelResult = ExpectedNadelResult( - result = """ - | { - | "errors": [ - | { - | "message": "field `Query.commentById` has been removed by RemoveFieldTestTransform", - | "locations": [], - | "extensions": { - | "classification": "DataFetchingException" - | } - | } - | ], - | "data": { - | "commentById": null - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ) -} diff --git a/test/src/test/kotlin/graphql/nadel/tests/legacy/field removed/top level field is removed hint is off.kt b/test/src/test/kotlin/graphql/nadel/tests/legacy/field removed/top level field is removed hint is off.kt deleted file mode 100644 index 84ef838a7..000000000 --- a/test/src/test/kotlin/graphql/nadel/tests/legacy/field removed/top level field is removed hint is off.kt +++ /dev/null @@ -1,47 +0,0 @@ -package graphql.nadel.tests.legacy.`field removed` - -import graphql.nadel.tests.legacy.NadelLegacyIntegrationTest - -class `top level field is removed hint is off` : NadelLegacyIntegrationTest( - query = """ - query { - commentById(id: "C1") { - id - } - } - """.trimIndent(), - variables = emptyMap(), - services = listOf( - Service( - name = "CommentService", - overallSchema = """ - directive @toBeDeleted on FIELD_DEFINITION - type Query { - commentById(id: ID): Comment @toBeDeleted - } - type Comment { - id: ID - } - """.trimIndent(), - underlyingSchema = """ - type Query { - commentById(id: ID): Comment - } - type Comment { - id: ID - } - """.trimIndent(), - runtimeWiring = { wiring -> - wiring.type("Query") { type -> - type.dataFetcher("__typename") { env -> - "Query" - } - } - }, - ), - ), -) { - private data class CommentService_Comment( - val id: String? = null, - ) -} diff --git a/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static arg boolean snapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static arg boolean snapshot.kt index d04e676f9..22ab2a278 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static arg boolean snapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static arg boolean snapshot.kt @@ -21,28 +21,6 @@ private suspend fun main() { @Suppress("unused") public class `basic hydration with static arg boolean snapshot` : TestSnapshot() { override val calls: List = listOf( - ExpectedServiceCall( - service = "service1", - query = """ - | { - | foo { - | __typename__hydration__bar: __typename - | } - | } - """.trimMargin(), - variables = "{}", - result = """ - | { - | "data": { - | "foo": { - | "__typename__hydration__bar": "Foo" - | } - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), ExpectedServiceCall( service = "service2", query = """ diff --git a/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static arg float snapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static arg float snapshot.kt index 829b0f49a..cc89362a1 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static arg float snapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static arg float snapshot.kt @@ -21,28 +21,6 @@ private suspend fun main() { @Suppress("unused") public class `basic hydration with static arg float snapshot` : TestSnapshot() { override val calls: List = listOf( - ExpectedServiceCall( - service = "service1", - query = """ - | { - | foo { - | __typename__hydration__bar: __typename - | } - | } - """.trimMargin(), - variables = "{}", - result = """ - | { - | "data": { - | "foo": { - | "__typename__hydration__bar": "Foo" - | } - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), ExpectedServiceCall( service = "service2", query = """ diff --git a/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static arg integer snapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static arg integer snapshot.kt index a80ebb32d..42f70d9fd 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static arg integer snapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static arg integer snapshot.kt @@ -21,28 +21,6 @@ private suspend fun main() { @Suppress("unused") public class `basic hydration with static arg integer snapshot` : TestSnapshot() { override val calls: List = listOf( - ExpectedServiceCall( - service = "service1", - query = """ - | { - | foo { - | __typename__hydration__bar: __typename - | } - | } - """.trimMargin(), - variables = "{}", - result = """ - | { - | "data": { - | "foo": { - | "__typename__hydration__bar": "Foo" - | } - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), ExpectedServiceCall( service = "service2", query = """ diff --git a/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static args snapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static args snapshot.kt index 19922fe35..6041bcd24 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static args snapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/legacy/new hydration/basic hydration with static args snapshot.kt @@ -21,28 +21,6 @@ private suspend fun main() { @Suppress("unused") public class `basic hydration with static args snapshot` : TestSnapshot() { override val calls: List = listOf( - ExpectedServiceCall( - service = "service1", - query = """ - | { - | foo { - | __typename__hydration__bar: __typename - | } - | } - """.trimMargin(), - variables = "{}", - result = """ - | { - | "data": { - | "foo": { - | "__typename__hydration__bar": "Foo" - | } - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), ExpectedServiceCall( service = "service2", query = """ diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/HydrationRemainingArgumentsTest.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/HydrationRemainingArgumentsTest.kt index 149ebbd32..eaded5eeb 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/HydrationRemainingArgumentsTest.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/HydrationRemainingArgumentsTest.kt @@ -174,6 +174,5 @@ class HydrationRemainingArgumentsTest : NadelIntegrationTest( override fun makeExecutionHints(): NadelExecutionHints.Builder { return super.makeExecutionHints() .virtualTypeSupport { true } - .shortCircuitEmptyQuery { true } } } diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationAndPolymorphicHydrationTest.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationAndPolymorphicHydrationTest.kt index 750cf1c42..70771a9bd 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationAndPolymorphicHydrationTest.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationAndPolymorphicHydrationTest.kt @@ -263,7 +263,6 @@ class StaticHydrationAndPolymorphicHydrationTest : NadelIntegrationTest( override fun makeExecutionHints(): NadelExecutionHints.Builder { return super.makeExecutionHints() .virtualTypeSupport { true } - .shortCircuitEmptyQuery { true } } override fun makeNadel(): Nadel.Builder { diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationNestedErrorTest.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationNestedErrorTest.kt index c3fb0cbe5..70735be64 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationNestedErrorTest.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationNestedErrorTest.kt @@ -211,7 +211,6 @@ class StaticHydrationNestedErrorTest : NadelIntegrationTest( override fun makeExecutionHints(): NadelExecutionHints.Builder { return super.makeExecutionHints() .virtualTypeSupport { true } - .shortCircuitEmptyQuery { true } } override fun makeNadel(): Nadel.Builder { diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationOverlappingHydrationTest.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationOverlappingHydrationTest.kt index 9d34da822..30d0e6c93 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationOverlappingHydrationTest.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationOverlappingHydrationTest.kt @@ -258,7 +258,6 @@ class StaticHydrationOverlappingHydrationTest : NadelIntegrationTest( override fun makeExecutionHints(): NadelExecutionHints.Builder { return super.makeExecutionHints() .virtualTypeSupport { true } - .shortCircuitEmptyQuery { true } } override fun makeNadel(): Nadel.Builder { diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationScalarFieldTest.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationScalarFieldTest.kt index e69df66fe..aabab16b0 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationScalarFieldTest.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationScalarFieldTest.kt @@ -68,6 +68,5 @@ class StaticHydrationScalarFieldTest : NadelIntegrationTest( override fun makeExecutionHints(): NadelExecutionHints.Builder { return super.makeExecutionHints() .virtualTypeSupport { true } - .shortCircuitEmptyQuery { true } } } diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationTest.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationTest.kt index 9462784f6..2edf6a206 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationTest.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationTest.kt @@ -200,6 +200,5 @@ class StaticHydrationTest : NadelIntegrationTest( override fun makeExecutionHints(): NadelExecutionHints.Builder { return super.makeExecutionHints() .virtualTypeSupport { true } - .shortCircuitEmptyQuery { true } } } diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationVirtualTypeHintOffTest.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationVirtualTypeHintOffTest.kt index 1794e0fd9..e4f6f7a01 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationVirtualTypeHintOffTest.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/hydration/statics/StaticHydrationVirtualTypeHintOffTest.kt @@ -197,6 +197,5 @@ class StaticHydrationVirtualTypeHintOffTest : NadelIntegrationTest( override fun makeExecutionHints(): NadelExecutionHints.Builder { return super.makeExecutionHints() .virtualTypeSupport { false } - .shortCircuitEmptyQuery { true } } } diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/introspection/NamespaceLikeShortCircuitsIntrospectionTest.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/introspection/NamespaceLikeShortCircuitsIntrospectionTest.kt index 78ba0367f..920888f2b 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/introspection/NamespaceLikeShortCircuitsIntrospectionTest.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/introspection/NamespaceLikeShortCircuitsIntrospectionTest.kt @@ -1,6 +1,5 @@ package graphql.nadel.tests.next.fixtures.introspection -import graphql.nadel.NadelExecutionHints import graphql.nadel.tests.next.NadelIntegrationTest class NamespaceLikeShortCircuitsIntrospectionTest : NadelIntegrationTest( @@ -33,9 +32,4 @@ class NamespaceLikeShortCircuitsIntrospectionTest : NadelIntegrationTest( }, ), ), -) { - override fun makeExecutionHints(): NadelExecutionHints.Builder { - return super.makeExecutionHints() - .shortCircuitEmptyQuery { true } - } -} +) diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/introspection/NamespaceMutationLikeShortCircuitsIntrospectionTest.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/introspection/NamespaceMutationLikeShortCircuitsIntrospectionTest.kt index 838ad3b9e..5eb08e760 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/introspection/NamespaceMutationLikeShortCircuitsIntrospectionTest.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/introspection/NamespaceMutationLikeShortCircuitsIntrospectionTest.kt @@ -1,6 +1,5 @@ package graphql.nadel.tests.next.fixtures.introspection -import graphql.nadel.NadelExecutionHints import graphql.nadel.tests.next.NadelIntegrationTest class NamespaceMutationLikeShortCircuitsIntrospectionTest : NadelIntegrationTest( @@ -39,9 +38,4 @@ class NamespaceMutationLikeShortCircuitsIntrospectionTest : NadelIntegrationTest }, ), ), -) { - override fun makeExecutionHints(): NadelExecutionHints.Builder { - return super.makeExecutionHints() - .shortCircuitEmptyQuery { true } - } -} +) diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/schema/CustomHydrationDirectiveTestSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/schema/CustomHydrationDirectiveTestSnapshot.kt index bd5bbc443..9f15692c2 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/schema/CustomHydrationDirectiveTestSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/schema/CustomHydrationDirectiveTestSnapshot.kt @@ -125,24 +125,6 @@ public class CustomHydrationDirectiveTestSnapshot : TestSnapshot() { delayedResults = listOfJsonStrings( ), ), - ExpectedServiceCall( - service = "work", - query = """ - | { - | __typename__hydration__businessReport_findRecentWorkByTeam: __typename - | } - """.trimMargin(), - variables = " {}", - result = """ - | { - | "data": { - | "__typename__hydration__businessReport_findRecentWorkByTeam": "Query" - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), ) /** diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubEnumArgumentTestSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubEnumArgumentTestSnapshot.kt index 311e5772e..7ef393225 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubEnumArgumentTestSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubEnumArgumentTestSnapshot.kt @@ -21,25 +21,7 @@ private suspend fun main() { @Suppress("unused") public class StubEnumArgumentTestSnapshot : TestSnapshot() { override val calls: List = listOf( - ExpectedServiceCall( - service = "myService", - query = """ - | { - | __typename__stubbed__thing: __typename - | } - """.trimMargin(), - variables = "{}", - result = """ - | { - | "data": { - | "__typename__stubbed__thing": "Query" - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), - ) + ) /** * ```json diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubEnumInputFieldTestSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubEnumInputFieldTestSnapshot.kt index e17d33855..58f7c8abc 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubEnumInputFieldTestSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubEnumInputFieldTestSnapshot.kt @@ -21,25 +21,7 @@ private suspend fun main() { @Suppress("unused") public class StubEnumInputFieldTestSnapshot : TestSnapshot() { override val calls: List = listOf( - ExpectedServiceCall( - service = "myService", - query = """ - | { - | __typename__stubbed__thing: __typename - | } - """.trimMargin(), - variables = "{}", - result = """ - | { - | "data": { - | "__typename__stubbed__thing": "Query" - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), - ) + ) /** * ```json diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubEnumTypeTestSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubEnumTypeTestSnapshot.kt index bc2f3cd93..7096c5d0a 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubEnumTypeTestSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubEnumTypeTestSnapshot.kt @@ -21,25 +21,7 @@ private suspend fun main() { @Suppress("unused") public class StubEnumTypeTestSnapshot : TestSnapshot() { override val calls: List = listOf( - ExpectedServiceCall( - service = "myService", - query = """ - | { - | __typename__stubbed__thing: __typename - | } - """.trimMargin(), - variables = "{}", - result = """ - | { - | "data": { - | "__typename__stubbed__thing": "Query" - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), - ) + ) /** * ```json diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubInterfaceFieldTestSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubInterfaceFieldTestSnapshot.kt index 37c76a009..c16559e85 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubInterfaceFieldTestSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubInterfaceFieldTestSnapshot.kt @@ -21,28 +21,6 @@ private suspend fun main() { @Suppress("unused") public class StubInterfaceFieldTestSnapshot : TestSnapshot() { override val calls: List = listOf( - ExpectedServiceCall( - service = "myService", - query = """ - | { - | issue { - | __typename__stubbed__key: __typename - | } - | } - """.trimMargin(), - variables = "{}", - result = """ - | { - | "data": { - | "issue": { - | "__typename__stubbed__key": "Task" - | } - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), ExpectedServiceCall( service = "myService", query = """ @@ -76,28 +54,6 @@ public class StubInterfaceFieldTestSnapshot : TestSnapshot() { delayedResults = listOfJsonStrings( ), ), - ExpectedServiceCall( - service = "myService", - query = """ - | { - | task { - | __typename__stubbed__key: __typename - | } - | } - """.trimMargin(), - variables = "{}", - result = """ - | { - | "data": { - | "task": { - | "__typename__stubbed__key": "Issue" - | } - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), ) /** diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubNamespaceLikeMutationFieldTest.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubNamespaceLikeMutationFieldTest.kt index d58d5ef18..3d2b19d8f 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubNamespaceLikeMutationFieldTest.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubNamespaceLikeMutationFieldTest.kt @@ -1,6 +1,5 @@ package graphql.nadel.tests.next.fixtures.stub -import graphql.nadel.NadelExecutionHints import graphql.nadel.tests.next.NadelIntegrationTest class StubNamespaceLikeMutationFieldTest : NadelIntegrationTest( @@ -94,9 +93,4 @@ class StubNamespaceLikeMutationFieldTest : NadelIntegrationTest( }, ), ), -) { - override fun makeExecutionHints(): NadelExecutionHints.Builder { - return super.makeExecutionHints() - .shortCircuitEmptyQuery { true } - } -} +) diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubNamespaceMutationFieldTest.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubNamespaceMutationFieldTest.kt index b3863ebd5..e2d59093c 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubNamespaceMutationFieldTest.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubNamespaceMutationFieldTest.kt @@ -1,6 +1,5 @@ package graphql.nadel.tests.next.fixtures.stub -import graphql.nadel.NadelExecutionHints import graphql.nadel.tests.next.NadelIntegrationTest class StubNamespaceMutationFieldTest : NadelIntegrationTest( @@ -94,9 +93,4 @@ class StubNamespaceMutationFieldTest : NadelIntegrationTest( }, ), ), -) { - override fun makeExecutionHints(): NadelExecutionHints.Builder { - return super.makeExecutionHints() - .shortCircuitEmptyQuery { true } - } -} +) diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubRootLevelTestSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubRootLevelTestSnapshot.kt index 609f5a454..63a402e4c 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubRootLevelTestSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubRootLevelTestSnapshot.kt @@ -21,25 +21,7 @@ private suspend fun main() { @Suppress("unused") public class StubRootLevelTestSnapshot : TestSnapshot() { override val calls: List = listOf( - ExpectedServiceCall( - service = "myService", - query = """ - | { - | __typename__stubbed__issue: __typename - | } - """.trimMargin(), - variables = "{}", - result = """ - | { - | "data": { - | "__typename__stubbed__issue": "Query" - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), - ) + ) /** * ```json diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubRootMutationFieldTestSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubRootMutationFieldTestSnapshot.kt index 5765af84a..471ac5f15 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubRootMutationFieldTestSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubRootMutationFieldTestSnapshot.kt @@ -21,25 +21,7 @@ private suspend fun main() { @Suppress("unused") public class StubRootMutationFieldTestSnapshot : TestSnapshot() { override val calls: List = listOf( - ExpectedServiceCall( - service = "myService", - query = """ - | mutation { - | __typename__stubbed__createLlmBackedIssue: __typename - | } - """.trimMargin(), - variables = "{}", - result = """ - | { - | "data": { - | "__typename__stubbed__createLlmBackedIssue": "Mutation" - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), - ) + ) /** * ```json diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubTypeTestSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubTypeTestSnapshot.kt index 5528b3614..0e1753b7d 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubTypeTestSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubTypeTestSnapshot.kt @@ -21,29 +21,7 @@ private suspend fun main() { @Suppress("unused") public class StubTypeTestSnapshot : TestSnapshot() { override val calls: List = listOf( - ExpectedServiceCall( - service = "myService", - query = """ - | { - | person { - | __typename__stubbed__address: __typename - | } - | } - """.trimMargin(), - variables = "{}", - result = """ - | { - | "data": { - | "person": { - | "__typename__stubbed__address": "Person" - | } - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), - ) + ) /** * ```json diff --git a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubUnionTypeTestSnapshot.kt b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubUnionTypeTestSnapshot.kt index 18e84b163..9c2d44997 100644 --- a/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubUnionTypeTestSnapshot.kt +++ b/test/src/test/kotlin/graphql/nadel/tests/next/fixtures/stub/StubUnionTypeTestSnapshot.kt @@ -21,25 +21,7 @@ private suspend fun main() { @Suppress("unused") public class StubUnionTypeTestSnapshot : TestSnapshot() { override val calls: List = listOf( - ExpectedServiceCall( - service = "myService", - query = """ - | { - | __typename__stubbed__thing: __typename - | } - """.trimMargin(), - variables = "{}", - result = """ - | { - | "data": { - | "__typename__stubbed__thing": "Query" - | } - | } - """.trimMargin(), - delayedResults = listOfJsonStrings( - ), - ), - ) + ) /** * ```json diff --git a/test/src/test/resources/fixtures/field removed/top-level-field-is-removed-hint-is-off.yml b/test/src/test/resources/fixtures/field removed/top-level-field-is-removed-hint-is-off.yml deleted file mode 100644 index adf0db905..000000000 --- a/test/src/test/resources/fixtures/field removed/top-level-field-is-removed-hint-is-off.yml +++ /dev/null @@ -1,62 +0,0 @@ -name: "top level field is removed hint is off" -enabled: true -# language=GraphQL -overallSchema: - CommentService: | - directive @toBeDeleted on FIELD_DEFINITION - type Query { - commentById(id: ID): Comment @toBeDeleted - } - type Comment { - id: ID - } -# language=GraphQL -underlyingSchema: - CommentService: | - type Query { - commentById(id: ID): Comment - } - type Comment { - id: ID - } -# language=GraphQL -query: | - query { - commentById(id: "C1") { - id - } - } -variables: { } -serviceCalls: - - serviceName: "CommentService" - request: - # language=GraphQL - query: | - { - uuid_typename: __typename - } - variables: { } - # language=JSON - response: |- - { - "data": { - "uuid_typename": "Query" - }, - "extensions": {} - } -# language=JSON -response: |- - { - "data": { - "commentById": null - }, - "errors": [ - { - "message": "field `Query.commentById` has been removed by RemoveFieldTestTransform", - "locations": [], - "extensions": { - "classification": "DataFetchingException" - } - } - ] - }