From 62d14d2aece1ce42fab802800eedd463de56b84f Mon Sep 17 00:00:00 2001 From: Michael Staib Date: Tue, 23 Jan 2024 10:24:43 +0100 Subject: [PATCH] Fixed result formatting when non-null root field becomes null. (#6844) --- .../src/CookieCrumble/Snapshot.cs | 12 +- ...andlerTests.Authorize_NoDefaultPolicy.snap | 3 +- ...tionHandlerTests.Authorize_NotAllowed.snap | 3 +- ...ndlerTests.Authorize_NotAuthenticated.snap | 3 +- ...HandlerTests.Authorize_PolicyNotFound.snap | 3 +- ...orizeSchemaTests.AuthorizeOnExtension.snap | 3 +- ...hingTests.MaxAgeAndScope_Should_Cache.snap | 2 +- ...hingTests.MaxAge_NonZero_Should_Cache.snap | 2 +- ...CachingTests.MaxAge_Zero_Should_Cache.snap | 2 +- .../Abstractions/Execution/IQueryResult.cs | 6 + .../src/Abstractions/Execution/QueryResult.cs | 7 +- .../Execution/QueryResultBuilder.cs | 6 +- .../Processing/Result/ResultBuilder.cs | 5 +- .../Serialization/JsonResultFormatter.cs | 32 +- ...ltBuilderTests.Create_Result_Set_Data.snap | 3 +- ...tBuilderTests.Create_Result_Set_Items.snap | 3 +- .../AnnotationBasedAuthorizationTests.cs | 3 +- .../Errors/ErrorBehaviorTests.cs | 277 ++++++++-------- .../Errors/ErrorHandlerTests.cs | 298 +++++++++++------- .../Errors/NullErrorPropagationTests.cs | 190 +++++++++++ ...Method_Await_Return_ApplicationError.json} | 4 +- ...cMethod_Await_Throw_ApplicationError.json} | 4 +- ...ncMethod_Await_Throw_UnexpectedError.json} | 4 +- ...thod_NoAwait_Return_ApplicationError.json} | 4 +- ...ethod_NoAwait_Throw_ApplicationError.json} | 4 +- ...Method_NoAwait_Throw_UnexpectedError.json} | 4 +- ...viorTests.ErrorFilterHandlesException.snap | 19 -- ...haviorTests.Error_Filter_Adds_Details.json | 22 ++ ...viorTests.Error_On_NonNull_Root_Field.json | 17 + ...ErrorBehaviorTests.MatchTestSchema.graphql | 25 ++ ...sts.Property_Return_ApplicationError.json} | 4 +- ...perty_Return_UnexpectedErrorWithPath.json} | 6 +- ...ests.Property_Throw_ApplicationError.json} | 4 +- ...Tests.Property_Throw_UnexpectedError.json} | 4 +- ...rTests.PureResolver_InvalidParentCast.json | 20 ++ ...rTests.PureResolver_InvalidParentCast.snap | 20 -- ...aviorTests.Resolver_InvalidParentCast.json | 20 ++ ...aviorTests.Resolver_InvalidParentCast.snap | 20 -- ...rrorBehaviorTests.RootFieldNotDefined.json | 19 ++ ...rrorBehaviorTests.RootFieldNotDefined.snap | 19 -- ...ErrorBehaviorTests.RootTypeNotDefined.json | 7 + ...ErrorBehaviorTests.RootTypeNotDefined.snap | 7 - ...s.SetMaxAllowedValidationErrors_To_1.json} | 6 +- ...s.SyncMethod_Return_ApplicationError.json} | 4 +- ...ts.SyncMethod_Throw_ApplicationError.json} | 4 +- ...sts.SyncMethod_Throw_UnexpectedError.json} | 4 +- ...ap => ErrorBehaviorTests.SyntaxError.json} | 6 +- ...rrorHandlerTests.AddClassErrorFilter.json} | 4 +- ...iaServiceExtensions_ErrorFilterWorks.json} | 4 +- ...iaServiceExtensions_ErrorFilterWorks.json} | 4 +- ...Tests.AddClassErrorFilterWithFactory.json} | 4 +- ...ViaServiceExtensions_ErrorFilterWorks.json | 22 ++ ...ViaServiceExtensions_ErrorFilterWorks.snap | 22 -- .../ErrorHandlerTests.AddFuncErrorFilter.json | 22 ++ .../ErrorHandlerTests.AddFuncErrorFilter.snap | 22 -- ...lerTests.FilterOnlyNullRefExceptions.json} | 4 +- ...sts.ReportAggregateError_In_Resolver.json} | 4 +- ...sts.UseAggregateError_In_ErrorFilter.json} | 4 +- ...asError_nonnull_list_nonnull_element.json} | 4 +- ...sError_nonnull_list_nullable_element.json} | 4 +- ...sError_nullable_list_nonnull_element.json} | 4 +- ...Error_nullable_list_nullable_element.json} | 4 +- ...tIsNull_nonnull_list_nonnull_element.json} | 4 +- ...IsNull_nonnull_list_nullable_element.json} | 4 +- ...IsNull_nullable_list_nonnull_element.json} | 4 +- ...sNull_nullable_list_nullable_element.json} | 4 +- ...pagation.Lists_NullableElementIsNull.json} | 4 +- ..._NonNullElementHasError_nonnull_prop.json} | 4 +- ...NonNullElementHasError_nullable_prop.json} | 4 +- ...ct_NonNullElementIsNull_nonnull_prop.json} | 4 +- ...t_NonNullElementIsNull_nullable_prop.json} | 4 +- .../DataLoaderTests.ClassDataLoader.snap | 9 +- ...ader_Resolve_From_DependencyInjection.snap | 9 +- ..._To_NonNullArgument_With_DefaultValue.snap | 5 +- .../NullErrorPropagationTests.cs | 184 ----------- .../test/Execution.Tests/SnapshotHelpers.cs | 11 + ...NullableField_NonNull_And_Return_Null.snap | 3 +- ...opedContextDataIsPassedAlongCorrectly.snap | 3 +- ...ctConversionTests.ConvertSourceObject.snap | 3 +- ...ionBasedMutations.List_Return_Type.graphql | 2 +- ...ttributeTests.Id_On_Objects_InvalidId.snap | 2 +- ...ributeTests.Id_On_Objects_InvalidType.snap | 2 +- .../NodeFieldSupportTests.Tow_Many_Nodes.snap | 3 +- ...ion_Should_BeMissingMiddleware_NET6_0.snap | 3 +- ...ion_Should_BeMissingMiddleware_NET7_0.snap | 3 +- ...ion_Should_BeMissingMiddleware_NET8_0.snap | 3 +- ...tension_Should_BeTypeMissMatch_NET6_0.snap | 3 +- ...tension_Should_BeTypeMissMatch_NET7_0.snap | 3 +- ...tension_Should_BeTypeMissMatch_NET8_0.snap | 3 +- ...ion_Should_BeMissingMiddleware_NET6_0.snap | 3 +- ...ion_Should_BeMissingMiddleware_NET7_0.snap | 3 +- ...ion_Should_BeMissingMiddleware_NET8_0.snap | 3 +- ...tension_Should_BeTypeMissMatch_NET6_0.snap | 3 +- ...tension_Should_BeTypeMissMatch_NET7_0.snap | 3 +- ...tension_Should_BeTypeMissMatch_NET8_0.snap | 3 +- ...ion_Should_BeMissingMiddleware_NET6_0.snap | 3 +- ...ion_Should_BeMissingMiddleware_NET7_0.snap | 3 +- ...ion_Should_BeMissingMiddleware_NET8_0.snap | 3 +- ...tension_Should_BeTypeMissMatch_NET6_0.snap | 3 +- ...tension_Should_BeTypeMissMatch_NET7_0.snap | 3 +- ...tension_Should_BeTypeMissMatch_NET8_0.snap | 3 +- ...Tests.Accounts_Offline_Author_NonNull.snap | 3 +- ...s.Internal_Server_Error_On_Root_Field.snap | 3 +- ...ntegrationTests.ExecutePersistedQuery.snap | 3 +- ...nTests.ExecutePersistedQuery_NotFound.snap | 3 +- ...ntegrationTests.ExecutePersistedQuery.snap | 3 +- ...s.ExecutePersistedQuery_ApplicationDI.snap | 3 +- ...ePersistedQuery_ApplicationDI_Default.snap | 3 +- ...ecutePersistedQuery_Before_Expiration.snap | 3 +- ...nTests.ExecutePersistedQuery_NotFound.snap | 3 +- ...xecute_InputUnknownCRS_RaiseException.snap | 3 +- 111 files changed, 912 insertions(+), 720 deletions(-) create mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/NullErrorPropagationTests.cs rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.AsyncMethod_Await_Return_ApplicationError.snap => ErrorBehaviorTests.AsyncMethod_Await_Return_ApplicationError.json} (93%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.AsyncMethod_Await_Throw_ApplicationError.snap => ErrorBehaviorTests.AsyncMethod_Await_Throw_ApplicationError.json} (93%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.AsyncMethod_Await_Throw_UnexpectedError.snap => ErrorBehaviorTests.AsyncMethod_Await_Throw_UnexpectedError.json} (97%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.AsyncMethod_NoAwait_Return_ApplicationError.snap => ErrorBehaviorTests.AsyncMethod_NoAwait_Return_ApplicationError.json} (93%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_ApplicationError.snap => ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_ApplicationError.json} (93%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_UnexpectedError.snap => ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_UnexpectedError.json} (97%) delete mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.ErrorFilterHandlesException.snap create mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Error_Filter_Adds_Details.json create mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Error_On_NonNull_Root_Field.json create mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.MatchTestSchema.graphql rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.Property_Return_ApplicationError.snap => ErrorBehaviorTests.Property_Return_ApplicationError.json} (93%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.Property_Return_UnexpectedErrorWithPath.snap => ErrorBehaviorTests.Property_Return_UnexpectedErrorWithPath.json} (69%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.Property_Throw_ApplicationError.snap => ErrorBehaviorTests.Property_Throw_ApplicationError.json} (93%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.Property_Throw_UnexpectedError.snap => ErrorBehaviorTests.Property_Throw_UnexpectedError.json} (97%) create mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.PureResolver_InvalidParentCast.json delete mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.PureResolver_InvalidParentCast.snap create mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Resolver_InvalidParentCast.json delete mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Resolver_InvalidParentCast.snap create mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootFieldNotDefined.json delete mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootFieldNotDefined.snap create mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootTypeNotDefined.json delete mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootTypeNotDefined.snap rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.SetMaxAllowedValidationErrors_To_1.snap => ErrorBehaviorTests.SetMaxAllowedValidationErrors_To_1.json} (78%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.SyncMethod_Return_ApplicationError.snap => ErrorBehaviorTests.SyncMethod_Return_ApplicationError.json} (93%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.SyncMethod_Throw_ApplicationError.snap => ErrorBehaviorTests.SyncMethod_Throw_ApplicationError.json} (93%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.SyncMethod_Throw_UnexpectedError.snap => ErrorBehaviorTests.SyncMethod_Throw_UnexpectedError.json} (97%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorBehaviorTests.SyntaxError.snap => ErrorBehaviorTests.SyntaxError.json} (63%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorHandlerTests.AddClassErrorFilter.snap => ErrorHandlerTests.AddClassErrorFilter.json} (97%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorHandlerTests.AddClassErrorFilterUsingDI_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.snap => ErrorHandlerTests.AddClassErrorFilterUsingDI_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.json} (97%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorHandlerTests.AddClassErrorFilterUsingFactory_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.snap => ErrorHandlerTests.AddClassErrorFilterUsingFactory_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.json} (97%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorHandlerTests.AddClassErrorFilterWithFactory.snap => ErrorHandlerTests.AddClassErrorFilterWithFactory.json} (97%) create mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilter_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.json delete mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilter_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.snap create mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddFuncErrorFilter.json delete mode 100644 src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddFuncErrorFilter.snap rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorHandlerTests.FilterOnlyNullRefExceptions.snap => ErrorHandlerTests.FilterOnlyNullRefExceptions.json} (98%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorHandlerTests.ReportAggregateError_In_Resolver.snap => ErrorHandlerTests.ReportAggregateError_In_Resolver.json} (94%) rename src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/{ErrorHandlerTests.UseAggregateError_In_ErrorFilter.snap => ErrorHandlerTests.UseAggregateError_In_ErrorFilter.json} (98%) rename src/HotChocolate/Core/test/Execution.Tests/{__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nonnull_element.snap => Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nonnull_element.json} (92%) rename src/HotChocolate/Core/test/Execution.Tests/{__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nullable_element.snap => Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nullable_element.json} (95%) rename src/HotChocolate/Core/test/Execution.Tests/{__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nonnull_element.snap => Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nonnull_element.json} (95%) rename src/HotChocolate/Core/test/Execution.Tests/{__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nullable_element.snap => Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nullable_element.json} (95%) rename src/HotChocolate/Core/test/Execution.Tests/{__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nonnull_element.snap => Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nonnull_element.json} (98%) rename src/HotChocolate/Core/test/Execution.Tests/{__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nullable_element.snap => Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nullable_element.json} (98%) rename src/HotChocolate/Core/test/Execution.Tests/{__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nonnull_element.snap => Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nonnull_element.json} (98%) rename src/HotChocolate/Core/test/Execution.Tests/{__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nullable_element.snap => Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nullable_element.json} (98%) rename src/HotChocolate/Core/test/Execution.Tests/{__snapshots__/NullErrorPropagation.Lists_NullableElementIsNull.snap => Errors/__snapshots__/NullErrorPropagation.Lists_NullableElementIsNull.json} (98%) rename src/HotChocolate/Core/test/Execution.Tests/{__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nonnull_prop.snap => Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nonnull_prop.json} (92%) rename src/HotChocolate/Core/test/Execution.Tests/{__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nullable_prop.snap => Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nullable_prop.json} (94%) rename src/HotChocolate/Core/test/Execution.Tests/{__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nonnull_prop.snap => Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nonnull_prop.json} (98%) rename src/HotChocolate/Core/test/Execution.Tests/{__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nullable_prop.snap => Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nullable_prop.json} (98%) delete mode 100644 src/HotChocolate/Core/test/Execution.Tests/NullErrorPropagationTests.cs create mode 100644 src/HotChocolate/Core/test/Execution.Tests/SnapshotHelpers.cs diff --git a/src/CookieCrumble/src/CookieCrumble/Snapshot.cs b/src/CookieCrumble/src/CookieCrumble/Snapshot.cs index 8f6fe81482a..30dc4a52c6d 100644 --- a/src/CookieCrumble/src/CookieCrumble/Snapshot.cs +++ b/src/CookieCrumble/src/CookieCrumble/Snapshot.cs @@ -14,7 +14,7 @@ namespace CookieCrumble; -public sealed class Snapshot +public class Snapshot { private static readonly object _sync = new(); private static readonly UTF8Encoding _encoding = new(); @@ -49,6 +49,9 @@ public Snapshot(string? postFix = null, string? extension = null) public static Snapshot Create(string? postFix = null, string? extension = null) => new(postFix, extension); + + public static DisposableSnapshot Start(string? postFix = null, string? extension = null) + => new(postFix, extension); public static void Match( object? value, @@ -474,3 +477,10 @@ public SnapshotSegment(string? name, object? value, ISnapshotValueFormatter form public ISnapshotValueFormatter Formatter { get; } } } + +public sealed class DisposableSnapshot(string? postFix = null, string? extension = null) + : Snapshot(postFix, extension) + , IDisposable +{ + public void Dispose() => Match(); +} \ No newline at end of file diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_NoDefaultPolicy.snap b/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_NoDefaultPolicy.snap index d43ac732fe6..b1b7eabf225 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_NoDefaultPolicy.snap +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_NoDefaultPolicy.snap @@ -15,5 +15,6 @@ "code": "AUTH_NO_DEFAULT_POLICY" } } - ] + ], + "data": null } \ No newline at end of file diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_NotAllowed.snap b/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_NotAllowed.snap index be8882af5cd..01d51bba0bb 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_NotAllowed.snap +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_NotAllowed.snap @@ -15,5 +15,6 @@ "code": "AUTH_NOT_AUTHORIZED" } } - ] + ], + "data": null } \ No newline at end of file diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_NotAuthenticated.snap b/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_NotAuthenticated.snap index e9587f7a311..6e79182781b 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_NotAuthenticated.snap +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_NotAuthenticated.snap @@ -15,5 +15,6 @@ "code": "AUTH_NOT_AUTHENTICATED" } } - ] + ], + "data": null } \ No newline at end of file diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_PolicyNotFound.snap b/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_PolicyNotFound.snap index 6ea84366ea4..152edb966bf 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_PolicyNotFound.snap +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizationHandlerTests.Authorize_PolicyNotFound.snap @@ -15,5 +15,6 @@ "code": "AUTH_POLICY_NOT_FOUND" } } - ] + ], + "data": null } \ No newline at end of file diff --git a/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizeSchemaTests.AuthorizeOnExtension.snap b/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizeSchemaTests.AuthorizeOnExtension.snap index be8882af5cd..01d51bba0bb 100644 --- a/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizeSchemaTests.AuthorizeOnExtension.snap +++ b/src/HotChocolate/AspNetCore/test/AspNetCore.Authorization.Tests/__snapshots__/AuthorizeSchemaTests.AuthorizeOnExtension.snap @@ -15,5 +15,6 @@ "code": "AUTH_NOT_AUTHORIZED" } } - ] + ], + "data": null } \ No newline at end of file diff --git a/src/HotChocolate/Caching/test/Caching.Tests/__snapshots__/HttpCachingTests.MaxAgeAndScope_Should_Cache.snap b/src/HotChocolate/Caching/test/Caching.Tests/__snapshots__/HttpCachingTests.MaxAgeAndScope_Should_Cache.snap index 365e076befc..e063c8da1c9 100644 --- a/src/HotChocolate/Caching/test/Caching.Tests/__snapshots__/HttpCachingTests.MaxAgeAndScope_Should_Cache.snap +++ b/src/HotChocolate/Caching/test/Caching.Tests/__snapshots__/HttpCachingTests.MaxAgeAndScope_Should_Cache.snap @@ -15,5 +15,5 @@ ] } ], - "Body": "{\"data\":{\"field\":\"\"}}" + "Body": "{}" } diff --git a/src/HotChocolate/Caching/test/Caching.Tests/__snapshots__/HttpCachingTests.MaxAge_NonZero_Should_Cache.snap b/src/HotChocolate/Caching/test/Caching.Tests/__snapshots__/HttpCachingTests.MaxAge_NonZero_Should_Cache.snap index 921f0c4cb73..a2024046a4b 100644 --- a/src/HotChocolate/Caching/test/Caching.Tests/__snapshots__/HttpCachingTests.MaxAge_NonZero_Should_Cache.snap +++ b/src/HotChocolate/Caching/test/Caching.Tests/__snapshots__/HttpCachingTests.MaxAge_NonZero_Should_Cache.snap @@ -15,5 +15,5 @@ ] } ], - "Body": "{\"data\":{\"field\":\"\"}}" + "Body": "{}" } diff --git a/src/HotChocolate/Caching/test/Caching.Tests/__snapshots__/HttpCachingTests.MaxAge_Zero_Should_Cache.snap b/src/HotChocolate/Caching/test/Caching.Tests/__snapshots__/HttpCachingTests.MaxAge_Zero_Should_Cache.snap index f3617d81ac6..1284ae02eae 100644 --- a/src/HotChocolate/Caching/test/Caching.Tests/__snapshots__/HttpCachingTests.MaxAge_Zero_Should_Cache.snap +++ b/src/HotChocolate/Caching/test/Caching.Tests/__snapshots__/HttpCachingTests.MaxAge_Zero_Should_Cache.snap @@ -15,5 +15,5 @@ ] } ], - "Body": "{\"data\":{\"field\":\"\"}}" + "Body": "{}" } diff --git a/src/HotChocolate/Core/src/Abstractions/Execution/IQueryResult.cs b/src/HotChocolate/Core/src/Abstractions/Execution/IQueryResult.cs index 7a8643ea654..d55b600df14 100644 --- a/src/HotChocolate/Core/src/Abstractions/Execution/IQueryResult.cs +++ b/src/HotChocolate/Core/src/Abstractions/Execution/IQueryResult.cs @@ -62,6 +62,12 @@ public interface IQueryResult : IExecutionResult /// /// bool? HasNext { get; } + + /// + /// Specifies if data was explicitly set. + /// If false the data was not set (including null). + /// + bool IsDataSet { get; } /// /// Serializes this GraphQL result into a dictionary. diff --git a/src/HotChocolate/Core/src/Abstractions/Execution/QueryResult.cs b/src/HotChocolate/Core/src/Abstractions/Execution/QueryResult.cs index 0e42a4e1375..c370c8dbf42 100644 --- a/src/HotChocolate/Core/src/Abstractions/Execution/QueryResult.cs +++ b/src/HotChocolate/Core/src/Abstractions/Execution/QueryResult.cs @@ -22,7 +22,8 @@ internal QueryResult( string? label, Path? path, bool? hasNext, - Func[] cleanupTasks) + Func[] cleanupTasks, + bool isDataSet) : base(cleanupTasks) { if (data is null && @@ -45,6 +46,7 @@ incremental is null && Label = label; Path = path; HasNext = hasNext; + IsDataSet = isDataSet; } /// @@ -113,6 +115,9 @@ incremental is null && /// public bool? HasNext { get; } + /// + public bool IsDataSet { get; } + /// public IReadOnlyDictionary ToDictionary() => QueryResultHelper.ToDictionary(this); diff --git a/src/HotChocolate/Core/src/Abstractions/Execution/QueryResultBuilder.cs b/src/HotChocolate/Core/src/Abstractions/Execution/QueryResultBuilder.cs index ff3c1d8ac71..056e8e0078b 100644 --- a/src/HotChocolate/Core/src/Abstractions/Execution/QueryResultBuilder.cs +++ b/src/HotChocolate/Core/src/Abstractions/Execution/QueryResultBuilder.cs @@ -15,12 +15,14 @@ public sealed class QueryResultBuilder : IQueryResultBuilder private string? _label; private Path? _path; private bool? _hasNext; + private bool? _isDataSet; private Func[] _cleanupTasks = Array.Empty>(); public IQueryResultBuilder SetData(IReadOnlyDictionary? data) { _data = data; _items = null; + _isDataSet = true; return this; } @@ -176,7 +178,8 @@ public IQueryResult Create() _label, _path, _hasNext, - _cleanupTasks); + _cleanupTasks, + _isDataSet ?? false); public static QueryResultBuilder New() => new(); @@ -210,6 +213,7 @@ public static QueryResultBuilder FromResult(IQueryResult result) builder._label = result.Label; builder._path = result.Path; builder._hasNext = result.HasNext; + builder._isDataSet = result.IsDataSet; return builder; } diff --git a/src/HotChocolate/Core/src/Execution/Processing/Result/ResultBuilder.cs b/src/HotChocolate/Core/src/Execution/Processing/Result/ResultBuilder.cs index ef7565d0fae..642e098126b 100644 --- a/src/HotChocolate/Core/src/Execution/Processing/Result/ResultBuilder.cs +++ b/src/HotChocolate/Core/src/Execution/Processing/Result/ResultBuilder.cs @@ -221,7 +221,7 @@ public IQueryResult BuildResult() throw new InvalidOperationException(Resources.ResultHelper_BuildResult_InvalidResult); } - if (_errors.Count > 0) + if (_errors.Count > 1) { _errors.Sort(ErrorComparer.Default); } @@ -252,7 +252,8 @@ public IQueryResult BuildResult() hasNext: _hasNext, cleanupTasks: _cleanupTasks.Count == 0 ? _emptyCleanupTasks - : _cleanupTasks.ToArray()); + : _cleanupTasks.ToArray(), + isDataSet: true); if (_data is not null) { diff --git a/src/HotChocolate/Core/src/Execution/Serialization/JsonResultFormatter.cs b/src/HotChocolate/Core/src/Execution/Serialization/JsonResultFormatter.cs index bd2ea4a9449..b9deaf7d3a9 100644 --- a/src/HotChocolate/Core/src/Execution/Serialization/JsonResultFormatter.cs +++ b/src/HotChocolate/Core/src/Execution/Serialization/JsonResultFormatter.cs @@ -244,7 +244,7 @@ private void WriteResult(Utf8JsonWriter writer, IQueryResult result) writer.WriteStartObject(); WriteErrors(writer, result.Errors); - WriteData(writer, result.Data); + WriteData(writer, result); WriteItems(writer, result.Items); WriteIncremental(writer, result.Incremental); WriteExtensions(writer, result.Extensions); @@ -281,20 +281,28 @@ private static void WriteHasNext( private void WriteData( Utf8JsonWriter writer, - IReadOnlyDictionary? data) + IQueryResult result) { - if (data is not null) + if (!result.IsDataSet) { - writer.WritePropertyName(Data); + return; + } - if (data is ObjectResult resultMap) - { - WriteObjectResult(writer, resultMap); - } - else - { - WriteDictionary(writer, data); - } + if (result.Data is null) + { + writer.WriteNull(Data); + return; + } + + writer.WritePropertyName(Data); + + if (result.Data is ObjectResult resultMap) + { + WriteObjectResult(writer, resultMap); + } + else + { + WriteDictionary(writer, result.Data); } } diff --git a/src/HotChocolate/Core/test/Abstractions.Tests/Execution/__snapshots__/QueryResultBuilderTests.Create_Result_Set_Data.snap b/src/HotChocolate/Core/test/Abstractions.Tests/Execution/__snapshots__/QueryResultBuilderTests.Create_Result_Set_Data.snap index 68d62543d17..961e89812b7 100644 --- a/src/HotChocolate/Core/test/Abstractions.Tests/Execution/__snapshots__/QueryResultBuilderTests.Create_Result_Set_Data.snap +++ b/src/HotChocolate/Core/test/Abstractions.Tests/Execution/__snapshots__/QueryResultBuilderTests.Create_Result_Set_Data.snap @@ -10,5 +10,6 @@ "Extensions": null, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": true } diff --git a/src/HotChocolate/Core/test/Abstractions.Tests/Execution/__snapshots__/QueryResultBuilderTests.Create_Result_Set_Items.snap b/src/HotChocolate/Core/test/Abstractions.Tests/Execution/__snapshots__/QueryResultBuilderTests.Create_Result_Set_Items.snap index a5235ee0b0f..d3e4003be27 100644 --- a/src/HotChocolate/Core/test/Abstractions.Tests/Execution/__snapshots__/QueryResultBuilderTests.Create_Result_Set_Items.snap +++ b/src/HotChocolate/Core/test/Abstractions.Tests/Execution/__snapshots__/QueryResultBuilderTests.Create_Result_Set_Items.snap @@ -10,5 +10,6 @@ "Extensions": null, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": false } diff --git a/src/HotChocolate/Core/test/Authorization.Tests/AnnotationBasedAuthorizationTests.cs b/src/HotChocolate/Core/test/Authorization.Tests/AnnotationBasedAuthorizationTests.cs index 95195a2e707..edbf2983dd1 100644 --- a/src/HotChocolate/Core/test/Authorization.Tests/AnnotationBasedAuthorizationTests.cs +++ b/src/HotChocolate/Core/test/Authorization.Tests/AnnotationBasedAuthorizationTests.cs @@ -897,7 +897,8 @@ public async Task Assert_UserState_Exists() "originalValue": "abc" } } - ] + ], + "data": null } """); } diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/ErrorBehaviorTests.cs b/src/HotChocolate/Core/test/Execution.Tests/Errors/ErrorBehaviorTests.cs index d4f4b8c2d8a..2a85650d4b3 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/ErrorBehaviorTests.cs +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/ErrorBehaviorTests.cs @@ -1,164 +1,140 @@ -using System; -using System.Threading.Tasks; -using HotChocolate.Tests; +#nullable enable + +using System.Diagnostics.CodeAnalysis; +using CookieCrumble; using HotChocolate.Types; using Microsoft.Extensions.DependencyInjection; -using Snapshooter.Xunit; -using Xunit; +using static HotChocolate.Execution.SnapshotHelpers; namespace HotChocolate.Execution.Errors; public class ErrorBehaviorTests { [Fact] - public Task SyntaxError() + public async Task MatchTestSchema() { - Snapshot.FullName(); - return ExpectError("{ error1"); + var executor = await CreateExecutorAsync(); + executor.Schema.MatchSnapshot(); } - + [Fact] - public Task AsyncMethod_NoAwait_Throw_ApplicationError() - { - Snapshot.FullName(); - return ExpectError("{ error1 }"); - } - + public async Task SyntaxError() + => await MatchQueryAsync("{ error1"); + [Fact] - public Task AsyncMethod_Await_Throw_ApplicationError() - { - Snapshot.FullName(); - return ExpectError("{ error4 }"); - } + public async Task AsyncMethod_NoAwait_Throw_ApplicationError() + => await MatchQueryAsync("{ error1 }"); [Fact] - public Task SyncMethod_Throw_ApplicationError() - { - - Snapshot.FullName(); - return ExpectError("{ error7 }"); - } + public async Task AsyncMethod_Await_Throw_ApplicationError() + => await MatchQueryAsync("{ error4 }"); [Fact] - public Task Property_Throw_ApplicationError() - { - Snapshot.FullName(); - return ExpectError("{ error10 }"); - } + public async Task SyncMethod_Throw_ApplicationError() + => await MatchQueryAsync("{ error7 }"); [Fact] - public Task AsyncMethod_NoAwait_Throw_UnexpectedError() - { - Snapshot.FullName(); - return ExpectError("{ error2 }"); - } + public async Task Property_Throw_ApplicationError() + => await MatchQueryAsync("{ error10 }"); [Fact] - public Task AsyncMethod_Await_Throw_UnexpectedError() - { - Snapshot.FullName(); - return ExpectError("{ error5 }"); - } + public async Task AsyncMethod_NoAwait_Throw_UnexpectedError() + => await MatchQueryAsync("{ error2 }"); [Fact] - public Task SyncMethod_Throw_UnexpectedError() - { - Snapshot.FullName(); - return ExpectError("{ error8 }"); - } + public async Task AsyncMethod_Await_Throw_UnexpectedError() + => await MatchQueryAsync("{ error5 }"); [Fact] - public Task Property_Throw_UnexpectedError() - { - Snapshot.FullName(); - return ExpectError("{ error11 }"); - } + public async Task SyncMethod_Throw_UnexpectedError() + => await MatchQueryAsync("{ error8 }"); [Fact] - public Task AsyncMethod_NoAwait_Return_ApplicationError() - { - Snapshot.FullName(); - return ExpectError("{ error3 }"); - } + public async Task Property_Throw_UnexpectedError() + => await MatchQueryAsync("{ error11 }"); [Fact] - public Task AsyncMethod_Await_Return_ApplicationError() - { - Snapshot.FullName(); - return ExpectError("{ error6 }"); - } + public async Task AsyncMethod_NoAwait_Return_ApplicationError() + => await MatchQueryAsync("{ error3 }"); [Fact] - public Task SyncMethod_Return_ApplicationError() - { - Snapshot.FullName(); - return ExpectError("{ error9 }"); - } + public async Task AsyncMethod_Await_Return_ApplicationError() + => await MatchQueryAsync("{ error6 }"); - [Fact] - public Task Property_Return_ApplicationError() - { - Snapshot.FullName(); - return ExpectError("{ error12 }"); - } [Fact] - public Task Property_Return_UnexpectedErrorWithPath() - { - Snapshot.FullName(); - return ExpectError("{ error13 }", 0); - } + public async Task SyncMethod_Return_ApplicationError() + => await MatchQueryAsync("{ error9 }"); [Fact] - public Task RootTypeNotDefined() - { - Snapshot.FullName(); - return TestHelper.ExpectError( - "type Query { foo: String }", - "mutation { foo }"); - } + public async Task Property_Return_ApplicationError() + => await MatchQueryAsync("{ error12 }"); + [Fact] + public async Task Property_Return_UnexpectedErrorWithPath() + => await MatchQueryAsync("{ error13 }"); + + [Fact] + public async Task Error_On_NonNull_Root_Field() + => await MatchQueryAsync("{ error15 }"); + [Fact] public Task RootFieldNotDefined() - { - Snapshot.FullName(); - return TestHelper.ExpectError( - @"type Query { a: String } type Mutation { bar: String }", - "mutation { foo }"); - } + => MatchQueryAsync("query { doesNotExist }"); [Fact] - public Task ErrorFilterHandlesException() + public async Task RootTypeNotDefined() + => await MatchQueryAsync("mutation { doesNotExist }"); + + [Fact] + public async Task Error_Filter_Adds_Details() { - Snapshot.FullName(); - return TestHelper.ExpectError( - "{ error14 }", - b => b - .AddQueryType() - .ModifyRequestOptions(o => o.IncludeExceptionDetails = false)); + // arrange + using var snapshot = StartResultSnapshot(); + + var executor = await new ServiceCollection() + .AddGraphQL() + .AddQueryType() + .AddErrorFilter(error => error.SetExtension("foo", "bar")) + .BuildRequestExecutorAsync(); + + // act + var result = await executor.ExecuteAsync("{ error14 }"); + + // assert + snapshot.Add(result); } [Fact] public async void Resolver_InvalidParentCast() { - Snapshot.FullName(); - await new ServiceCollection() + // arrange + using var snapshot = StartResultSnapshot(); + + var executor = await new ServiceCollection() .AddGraphQL() .AddQueryType(d => d .Field("foo") .Type>() .Extend() // in the pure resolver we will return the wrong type - .Definition.Resolver = _ => new ValueTask(new Baz())) - .ExecuteRequestAsync("{ foo { bar } }") - .MatchSnapshotAsync(); + .Definition.Resolver = _ => new ValueTask(new Baz())) + .BuildRequestExecutorAsync(); + + // act + var result = await executor.ExecuteAsync("{ foo { bar } }"); + + // assert + snapshot.Add(result); } [Fact] public async void PureResolver_InvalidParentCast() { - Snapshot.FullName(); - await new ServiceCollection() + // arrange + using var snapshot = StartResultSnapshot(); + + var executor = await new ServiceCollection() .AddGraphQL() .AddQueryType(d => d .Field("foo") @@ -166,15 +142,22 @@ public async void PureResolver_InvalidParentCast() .Extend() // in the pure resolver we will return the wrong type .Definition.PureResolver = _ => new Baz()) - .ExecuteRequestAsync("{ foo { bar } }") - .MatchSnapshotAsync(); + .BuildRequestExecutorAsync(); + + // act + var result = await executor.ExecuteAsync("{ foo { bar } }"); + + // assert + snapshot.Add(result); } [Fact] public async void SetMaxAllowedValidationErrors_To_1() { - Snapshot.FullName(); - await new ServiceCollection() + // arrange + using var snapshot = StartResultSnapshot(); + + var executor = await new ServiceCollection() .AddGraphQL() .AddQueryType(d => d .Field("foo") @@ -183,28 +166,31 @@ public async void SetMaxAllowedValidationErrors_To_1() // in the pure resolver we will return the wrong type .Definition.PureResolver = _ => new Baz()) .SetMaxAllowedValidationErrors(1) - .ExecuteRequestAsync("{ a b c d }") - .MatchSnapshotAsync(); + .BuildRequestExecutorAsync(); + + // act + var result = await executor.ExecuteAsync("{ a b c d }"); + + // assert + snapshot.Add(result); } + private static async Task MatchQueryAsync(string query) + { + using var snapshot = StartResultSnapshot(); + + var executor = await CreateExecutorAsync(); + var result = await executor.ExecuteAsync(query); - private async Task ExpectError( - string query, - int expectedErrorCount = 1) + snapshot.Add(result); + } + + private static async Task CreateExecutorAsync() { - var errors = 0; - - await TestHelper.ExpectError( - query, - b => b - .AddQueryType() - .AddErrorFilter(error => - { - errors++; - return error; - })); - - Assert.Equal(expectedErrorCount, errors); + return await new ServiceCollection() + .AddGraphQL() + .AddQueryType() + .BuildRequestExecutorAsync(); } public class QueryType : ObjectType @@ -219,39 +205,40 @@ protected override void Configure( } } + [SuppressMessage("ReSharper", "UnusedMember.Global")] public class Query { - public Task Error1() + public Task Error1() { throw new QueryException("query error 1"); } - public Task Error2() + public Task Error2() { throw new Exception("query error 2"); } - public Task Error3() + public Task Error3() { - return Task.FromResult( + return Task.FromResult( ErrorBuilder.New() .SetMessage("query error 3") .Build()); } - public async Task Error4() + public async Task Error4() { await Task.Delay(1); throw new QueryException("query error 4"); } - public async Task Error5() + public async Task Error5() { await Task.Delay(1); throw new Exception("query error 5"); } - public async Task Error6() + public async Task Error6() { await Task.Delay(1); return await Task.FromResult( @@ -260,43 +247,47 @@ public async Task Error6() .Build()); } - public string Error7() + public string? Error7() { throw new QueryException("query error 7"); } - public string Error8() + public string? Error8() { throw new Exception("query error 8"); } - public object Error9() + public object? Error9() { return ErrorBuilder.New() .SetMessage("query error 9") .Build(); } - public string Error10 => throw new QueryException("query error 10"); + public string? Error10 => throw new QueryException("query error 10"); - public string Error11 => throw new Exception("query error 11"); + public string? Error11 => throw new Exception("query error 11"); - public object Error12 => ErrorBuilder.New() + public object? Error12 => ErrorBuilder.New() .SetMessage("query error 12") .Build(); - public Foo Error13 => new Foo(); + public Foo? Error13 => new Foo(); - public string Error14 => throw new ArgumentNullException("Error14"); + public string? Error14 => throw new ArgumentNullException("Error14"); + + public string Error15 => throw new ArgumentNullException("Error15"); } + [SuppressMessage("ReSharper", "UnusedMember.Global")] public class Foo { - public string Bar => throw new Exception("baz"); + public string? Bar => throw new Exception("baz"); } + [SuppressMessage("ReSharper", "UnusedMember.Global")] public class Baz { - public string Bar => throw new Exception("baz"); + public string? Bar => throw new Exception("baz"); } } \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/ErrorHandlerTests.cs b/src/HotChocolate/Core/test/Execution.Tests/Errors/ErrorHandlerTests.cs index cf3201b128f..dbdabc1257a 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/ErrorHandlerTests.cs +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/ErrorHandlerTests.cs @@ -1,188 +1,251 @@ -using System; -using System.Threading.Tasks; +using System.Diagnostics.CodeAnalysis; using Microsoft.Extensions.DependencyInjection; -using HotChocolate.Execution.Configuration; -using HotChocolate.Tests; -using Snapshooter.Xunit; +using static HotChocolate.Execution.SnapshotHelpers; namespace HotChocolate.Execution.Errors; +[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")] +[SuppressMessage("ReSharper", "MemberCanBePrivate.Global")] public class ErrorHandlerTests { [Fact] public async Task AddFuncErrorFilter() { - Snapshot.FullName(); - await ExpectError( - "{ foo }", - b => b - .AddDocumentFromString("type Query { foo: String }") - .UseField(_ => _ => throw new Exception("Foo")) - .Services - .AddErrorFilter(error => error.WithCode("Foo123"))); + // arrange + using var snapshot = StartResultSnapshot(); + + var executor = await new ServiceCollection() + // error filter configuration + .AddErrorFilter(error => error.WithCode("Foo123")) + + // general graphql configuration + .AddGraphQL() + .AddDocumentFromString("type Query { foo: String }") + .UseField(_ => _ => throw new Exception("Foo")) + + // build graphql executor + .BuildRequestExecutorAsync(); + + // act + var result = await executor.ExecuteAsync("{ foo }"); + + // assert + snapshot.Add(result); } [Fact] public async Task FilterOnlyNullRefExceptions() { - Snapshot.FullName(); - await ExpectError( - "{ foo bar }", - b => b - .AddDocumentFromString("type Query { foo: String bar: String }") - .AddResolver("Query", "foo", _ => throw new Exception("Foo")) - .AddResolver("Query", "bar", _ => throw new NullReferenceException("Foo")) - .AddErrorFilter( - error => + // arrange + using var snapshot = StartResultSnapshot(); + + var executor = await new ServiceCollection() + // general graphql configuration + .AddGraphQL() + .AddDocumentFromString("type Query { foo: String bar: String }") + .AddResolver("Query", "foo", _ => throw new Exception("Foo")) + .AddResolver("Query", "bar", _ => throw new NullReferenceException("Foo")) + + // error filter configuration + .AddErrorFilter( + error => + { + if (error.Exception is NullReferenceException) { - if (error.Exception is NullReferenceException) - { - return error.WithCode("NullRef"); - } - return error; - }), - expectedErrorCount: 2); + return error.WithCode("NullRef"); + } + return error; + }) + + // build graphql executor + .BuildRequestExecutorAsync(); + + // act + var result = await executor.ExecuteAsync("{ foo bar }"); + + // assert + snapshot.Add(result); } [Fact] public async Task AddClassErrorFilter() { - Snapshot.FullName(); - await ExpectError( - "{ foo }", - b => b - .AddDocumentFromString("type Query { foo: String }") - .AddResolver("Query", "foo", _ => throw new Exception("Foo")) - .Services - .AddErrorFilter()); + // arrange + using var snapshot = StartResultSnapshot(); + + var executor = await new ServiceCollection() + // error filter configuration + .AddErrorFilter() + + // general graphql configuration + .AddGraphQL() + .AddDocumentFromString("type Query { foo: String }") + .AddResolver("Query", "foo", _ => throw new Exception("Foo")) + + // build graphql executor + .BuildRequestExecutorAsync(); + + // act + var result = await executor.ExecuteAsync("{ foo }"); + + // assert + snapshot.Add(result); } [Fact] public async Task AddClassErrorFilter_SchemaBuiltViaServiceExtensions_ErrorFilterWorks() { // arrange - var serviceCollection = new ServiceCollection(); - var schema = await serviceCollection - .AddGraphQLServer() - .AddErrorFilter() + using var snapshot = StartResultSnapshot(); + + var executor = await new ServiceCollection() + // general graphql configuration + .AddGraphQL() .AddQueryType() + + // error filter configuration + .AddErrorFilter() + + // build graphql executor .BuildRequestExecutorAsync(); // act - var resp = await schema.ExecuteAsync("{ foo }"); + var result = await executor.ExecuteAsync("{ foo }"); // assert - resp.MatchSnapshot(); + snapshot.Add(result); } [Fact] public async Task AddClassErrorFilterUsingDI_SchemaBuiltViaServiceExtensions_ErrorFilterWorks() { // arrange - var serviceCollection = new ServiceCollection(); - serviceCollection.AddSingleton(); - var schema = await serviceCollection - .AddGraphQLServer() - .AddErrorFilter() + using var snapshot = StartResultSnapshot(); + + var executor = await new ServiceCollection() + // service configuration + .AddSingleton() + + // general graphql configuration + .AddGraphQL() .AddQueryType() + + // error filter configuration + .AddErrorFilter() + + // build graphql executor .BuildRequestExecutorAsync(); // act - var resp = await schema.ExecuteAsync("{ foo }"); + var result = await executor.ExecuteAsync("{ foo }"); // assert - resp.MatchSnapshot(); + snapshot.Add(result); } [Fact] - public async Task - AddClassErrorFilterUsingFactory_SchemaBuiltViaServiceExtensions_ErrorFilterWorks() + public async Task AddClassErrorFilterUsingFactory_SchemaBuiltViaServiceExtensions_ErrorFilterWorks() { // arrange - var serviceCollection = new ServiceCollection(); - var schema = await serviceCollection - .AddGraphQLServer() - .AddErrorFilter(f => new DummyErrorFilter()) + using var snapshot = StartResultSnapshot(); + + var executor = await new ServiceCollection() + // general graphql configuration + .AddGraphQL() .AddQueryType() + + // error filter configuration + .AddErrorFilter(_ => new DummyErrorFilter()) + + // build graphql executor .BuildRequestExecutorAsync(); // act - var resp = await schema.ExecuteAsync("{ foo }"); + var result = await executor.ExecuteAsync("{ foo }"); // assert - resp.MatchSnapshot(); + snapshot.Add(result); } [Fact] public async Task AddClassErrorFilterWithFactory() { - Snapshot.FullName(); - await ExpectError( - "{ foo }", - b => b - .AddDocumentFromString("type Query { foo: String }") - .AddResolver("Query", "foo", _ => throw new Exception("Foo")) - .Services - .AddErrorFilter(_ => new DummyErrorFilter())); + // arrange + using var snapshot = StartResultSnapshot(); + + var executor = await new ServiceCollection() + // error filter configuration + .AddErrorFilter(_ => new DummyErrorFilter()) + + // general graphql configuration + .AddGraphQL() + .AddDocumentFromString("type Query { foo: String }") + .AddResolver("Query", "foo", _ => throw new Exception("Foo")) + + // build graphql executor + .BuildRequestExecutorAsync(); + + // act + var result = await executor.ExecuteAsync("{ foo }"); + + // assert + snapshot.Add(result); } [Fact] public async Task UseAggregateError_In_ErrorFilter() { - Snapshot.FullName(); - - await ExpectError( - "{ foo }", - b => b - .AddDocumentFromString("type Query { foo: String }") - .AddResolver("Query", "foo", _ => throw new Exception("Foo")) - .Services - .AddErrorFilter(_ => new AggregateErrorFilter())); + // arrange + using var snapshot = StartResultSnapshot(); + + var executor = await new ServiceCollection() + // error filter configuration + .AddErrorFilter(_ => new AggregateErrorFilter()) + + // general graphql configuration + .AddGraphQL() + .AddDocumentFromString("type Query { foo: String }") + .AddResolver("Query", "foo", _ => throw new Exception("Foo")) + + // build graphql executor + .BuildRequestExecutorAsync(); + + // act + var result = await executor.ExecuteAsync("{ foo }"); + + // assert + snapshot.Add(result); } [Fact] public async Task ReportAggregateError_In_Resolver() { - Snapshot.FullName(); - - await ExpectError( - "{ foo }", - b => b - .AddDocumentFromString("type Query { foo: String }") - .AddResolver( - "Query", - "foo", - ctx => - { - ctx.ReportError(new AggregateError(new Error("abc"), new Error("def"))); - return "Hello"; - }), - expectedErrorCount: 2); - } + // arrange + using var snapshot = StartResultSnapshot(); - private async Task ExpectError( - string query, - Action configure, - int expectedErrorCount = 1) - { - var errors = 0; - - await TestHelper.ExpectError( - query, - b => - { - configure(b); - b.AddErrorFilter( - error => - { - errors++; - return error; - }); - }); + var executor = await new ServiceCollection() + // general graphql configuration + .AddGraphQL() + .AddDocumentFromString("type Query { foo: String }") + .AddResolver( + "Query", + "foo", + ctx => + { + ctx.ReportError(new AggregateError(new Error("abc"), new Error("def"))); + return "Hello"; + }) + + // build graphql executor + .BuildRequestExecutorAsync(); - Assert.Equal(expectedErrorCount, errors); - } + // act + var result = await executor.ExecuteAsync("{ foo }"); + // assert + snapshot.Add(result); + } + public class DummyErrorFilter : IErrorFilter { public IError OnError(IError error) @@ -191,20 +254,15 @@ public IError OnError(IError error) } } - public class DummyErrorFilterWithDependency : IErrorFilter +#pragma warning disable CS9113 // Parameter is unread. + public class DummyErrorFilterWithDependency(SomeService service) : IErrorFilter { - private readonly SomeService _service; - - public DummyErrorFilterWithDependency(SomeService service) - { - _service = service; - } - public IError OnError(IError error) { return error.WithCode("Foo123"); } } +#pragma warning restore CS9113 // Parameter is unread. public class SomeService; diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/NullErrorPropagationTests.cs b/src/HotChocolate/Core/test/Execution.Tests/Errors/NullErrorPropagationTests.cs new file mode 100644 index 00000000000..e16ac6814ae --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/NullErrorPropagationTests.cs @@ -0,0 +1,190 @@ +using Microsoft.Extensions.DependencyInjection; + +namespace HotChocolate.Execution; + +public class NullErrorPropagation +{ + [Fact] + public async Task Lists_NullableElementIsNull() + { + // arrange + using var snapshot = SnapshotHelpers.StartResultSnapshot(); + + var executor = await CreateExecutorAsync(); + + var request = + QueryRequestBuilder.New() + .SetQuery( + """ + { + foo { + nullable_list_nullable_element + { + a + b + } + nonnull_list_nullable_element + { + a + b + } + nullable_list_nonnull_element + { + a + b + } + nonnull_list_nonnull_element + { + a + b + } + } + } + """) + .AddGlobalState("a", null) + .AddGlobalState("b", "not_null") + .Create(); + + // act + var result = await executor.ExecuteAsync(request); + + // assert + snapshot.Add(result); + } + + [InlineData("nullable_list_nullable_element")] + [InlineData("nonnull_list_nullable_element")] + [InlineData("nullable_list_nonnull_element")] + [InlineData("nonnull_list_nonnull_element")] + [Theory] + public async Task List_NonNullElementIsNull(string fieldType) + { + // arrange + using var snapshot = SnapshotHelpers.StartResultSnapshot(fieldType); + + var executor = await CreateExecutorAsync(); + + var request = + QueryRequestBuilder.New() + .SetQuery($"{{ foo {{ {fieldType} {{ b }} }} }}") + .AddGlobalState("b", null) + .Create(); + + // act + var result = await executor.ExecuteAsync(request); + + // assert + snapshot.Add(result); + } + + [InlineData("nullable_list_nullable_element")] + [InlineData("nullable_list_nonnull_element")] + [InlineData("nonnull_list_nullable_element")] + [InlineData("nonnull_list_nonnull_element")] + [Theory] + public async Task List_NonNullElementHasError(string fieldType) + { + // arrange + using var snapshot = SnapshotHelpers.StartResultSnapshot(fieldType); + + var executor = await CreateExecutorAsync(); + + var request = + QueryRequestBuilder.New() + .SetQuery($"{{ foo {{ {fieldType} {{ c }} }} }}") + .AddGlobalState("b", null) + .Create(); + + // act + var result = await executor.ExecuteAsync(request); + + // assert + snapshot.Add(result); + } + + [InlineData("nonnull_prop")] + [InlineData("nullable_prop")] + [Theory] + public async Task Object_NonNullElementIsNull(string fieldType) + { + // arrange + using var snapshot = SnapshotHelpers.StartResultSnapshot(fieldType); + + var executor = await CreateExecutorAsync(); + + var request = + QueryRequestBuilder.New() + .SetQuery($"{{ foo {{ {fieldType} {{ b }} }} }}") + .AddGlobalState("b", null) + .Create(); + + // act + var result = await executor.ExecuteAsync(request); + + // assert + snapshot.Add(result); + } + + [InlineData("nonnull_prop")] + [InlineData("nullable_prop")] + [Theory] + public async Task Object_NonNullElementHasError(string fieldType) + { + // arrange + using var snapshot = SnapshotHelpers.StartResultSnapshot(fieldType); + + var executor = await CreateExecutorAsync(); + + var request = + QueryRequestBuilder.New() + .SetQuery($"{{ foo {{ {fieldType} {{ c }} }} }}") + .AddGlobalState("b", null) + .Create(); + + // act + var result = await executor.ExecuteAsync(request); + + // assert + snapshot.Add(result); + } + + private static async Task CreateExecutorAsync() + { + const string schema = + """ + type Query { + foo: Foo + } + + type Foo { + nullable_list_nullable_element: [Bar] + nonnull_list_nullable_element: [Bar]! + nullable_list_nonnull_element: [Bar!] + nonnull_list_nonnull_element: [Bar!]! + nonnull_prop: Bar! + nullable_prop: Bar + } + + type Bar { + a: String + b: String! + c: String! + } + """; + + return await new ServiceCollection() + .AddGraphQL() + .AddDocumentFromString(schema) + .AddResolver("Query", "foo", _ => new(new object())) + .AddResolver("Foo", "nullable_list_nullable_element", _ => new(new[] { new object() })) + .AddResolver("Foo", "nonnull_list_nullable_element", _ => new(new[] { new object() })) + .AddResolver("Foo", "nullable_list_nonnull_element", _ => new(new[] { new object() })) + .AddResolver("Foo", "nonnull_list_nonnull_element", _ => new(new[] { new object() })) + .AddResolver("Foo", "nonnull_prop", _ => new(new object())) + .AddResolver("Foo", "nullable_prop", _ => new(new object())) + .AddResolver("Bar", "a", c => new(c.GetGlobalStateOrDefault("a"))) + .AddResolver("Bar", "b", c => new(c.GetGlobalStateOrDefault("b"))) + .AddResolver("Bar", "c", _ => throw new GraphQLException("ERROR")) + .BuildRequestExecutorAsync(); + } +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Return_ApplicationError.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Return_ApplicationError.json similarity index 93% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Return_ApplicationError.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Return_ApplicationError.json index 4e5f913b4c5..14058e27a70 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Return_ApplicationError.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Return_ApplicationError.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "query error 6" @@ -7,4 +7,4 @@ "data": { "error6": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Throw_ApplicationError.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Throw_ApplicationError.json similarity index 93% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Throw_ApplicationError.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Throw_ApplicationError.json index a1d0b79d163..98e037e29a7 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Throw_ApplicationError.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Throw_ApplicationError.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "query error 4" @@ -7,4 +7,4 @@ "data": { "error4": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Throw_UnexpectedError.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Throw_UnexpectedError.json similarity index 97% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Throw_UnexpectedError.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Throw_UnexpectedError.json index 7c1f6a09de8..cfa4ce02204 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Throw_UnexpectedError.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_Await_Throw_UnexpectedError.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Unexpected Execution Error", @@ -16,4 +16,4 @@ "data": { "error5": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Return_ApplicationError.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Return_ApplicationError.json similarity index 93% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Return_ApplicationError.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Return_ApplicationError.json index 734fdf31760..c855ee8789a 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Return_ApplicationError.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Return_ApplicationError.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "query error 3" @@ -7,4 +7,4 @@ "data": { "error3": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_ApplicationError.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_ApplicationError.json similarity index 93% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_ApplicationError.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_ApplicationError.json index 4e36d830679..a4077cc0492 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_ApplicationError.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_ApplicationError.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "query error 1" @@ -7,4 +7,4 @@ "data": { "error1": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_UnexpectedError.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_UnexpectedError.json similarity index 97% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_UnexpectedError.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_UnexpectedError.json index b5f848d435f..b6b561aede4 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_UnexpectedError.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.AsyncMethod_NoAwait_Throw_UnexpectedError.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Unexpected Execution Error", @@ -16,4 +16,4 @@ "data": { "error2": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.ErrorFilterHandlesException.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.ErrorFilterHandlesException.snap deleted file mode 100644 index 4db78e248a6..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.ErrorFilterHandlesException.snap +++ /dev/null @@ -1,19 +0,0 @@ -{ - "errors": [ - { - "message": "Unexpected Execution Error", - "locations": [ - { - "line": 1, - "column": 3 - } - ], - "path": [ - "error14" - ] - } - ], - "data": { - "error14": null - } -} diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Error_Filter_Adds_Details.json b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Error_Filter_Adds_Details.json new file mode 100644 index 00000000000..9d39da7fa13 --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Error_Filter_Adds_Details.json @@ -0,0 +1,22 @@ +{ + "errors": [ + { + "message": "Unexpected Execution Error", + "locations": [ + { + "line": 1, + "column": 3 + } + ], + "path": [ + "error14" + ], + "extensions": { + "foo": "bar" + } + } + ], + "data": { + "error14": null + } +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Error_On_NonNull_Root_Field.json b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Error_On_NonNull_Root_Field.json new file mode 100644 index 00000000000..5192a201ff6 --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Error_On_NonNull_Root_Field.json @@ -0,0 +1,17 @@ +{ + "errors": [ + { + "message": "Unexpected Execution Error", + "locations": [ + { + "line": 1, + "column": 3 + } + ], + "path": [ + "error15" + ] + } + ], + "data": null +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.MatchTestSchema.graphql b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.MatchTestSchema.graphql new file mode 100644 index 00000000000..59660669234 --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.MatchTestSchema.graphql @@ -0,0 +1,25 @@ +schema { + query: Query +} + +type Foo { + bar: String +} + +type Query { + error3: String + error6: String + error9: String + error12: String + error1: String + error2: String + error4: String + error5: String + error7: String + error8: String + error10: String + error11: String + error13: Foo + error14: String + error15: String! +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Return_ApplicationError.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Return_ApplicationError.json similarity index 93% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Return_ApplicationError.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Return_ApplicationError.json index 8af9482f509..658ea03eed2 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Return_ApplicationError.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Return_ApplicationError.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "query error 12" @@ -7,4 +7,4 @@ "data": { "error12": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Return_UnexpectedErrorWithPath.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Return_UnexpectedErrorWithPath.json similarity index 69% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Return_UnexpectedErrorWithPath.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Return_UnexpectedErrorWithPath.json index 299a95750ed..efbd2da619c 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Return_UnexpectedErrorWithPath.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Return_UnexpectedErrorWithPath.json @@ -1,7 +1,7 @@ -{ +{ "errors": [ { - "message": "\u0060error13\u0060 is an object, interface or union type field. Leaf selections on objects, interfaces, and unions without subfields are disallowed.", + "message": "`error13` is an object, interface or union type field. Leaf selections on objects, interfaces, and unions without subfields are disallowed.", "locations": [ { "line": 1, @@ -17,4 +17,4 @@ } } ] -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Throw_ApplicationError.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Throw_ApplicationError.json similarity index 93% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Throw_ApplicationError.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Throw_ApplicationError.json index 96adc123a50..1ace396f70c 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Throw_ApplicationError.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Throw_ApplicationError.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "query error 10" @@ -7,4 +7,4 @@ "data": { "error10": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Throw_UnexpectedError.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Throw_UnexpectedError.json similarity index 97% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Throw_UnexpectedError.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Throw_UnexpectedError.json index 876dce477b0..9948d9c223a 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Throw_UnexpectedError.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Property_Throw_UnexpectedError.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Unexpected Execution Error", @@ -16,4 +16,4 @@ "data": { "error11": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.PureResolver_InvalidParentCast.json b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.PureResolver_InvalidParentCast.json new file mode 100644 index 00000000000..7fe149cef1c --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.PureResolver_InvalidParentCast.json @@ -0,0 +1,20 @@ +{ + "errors": [ + { + "message": "The resolver parent type of field `Foo.bar` is `HotChocolate.Execution.Errors.ErrorBehaviorTests+Baz` but the resolver requested the type `HotChocolate.Execution.Errors.ErrorBehaviorTests+Foo`. The resolver was unable to cast the parent type to the requested type.", + "path": [ + "foo", + "bar" + ], + "extensions": { + "field": "Foo.bar", + "code": "HC0053" + } + } + ], + "data": { + "foo": { + "bar": null + } + } +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.PureResolver_InvalidParentCast.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.PureResolver_InvalidParentCast.snap deleted file mode 100644 index 90e29d6a75d..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.PureResolver_InvalidParentCast.snap +++ /dev/null @@ -1,20 +0,0 @@ -{ - "errors": [ - { - "message": "The resolver parent type of field \u0060Foo.bar\u0060 is \u0060HotChocolate.Execution.Errors.ErrorBehaviorTests\u002BBaz\u0060 but the resolver requested the type \u0060HotChocolate.Execution.Errors.ErrorBehaviorTests\u002BFoo\u0060. The resolver was unable to cast the parent type to the requested type.", - "path": [ - "foo", - "bar" - ], - "extensions": { - "field": "Foo.bar", - "code": "HC0053" - } - } - ], - "data": { - "foo": { - "bar": null - } - } -} diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Resolver_InvalidParentCast.json b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Resolver_InvalidParentCast.json new file mode 100644 index 00000000000..7fe149cef1c --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Resolver_InvalidParentCast.json @@ -0,0 +1,20 @@ +{ + "errors": [ + { + "message": "The resolver parent type of field `Foo.bar` is `HotChocolate.Execution.Errors.ErrorBehaviorTests+Baz` but the resolver requested the type `HotChocolate.Execution.Errors.ErrorBehaviorTests+Foo`. The resolver was unable to cast the parent type to the requested type.", + "path": [ + "foo", + "bar" + ], + "extensions": { + "field": "Foo.bar", + "code": "HC0053" + } + } + ], + "data": { + "foo": { + "bar": null + } + } +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Resolver_InvalidParentCast.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Resolver_InvalidParentCast.snap deleted file mode 100644 index 90e29d6a75d..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.Resolver_InvalidParentCast.snap +++ /dev/null @@ -1,20 +0,0 @@ -{ - "errors": [ - { - "message": "The resolver parent type of field \u0060Foo.bar\u0060 is \u0060HotChocolate.Execution.Errors.ErrorBehaviorTests\u002BBaz\u0060 but the resolver requested the type \u0060HotChocolate.Execution.Errors.ErrorBehaviorTests\u002BFoo\u0060. The resolver was unable to cast the parent type to the requested type.", - "path": [ - "foo", - "bar" - ], - "extensions": { - "field": "Foo.bar", - "code": "HC0053" - } - } - ], - "data": { - "foo": { - "bar": null - } - } -} diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootFieldNotDefined.json b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootFieldNotDefined.json new file mode 100644 index 00000000000..566c370f1e0 --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootFieldNotDefined.json @@ -0,0 +1,19 @@ +{ + "errors": [ + { + "message": "The field `doesNotExist` does not exist on the type `Query`.", + "locations": [ + { + "line": 1, + "column": 9 + } + ], + "extensions": { + "type": "Query", + "field": "doesNotExist", + "responseName": "doesNotExist", + "specifiedBy": "https://spec.graphql.org/October2021/#sec-Field-Selections-on-Objects-Interfaces-and-Unions-Types" + } + } + ] +} diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootFieldNotDefined.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootFieldNotDefined.snap deleted file mode 100644 index 1366a63320f..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootFieldNotDefined.snap +++ /dev/null @@ -1,19 +0,0 @@ -{ - "errors": [ - { - "message": "The field \u0060foo\u0060 does not exist on the type \u0060Mutation\u0060.", - "locations": [ - { - "line": 1, - "column": 12 - } - ], - "extensions": { - "type": "Mutation", - "field": "foo", - "responseName": "foo", - "specifiedBy": "http://spec.graphql.org/October2021/#sec-Field-Selections-on-Objects-Interfaces-and-Unions-Types" - } - } - ] -} diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootTypeNotDefined.json b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootTypeNotDefined.json new file mode 100644 index 00000000000..52e10ed9dcf --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootTypeNotDefined.json @@ -0,0 +1,7 @@ +{ + "errors": [ + { + "message": "The specified root type `Mutation` is not supported by this server." + } + ] +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootTypeNotDefined.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootTypeNotDefined.snap deleted file mode 100644 index 3645bf8c3ac..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.RootTypeNotDefined.snap +++ /dev/null @@ -1,7 +0,0 @@ -{ - "errors": [ - { - "message": "The specified root type \u0060Mutation\u0060 is not supported by this server." - } - ] -} diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SetMaxAllowedValidationErrors_To_1.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SetMaxAllowedValidationErrors_To_1.json similarity index 78% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SetMaxAllowedValidationErrors_To_1.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SetMaxAllowedValidationErrors_To_1.json index 40f82aa3b50..6108d4604c4 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SetMaxAllowedValidationErrors_To_1.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SetMaxAllowedValidationErrors_To_1.json @@ -1,7 +1,7 @@ -{ +{ "errors": [ { - "message": "The field \u0060a\u0060 does not exist on the type \u0060Query\u0060.", + "message": "The field `a` does not exist on the type `Query`.", "locations": [ { "line": 1, @@ -16,4 +16,4 @@ } } ] -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Return_ApplicationError.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Return_ApplicationError.json similarity index 93% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Return_ApplicationError.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Return_ApplicationError.json index 2f2988d11e2..34d9f595d62 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Return_ApplicationError.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Return_ApplicationError.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "query error 9" @@ -7,4 +7,4 @@ "data": { "error9": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Throw_ApplicationError.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Throw_ApplicationError.json similarity index 93% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Throw_ApplicationError.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Throw_ApplicationError.json index 6af4d68b5fe..7e2506b6493 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Throw_ApplicationError.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Throw_ApplicationError.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "query error 7" @@ -7,4 +7,4 @@ "data": { "error7": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Throw_UnexpectedError.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Throw_UnexpectedError.json similarity index 97% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Throw_UnexpectedError.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Throw_UnexpectedError.json index bdddc5002b1..5c2c1e04fd3 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Throw_UnexpectedError.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyncMethod_Throw_UnexpectedError.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Unexpected Execution Error", @@ -16,4 +16,4 @@ "data": { "error8": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyntaxError.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyntaxError.json similarity index 63% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyntaxError.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyntaxError.json index 58e2939bf74..61336b6ed92 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyntaxError.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorBehaviorTests.SyntaxError.json @@ -1,7 +1,7 @@ -{ +{ "errors": [ { - "message": "Expected a \u0060Name\u0060-token, but found a \u0060EndOfFile\u0060-token.", + "message": "Expected a `Name`-token, but found a `EndOfFile`-token.", "locations": [ { "line": 1, @@ -13,4 +13,4 @@ } } ] -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilter.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilter.json similarity index 97% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilter.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilter.json index 61e9f12e967..08c01a17dfa 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilter.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilter.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Unexpected Execution Error", @@ -19,4 +19,4 @@ "data": { "foo": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterUsingDI_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterUsingDI_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.json similarity index 97% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterUsingDI_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterUsingDI_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.json index 61e9f12e967..08c01a17dfa 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterUsingDI_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterUsingDI_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Unexpected Execution Error", @@ -19,4 +19,4 @@ "data": { "foo": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterUsingFactory_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterUsingFactory_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.json similarity index 97% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterUsingFactory_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterUsingFactory_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.json index 61e9f12e967..08c01a17dfa 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterUsingFactory_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterUsingFactory_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Unexpected Execution Error", @@ -19,4 +19,4 @@ "data": { "foo": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterWithFactory.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterWithFactory.json similarity index 97% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterWithFactory.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterWithFactory.json index 61e9f12e967..08c01a17dfa 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterWithFactory.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilterWithFactory.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Unexpected Execution Error", @@ -19,4 +19,4 @@ "data": { "foo": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilter_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.json b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilter_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.json new file mode 100644 index 00000000000..08c01a17dfa --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilter_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.json @@ -0,0 +1,22 @@ +{ + "errors": [ + { + "message": "Unexpected Execution Error", + "locations": [ + { + "line": 1, + "column": 3 + } + ], + "path": [ + "foo" + ], + "extensions": { + "code": "Foo123" + } + } + ], + "data": { + "foo": null + } +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilter_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilter_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.snap deleted file mode 100644 index 61e9f12e967..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddClassErrorFilter_SchemaBuiltViaServiceExtensions_ErrorFilterWorks.snap +++ /dev/null @@ -1,22 +0,0 @@ -{ - "errors": [ - { - "message": "Unexpected Execution Error", - "locations": [ - { - "line": 1, - "column": 3 - } - ], - "path": [ - "foo" - ], - "extensions": { - "code": "Foo123" - } - } - ], - "data": { - "foo": null - } -} diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddFuncErrorFilter.json b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddFuncErrorFilter.json new file mode 100644 index 00000000000..08c01a17dfa --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddFuncErrorFilter.json @@ -0,0 +1,22 @@ +{ + "errors": [ + { + "message": "Unexpected Execution Error", + "locations": [ + { + "line": 1, + "column": 3 + } + ], + "path": [ + "foo" + ], + "extensions": { + "code": "Foo123" + } + } + ], + "data": { + "foo": null + } +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddFuncErrorFilter.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddFuncErrorFilter.snap deleted file mode 100644 index 61e9f12e967..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.AddFuncErrorFilter.snap +++ /dev/null @@ -1,22 +0,0 @@ -{ - "errors": [ - { - "message": "Unexpected Execution Error", - "locations": [ - { - "line": 1, - "column": 3 - } - ], - "path": [ - "foo" - ], - "extensions": { - "code": "Foo123" - } - } - ], - "data": { - "foo": null - } -} diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.FilterOnlyNullRefExceptions.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.FilterOnlyNullRefExceptions.json similarity index 98% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.FilterOnlyNullRefExceptions.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.FilterOnlyNullRefExceptions.json index 3d3b389af61..bb2f7e0a1f7 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.FilterOnlyNullRefExceptions.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.FilterOnlyNullRefExceptions.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Unexpected Execution Error", @@ -32,4 +32,4 @@ "foo": null, "bar": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.ReportAggregateError_In_Resolver.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.ReportAggregateError_In_Resolver.json similarity index 94% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.ReportAggregateError_In_Resolver.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.ReportAggregateError_In_Resolver.json index 9778cbd6a82..a2895179e6a 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.ReportAggregateError_In_Resolver.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.ReportAggregateError_In_Resolver.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "abc" @@ -10,4 +10,4 @@ "data": { "foo": "Hello" } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.UseAggregateError_In_ErrorFilter.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.UseAggregateError_In_ErrorFilter.json similarity index 98% rename from src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.UseAggregateError_In_ErrorFilter.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.UseAggregateError_In_ErrorFilter.json index 9907edee218..67d8639c618 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.UseAggregateError_In_ErrorFilter.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/ErrorHandlerTests.UseAggregateError_In_ErrorFilter.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Unexpected Execution Error", @@ -34,4 +34,4 @@ "data": { "foo": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nonnull_element.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nonnull_element.json similarity index 92% rename from src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nonnull_element.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nonnull_element.json index 371d1ab3673..3a239082f0e 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nonnull_element.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nonnull_element.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "ERROR" @@ -7,4 +7,4 @@ "data": { "foo": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nullable_element.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nullable_element.json similarity index 95% rename from src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nullable_element.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nullable_element.json index 1092de8950d..385c623a03e 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nullable_element.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nonnull_list_nullable_element.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "ERROR" @@ -11,4 +11,4 @@ ] } } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nonnull_element.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nonnull_element.json similarity index 95% rename from src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nonnull_element.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nonnull_element.json index 18bd7ac20dd..0254d389784 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nonnull_element.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nonnull_element.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "ERROR" @@ -9,4 +9,4 @@ "nullable_list_nonnull_element": null } } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nullable_element.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nullable_element.json similarity index 95% rename from src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nullable_element.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nullable_element.json index 27b3dd27d55..f294f71794d 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nullable_element.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementHasError_nullable_list_nullable_element.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "ERROR" @@ -11,4 +11,4 @@ ] } } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nonnull_element.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nonnull_element.json similarity index 98% rename from src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nonnull_element.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nonnull_element.json index c6507dbcc25..45feb5cbcfc 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nonnull_element.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nonnull_element.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Cannot return null for non-nullable field.", @@ -22,4 +22,4 @@ "data": { "foo": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nullable_element.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nullable_element.json similarity index 98% rename from src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nullable_element.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nullable_element.json index ce618efab8d..888e6e9e020 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nullable_element.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nonnull_list_nullable_element.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Cannot return null for non-nullable field.", @@ -26,4 +26,4 @@ ] } } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nonnull_element.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nonnull_element.json similarity index 98% rename from src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nonnull_element.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nonnull_element.json index 6b3b01252e1..e7d420d1cf1 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nonnull_element.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nonnull_element.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Cannot return null for non-nullable field.", @@ -24,4 +24,4 @@ "nullable_list_nonnull_element": null } } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nullable_element.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nullable_element.json similarity index 98% rename from src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nullable_element.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nullable_element.json index 4b984279515..63efeeea7d9 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nullable_element.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.List_NonNullElementIsNull_nullable_list_nullable_element.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Cannot return null for non-nullable field.", @@ -26,4 +26,4 @@ ] } } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Lists_NullableElementIsNull.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Lists_NullableElementIsNull.json similarity index 98% rename from src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Lists_NullableElementIsNull.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Lists_NullableElementIsNull.json index 37d7e2474b0..b6fc4c430a1 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Lists_NullableElementIsNull.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Lists_NullableElementIsNull.json @@ -1,4 +1,4 @@ -{ +{ "data": { "foo": { "nullable_list_nullable_element": [ @@ -27,4 +27,4 @@ ] } } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nonnull_prop.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nonnull_prop.json similarity index 92% rename from src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nonnull_prop.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nonnull_prop.json index 371d1ab3673..3a239082f0e 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nonnull_prop.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nonnull_prop.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "ERROR" @@ -7,4 +7,4 @@ "data": { "foo": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nullable_prop.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nullable_prop.json similarity index 94% rename from src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nullable_prop.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nullable_prop.json index 0f71fbe4438..2da9d24a8a1 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nullable_prop.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementHasError_nullable_prop.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "ERROR" @@ -9,4 +9,4 @@ "nullable_prop": null } } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nonnull_prop.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nonnull_prop.json similarity index 98% rename from src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nonnull_prop.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nonnull_prop.json index 9acd9ec250e..446d111fd9f 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nonnull_prop.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nonnull_prop.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Cannot return null for non-nullable field.", @@ -21,4 +21,4 @@ "data": { "foo": null } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nullable_prop.snap b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nullable_prop.json similarity index 98% rename from src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nullable_prop.snap rename to src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nullable_prop.json index b209de90930..7aad1885b4e 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nullable_prop.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Errors/__snapshots__/NullErrorPropagation.Object_NonNullElementIsNull_nullable_prop.json @@ -1,4 +1,4 @@ -{ +{ "errors": [ { "message": "Cannot return null for non-nullable field.", @@ -23,4 +23,4 @@ "nullable_prop": null } } -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader.snap index d8924263305..d5f0ca74218 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader.snap @@ -23,7 +23,8 @@ }, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": true }, { "Kind": "SingleResult", @@ -43,7 +44,8 @@ }, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": true }, { "Kind": "SingleResult", @@ -63,6 +65,7 @@ }, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": true } ] diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader_Resolve_From_DependencyInjection.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader_Resolve_From_DependencyInjection.snap index 4e51e804f16..fcab9c092a0 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader_Resolve_From_DependencyInjection.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/DataLoader/__snapshots__/DataLoaderTests.ClassDataLoader_Resolve_From_DependencyInjection.snap @@ -19,7 +19,8 @@ }, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": true }, { "Kind": "SingleResult", @@ -39,7 +40,8 @@ }, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": true }, { "Kind": "SingleResult", @@ -59,6 +61,7 @@ }, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": true } ] diff --git a/src/HotChocolate/Core/test/Execution.Tests/Integration/Spec/__snapshots__/ArgumentCoercionTests.Pass_In_Null_To_NonNullArgument_With_DefaultValue.snap b/src/HotChocolate/Core/test/Execution.Tests/Integration/Spec/__snapshots__/ArgumentCoercionTests.Pass_In_Null_To_NonNullArgument_With_DefaultValue.snap index 5df7530226d..3f336c56ce4 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/Integration/Spec/__snapshots__/ArgumentCoercionTests.Pass_In_Null_To_NonNullArgument_With_DefaultValue.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/Integration/Spec/__snapshots__/ArgumentCoercionTests.Pass_In_Null_To_NonNullArgument_With_DefaultValue.snap @@ -1,7 +1,7 @@ { "errors": [ { - "message": "Detected a non-null violation in argument \u0060name\u0060.", + "message": "Detected a non-null violation in argument `name`.", "locations": [ { "line": 1, @@ -15,5 +15,6 @@ ] } } - ] + ], + "data": null } diff --git a/src/HotChocolate/Core/test/Execution.Tests/NullErrorPropagationTests.cs b/src/HotChocolate/Core/test/Execution.Tests/NullErrorPropagationTests.cs deleted file mode 100644 index dc6e6b93dc4..00000000000 --- a/src/HotChocolate/Core/test/Execution.Tests/NullErrorPropagationTests.cs +++ /dev/null @@ -1,184 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; -using HotChocolate.Tests; -using Xunit; - -namespace HotChocolate.Execution; - -public class NullErrorPropagation -{ - [Fact] - public async Task Lists_NullableElementIsNull() - { - // arrange - var executor = CreateExecutor(); - - var request = - QueryRequestBuilder.New() - .SetQuery(@" - { - foo { - nullable_list_nullable_element - { - a - b - } - nonnull_list_nullable_element - { - a - b - } - nullable_list_nonnull_element - { - a - b - } - nonnull_list_nonnull_element - { - a - b - } - } - }") - .AddGlobalState("a", null) - .AddGlobalState("b", "not_null") - .Create(); - - // act - var result = await executor.ExecuteAsync( - request, CancellationToken.None); - - // assert - result.MatchSnapshot(); - } - - [InlineData("nullable_list_nullable_element")] - [InlineData("nonnull_list_nullable_element")] - [InlineData("nullable_list_nonnull_element")] - [InlineData("nonnull_list_nonnull_element")] - [Theory] - public async Task List_NonNullElementIsNull(string fieldType) - { - // arrange - var executor = CreateExecutor(); - - var request = - QueryRequestBuilder.New() - .SetQuery($"{{ foo {{ {fieldType} {{ b }} }} }}") - .AddGlobalState("b", null) - .Create(); - - // act - var result = await executor.ExecuteAsync( - request, CancellationToken.None); - - // assert - result.MatchSnapshot(fieldType); - } - - [InlineData("nullable_list_nullable_element")] - [InlineData("nullable_list_nonnull_element")] - [InlineData("nonnull_list_nullable_element")] - [InlineData("nonnull_list_nonnull_element")] - [Theory] - public async Task List_NonNullElementHasError(string fieldType) - { - // arrange - var executor = CreateExecutor(); - - var request = - QueryRequestBuilder.New() - .SetQuery($"{{ foo {{ {fieldType} {{ c }} }} }}") - .AddGlobalState("b", null) - .Create(); - - // act - var result = await executor.ExecuteAsync(request, CancellationToken.None); - - // assert - result.MatchSnapshot(fieldType); - } - - [InlineData("nonnull_prop")] - [InlineData("nullable_prop")] - [Theory] - public async Task Object_NonNullElementIsNull(string fieldType) - { - // arrange - var executor = CreateExecutor(); - - var request = - QueryRequestBuilder.New() - .SetQuery($"{{ foo {{ {fieldType} {{ b }} }} }}") - .AddGlobalState("b", null) - .Create(); - - // act - var result = await executor.ExecuteAsync( - request, CancellationToken.None); - - // assert - result.MatchSnapshot(fieldType); - } - - [InlineData("nonnull_prop")] - [InlineData("nullable_prop")] - [Theory] - public async Task Object_NonNullElementHasError(string fieldType) - { - // arrange - var executor = CreateExecutor(); - - var request = - QueryRequestBuilder.New() - .SetQuery($"{{ foo {{ {fieldType} {{ c }} }} }}") - .AddGlobalState("b", null) - .Create(); - - // act - var result = await executor.ExecuteAsync( - request, CancellationToken.None); - - // assert - result.MatchSnapshot(fieldType); - } - - private IRequestExecutor CreateExecutor() - { - var schema = @" - type Query { - foo: Foo - } - - type Foo { - nullable_list_nullable_element: [Bar] - nonnull_list_nullable_element: [Bar]! - nullable_list_nonnull_element: [Bar!] - nonnull_list_nonnull_element: [Bar!]! - nonnull_prop: Bar! - nullable_prop: Bar - } - - type Bar { - a: String - b: String! - c: String! - } - "; - - return SchemaBuilder.New() - .AddDocumentFromString(schema) - .AddResolver("Query.foo", _ => new(new object())) - .AddResolver("Foo.nullable_list_nullable_element", _ => new(new[] { new object() })) - .AddResolver("Foo.nonnull_list_nullable_element", _ => new(new[] { new object() })) - .AddResolver("Foo.nullable_list_nonnull_element", _ => new(new[] { new object() })) - .AddResolver("Foo.nonnull_list_nonnull_element", _ => new(new[] { new object() })) - .AddResolver("Foo.nonnull_prop", _ => new(new object())) - .AddResolver("Foo.nullable_prop", _ => new(new object())) - .AddResolver("Bar.a", c => new(c.GetGlobalStateOrDefault("a"))) - .AddResolver("Bar.b", c => new(c.GetGlobalStateOrDefault("b"))) - .AddResolver("Bar.c", _ => throw new GraphQLException("ERROR")) - .Create() - .MakeExecutable(); - } -} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/SnapshotHelpers.cs b/src/HotChocolate/Core/test/Execution.Tests/SnapshotHelpers.cs new file mode 100644 index 00000000000..8947c4a54a6 --- /dev/null +++ b/src/HotChocolate/Core/test/Execution.Tests/SnapshotHelpers.cs @@ -0,0 +1,11 @@ +#nullable enable + +using CookieCrumble; + +namespace HotChocolate.Execution; + +public static class SnapshotHelpers +{ + public static DisposableSnapshot StartResultSnapshot(string? postFix = null) + => Snapshot.Start(postFix: postFix, extension: ".json"); +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/ClientControlledNullabilityTests.Make_NullableField_NonNull_And_Return_Null.snap b/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/ClientControlledNullabilityTests.Make_NullableField_NonNull_And_Return_Null.snap index ca6a6e94adb..29c72c7d137 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/ClientControlledNullabilityTests.Make_NullableField_NonNull_And_Return_Null.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/ClientControlledNullabilityTests.Make_NullableField_NonNull_And_Return_Null.snap @@ -15,5 +15,6 @@ "code": "HC0018" } } - ] + ], + "data": null } diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/ScopedContextDataTests.ScopedContextDataIsPassedAlongCorrectly.snap b/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/ScopedContextDataTests.ScopedContextDataIsPassedAlongCorrectly.snap index d02949c28db..c7909f4f144 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/ScopedContextDataTests.ScopedContextDataIsPassedAlongCorrectly.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/ScopedContextDataTests.ScopedContextDataIsPassedAlongCorrectly.snap @@ -17,5 +17,6 @@ "Extensions": null, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": true } diff --git a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/SourceObjectConversionTests.ConvertSourceObject.snap b/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/SourceObjectConversionTests.ConvertSourceObject.snap index 02435429b80..de364a66e3a 100644 --- a/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/SourceObjectConversionTests.ConvertSourceObject.snap +++ b/src/HotChocolate/Core/test/Execution.Tests/__snapshots__/SourceObjectConversionTests.ConvertSourceObject.snap @@ -12,5 +12,6 @@ "Extensions": null, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": true } diff --git a/src/HotChocolate/Core/test/Types.Mutations.Tests/__snapshots__/AnnotationBasedMutations.List_Return_Type.graphql b/src/HotChocolate/Core/test/Types.Mutations.Tests/__snapshots__/AnnotationBasedMutations.List_Return_Type.graphql index 6f3cfb88731..24e018e9f67 100644 --- a/src/HotChocolate/Core/test/Types.Mutations.Tests/__snapshots__/AnnotationBasedMutations.List_Return_Type.graphql +++ b/src/HotChocolate/Core/test/Types.Mutations.Tests/__snapshots__/AnnotationBasedMutations.List_Return_Type.graphql @@ -21,4 +21,4 @@ type ResultItem { input AddItemInput { count: Int! -} +} \ No newline at end of file diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/IdAttributeTests.Id_On_Objects_InvalidId.snap b/src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/IdAttributeTests.Id_On_Objects_InvalidId.snap index 45098ffc45f..6a8e0225826 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/IdAttributeTests.Id_On_Objects_InvalidId.snap +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/IdAttributeTests.Id_On_Objects_InvalidId.snap @@ -1,4 +1,4 @@ { - "result": "{\n \"errors\": [\n {\n \"message\": \"The ID `abc` has an invalid format.\"\n }\n ]\n}", + "result": "{\n \"errors\": [\n {\n \"message\": \"The ID `abc` has an invalid format.\"\n }\n ],\n \"data\": null\n}", "someId": "abc" } diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/IdAttributeTests.Id_On_Objects_InvalidType.snap b/src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/IdAttributeTests.Id_On_Objects_InvalidType.snap index 4be7d0beed6..f3536b56fa4 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/IdAttributeTests.Id_On_Objects_InvalidType.snap +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/IdAttributeTests.Id_On_Objects_InvalidType.snap @@ -1,4 +1,4 @@ { - "result": "{\n \"errors\": [\n {\n \"message\": \"The IDs `U29tZQpnMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA=` have an invalid format.\"\n }\n ]\n}", + "result": "{\n \"errors\": [\n {\n \"message\": \"The IDs `U29tZQpnMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA=` have an invalid format.\"\n }\n ],\n \"data\": null\n}", "someId": "U29tZQpnMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA=" } diff --git a/src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/NodeFieldSupportTests.Tow_Many_Nodes.snap b/src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/NodeFieldSupportTests.Tow_Many_Nodes.snap index 34793e6344f..f04180fde76 100644 --- a/src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/NodeFieldSupportTests.Tow_Many_Nodes.snap +++ b/src/HotChocolate/Core/test/Types.Tests/Types/Relay/__snapshots__/NodeFieldSupportTests.Tow_Many_Nodes.snap @@ -15,5 +15,6 @@ "code": "HC0076" } } - ] + ], + "data": null } \ No newline at end of file diff --git a/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeMissingMiddleware_NET6_0.snap b/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeMissingMiddleware_NET6_0.snap index 373c280e7ce..7ccd948a1b6 100644 --- a/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeMissingMiddleware_NET6_0.snap +++ b/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeMissingMiddleware_NET6_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeMissingMiddleware_NET7_0.snap b/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeMissingMiddleware_NET7_0.snap index 373c280e7ce..7ccd948a1b6 100644 --- a/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeMissingMiddleware_NET7_0.snap +++ b/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeMissingMiddleware_NET7_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeMissingMiddleware_NET8_0.snap b/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeMissingMiddleware_NET8_0.snap index 373c280e7ce..7ccd948a1b6 100644 --- a/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeMissingMiddleware_NET8_0.snap +++ b/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeMissingMiddleware_NET8_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeTypeMissMatch_NET6_0.snap b/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeTypeMissMatch_NET6_0.snap index b8b2726baa1..ef429e6b34b 100644 --- a/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeTypeMissMatch_NET6_0.snap +++ b/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeTypeMissMatch_NET6_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeTypeMissMatch_NET7_0.snap b/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeTypeMissMatch_NET7_0.snap index b8b2726baa1..ef429e6b34b 100644 --- a/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeTypeMissMatch_NET7_0.snap +++ b/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeTypeMissMatch_NET7_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeTypeMissMatch_NET8_0.snap b/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeTypeMissMatch_NET8_0.snap index b8b2726baa1..ef429e6b34b 100644 --- a/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeTypeMissMatch_NET8_0.snap +++ b/src/HotChocolate/Data/test/Data.Filters.Tests/__snapshots__/QueryableFilteringExtensionsTests.Extension_Should_BeTypeMissMatch_NET8_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeMissingMiddleware_NET6_0.snap b/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeMissingMiddleware_NET6_0.snap index 9996673dd10..97df417ce81 100644 --- a/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeMissingMiddleware_NET6_0.snap +++ b/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeMissingMiddleware_NET6_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeMissingMiddleware_NET7_0.snap b/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeMissingMiddleware_NET7_0.snap index 9996673dd10..97df417ce81 100644 --- a/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeMissingMiddleware_NET7_0.snap +++ b/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeMissingMiddleware_NET7_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeMissingMiddleware_NET8_0.snap b/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeMissingMiddleware_NET8_0.snap index 9996673dd10..97df417ce81 100644 --- a/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeMissingMiddleware_NET8_0.snap +++ b/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeMissingMiddleware_NET8_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeTypeMissMatch_NET6_0.snap b/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeTypeMissMatch_NET6_0.snap index 923619973d8..6217cee291b 100644 --- a/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeTypeMissMatch_NET6_0.snap +++ b/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeTypeMissMatch_NET6_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeTypeMissMatch_NET7_0.snap b/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeTypeMissMatch_NET7_0.snap index 923619973d8..6217cee291b 100644 --- a/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeTypeMissMatch_NET7_0.snap +++ b/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeTypeMissMatch_NET7_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeTypeMissMatch_NET8_0.snap b/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeTypeMissMatch_NET8_0.snap index 923619973d8..6217cee291b 100644 --- a/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeTypeMissMatch_NET8_0.snap +++ b/src/HotChocolate/Data/test/Data.Projections.SqlServer.Tests/__snapshots__/QueryableProjectionExtensionsTests.Extension_Should_BeTypeMissMatch_NET8_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeMissingMiddleware_NET6_0.snap b/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeMissingMiddleware_NET6_0.snap index 2757f8b6948..1f2adad2388 100644 --- a/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeMissingMiddleware_NET6_0.snap +++ b/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeMissingMiddleware_NET6_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeMissingMiddleware_NET7_0.snap b/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeMissingMiddleware_NET7_0.snap index 2757f8b6948..1f2adad2388 100644 --- a/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeMissingMiddleware_NET7_0.snap +++ b/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeMissingMiddleware_NET7_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeMissingMiddleware_NET8_0.snap b/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeMissingMiddleware_NET8_0.snap index 2757f8b6948..1f2adad2388 100644 --- a/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeMissingMiddleware_NET8_0.snap +++ b/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeMissingMiddleware_NET8_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeTypeMissMatch_NET6_0.snap b/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeTypeMissMatch_NET6_0.snap index 86d4567a491..47be544c8f2 100644 --- a/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeTypeMissMatch_NET6_0.snap +++ b/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeTypeMissMatch_NET6_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeTypeMissMatch_NET7_0.snap b/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeTypeMissMatch_NET7_0.snap index 86d4567a491..47be544c8f2 100644 --- a/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeTypeMissMatch_NET7_0.snap +++ b/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeTypeMissMatch_NET7_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeTypeMissMatch_NET8_0.snap b/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeTypeMissMatch_NET8_0.snap index 86d4567a491..47be544c8f2 100644 --- a/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeTypeMissMatch_NET8_0.snap +++ b/src/HotChocolate/Data/test/Data.Sorting.Tests/__snapshots__/QueryableSortingExtensionsTests.Extension_Should_BeTypeMissMatch_NET8_0.snap @@ -17,7 +17,8 @@ Result: "code": "HC0018" } } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/ErrorTests.Accounts_Offline_Author_NonNull.snap b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/ErrorTests.Accounts_Offline_Author_NonNull.snap index 375883b9b27..99fd8821829 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/ErrorTests.Accounts_Offline_Author_NonNull.snap +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/ErrorTests.Accounts_Offline_Author_NonNull.snap @@ -75,7 +75,8 @@ Result { "message": "Internal Execution Error" } - ] + ], + "data": null } --------------- diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/ErrorTests.Internal_Server_Error_On_Root_Field.snap b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/ErrorTests.Internal_Server_Error_On_Root_Field.snap index 57b92a2afbd..ea0ab9640e3 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/ErrorTests.Internal_Server_Error_On_Root_Field.snap +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/ErrorTests.Internal_Server_Error_On_Root_Field.snap @@ -3,5 +3,6 @@ { "message": "Internal Execution Error" } - ] + ], + "data": null } \ No newline at end of file diff --git a/src/HotChocolate/PersistedQueries/test/PersistedQueries.FileSystem.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery.snap b/src/HotChocolate/PersistedQueries/test/PersistedQueries.FileSystem.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery.snap index d90a546a5e0..b09b91346d1 100644 --- a/src/HotChocolate/PersistedQueries/test/PersistedQueries.FileSystem.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery.snap +++ b/src/HotChocolate/PersistedQueries/test/PersistedQueries.FileSystem.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery.snap @@ -12,5 +12,6 @@ }, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": true } diff --git a/src/HotChocolate/PersistedQueries/test/PersistedQueries.FileSystem.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_NotFound.snap b/src/HotChocolate/PersistedQueries/test/PersistedQueries.FileSystem.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_NotFound.snap index bc64bace53a..88609d7f2f2 100644 --- a/src/HotChocolate/PersistedQueries/test/PersistedQueries.FileSystem.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_NotFound.snap +++ b/src/HotChocolate/PersistedQueries/test/PersistedQueries.FileSystem.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_NotFound.snap @@ -23,5 +23,6 @@ "ContextData": { "HotChocolate.Execution.Transport.HttpStatusCode": 400 }, - "HasNext": null + "HasNext": null, + "IsDataSet": false } diff --git a/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery.snap b/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery.snap index d90a546a5e0..b09b91346d1 100644 --- a/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery.snap +++ b/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery.snap @@ -12,5 +12,6 @@ }, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": true } diff --git a/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_ApplicationDI.snap b/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_ApplicationDI.snap index d90a546a5e0..b09b91346d1 100644 --- a/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_ApplicationDI.snap +++ b/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_ApplicationDI.snap @@ -12,5 +12,6 @@ }, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": true } diff --git a/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_ApplicationDI_Default.snap b/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_ApplicationDI_Default.snap index d90a546a5e0..b09b91346d1 100644 --- a/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_ApplicationDI_Default.snap +++ b/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_ApplicationDI_Default.snap @@ -12,5 +12,6 @@ }, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": true } diff --git a/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_Before_Expiration.snap b/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_Before_Expiration.snap index d90a546a5e0..b09b91346d1 100644 --- a/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_Before_Expiration.snap +++ b/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_Before_Expiration.snap @@ -12,5 +12,6 @@ }, "Incremental": null, "ContextData": null, - "HasNext": null + "HasNext": null, + "IsDataSet": true } diff --git a/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_NotFound.snap b/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_NotFound.snap index bc64bace53a..88609d7f2f2 100644 --- a/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_NotFound.snap +++ b/src/HotChocolate/PersistedQueries/test/PersistedQueries.Redis.Tests/__snapshots__/IntegrationTests.ExecutePersistedQuery_NotFound.snap @@ -23,5 +23,6 @@ "ContextData": { "HotChocolate.Execution.Transport.HttpStatusCode": 400 }, - "HasNext": null + "HasNext": null, + "IsDataSet": false } diff --git a/src/HotChocolate/Spatial/test/Types.Tests/__snapshots__/TransformationIntegrationTests.Execute_InputUnknownCRS_RaiseException.snap b/src/HotChocolate/Spatial/test/Types.Tests/__snapshots__/TransformationIntegrationTests.Execute_InputUnknownCRS_RaiseException.snap index 916f6e1529a..441465900a7 100644 --- a/src/HotChocolate/Spatial/test/Types.Tests/__snapshots__/TransformationIntegrationTests.Execute_InputUnknownCRS_RaiseException.snap +++ b/src/HotChocolate/Spatial/test/Types.Tests/__snapshots__/TransformationIntegrationTests.Execute_InputUnknownCRS_RaiseException.snap @@ -6,5 +6,6 @@ "code": "HC0029" } } - ] + ], + "data": null } \ No newline at end of file