Skip to content

Commit cd808c6

Browse files
Remove TrueNullability prototype (#7675)
1 parent ad8fdf0 commit cd808c6

File tree

36 files changed

+171
-625
lines changed

36 files changed

+171
-625
lines changed

src/HotChocolate/Core/src/Abstractions/WellKnownContextData.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,6 @@ public static class WellKnownContextData
259259
/// </summary>
260260
public const string AllowAnonymous = "HotChocolate.Authorization.AllowAnonymous";
261261

262-
/// <summary>
263-
/// The key to access the true nullability flag on the execution context.
264-
/// </summary>
265-
public const string EnableTrueNullability = "HotChocolate.Types.EnableTrueNullability";
266-
267262
/// <summary>
268263
/// The key to access the tag options object.
269264
/// </summary>

src/HotChocolate/Core/src/Execution/ErrorHelper.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,4 @@ public static IError ReadPersistedOperationMiddleware_PersistedOperationNotFound
228228
.SetMessage("PersistedQueryNotFound")
229229
.SetCode(ErrorCodes.Execution.PersistedOperationNotFound)
230230
.Build();
231-
232-
public static IError NoNullBubbling_ArgumentValue_NotAllowed(
233-
ArgumentNode argument)
234-
{
235-
var errorBuilder = ErrorBuilder.New();
236-
errorBuilder.SetLocations([argument.Value]);
237-
errorBuilder.SetMessage(ErrorHelper_NoNullBubbling_ArgumentValue_NotAllowed);
238-
239-
return errorBuilder.Build();
240-
}
241231
}

src/HotChocolate/Core/src/Execution/Pipeline/OperationResolverMiddleware.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ private IOperation CompileOperation(
7373
operationType,
7474
context.Schema,
7575
_operationCompilerOptimizers.OperationOptimizers,
76-
_operationCompilerOptimizers.SelectionSetOptimizers,
77-
context.IsNullBubblingEnabled());
76+
_operationCompilerOptimizers.SelectionSetOptimizers);
7877

7978
var compiler = _operationCompilerPool.Get();
8079
var operation = compiler.Compile(request);

src/HotChocolate/Core/src/Execution/Pipeline/PipelineTools.cs

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,9 @@ public static string CreateCacheId(this IRequestContext context)
2828

2929
var operationId = CreateOperationId(documentId, operationName);
3030

31-
var flags = OperationFlags.Nothing;
32-
33-
if (!context.IsNullBubblingEnabled())
34-
{
35-
flags |= OperationFlags.DisableNullBubbling;
36-
}
37-
38-
return $"{context.Schema.Name}-{context.ExecutorVersion}-{(int)flags}-{operationId}";
31+
return $"{context.Schema.Name}-{context.ExecutorVersion}-{operationId}";
3932
}
4033

41-
public static bool IsNullBubblingEnabled(this IRequestContext context)
42-
=> !context.Schema.ContextData.ContainsKey(WellKnownContextData.EnableTrueNullability)
43-
|| !context.ContextData.ContainsKey(WellKnownContextData.EnableTrueNullability);
44-
4534
public static IReadOnlyList<IVariableValueCollection> CoerceVariables(
4635
IRequestContext context,
4736
VariableCoercionHelper coercionHelper,
@@ -104,11 +93,4 @@ public static IReadOnlyList<IVariableValueCollection> CoerceVariables(
10493

10594
throw new NotSupportedException("Request type not supported.");
10695
}
107-
108-
[Flags]
109-
private enum OperationFlags
110-
{
111-
Nothing = 0,
112-
DisableNullBubbling
113-
}
11496
}

src/HotChocolate/Core/src/Execution/Processing/OperationCompiler.CompilerContext.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace HotChocolate.Execution.Processing;
77

88
public sealed partial class OperationCompiler
99
{
10-
internal sealed class CompilerContext(ISchema schema, DocumentNode document, bool enableNullBubbling)
10+
internal sealed class CompilerContext(ISchema schema, DocumentNode document)
1111
{
1212
public ISchema Schema { get; } = schema;
1313

@@ -27,8 +27,6 @@ internal sealed class CompilerContext(ISchema schema, DocumentNode document, boo
2727

2828
public ImmutableArray<ISelectionSetOptimizer> Optimizers { get; private set; }
2929

30-
public bool EnableNullBubbling { get; } = enableNullBubbling;
31-
3230
public void Initialize(
3331
ObjectType type,
3432
SelectionVariants selectionVariants,

src/HotChocolate/Core/src/Execution/Processing/OperationCompiler.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public IOperation Compile(OperationCompilerRequest request)
8080
var variants = GetOrCreateSelectionVariants(id);
8181
SelectionSetInfo[] infos = [new(request.Definition.SelectionSet, 0)];
8282

83-
var context = new CompilerContext(request.Schema, request.Document, request.EnableNullBubbling);
83+
var context = new CompilerContext(request.Schema, request.Document);
8484
context.Initialize(request.RootType, variants, infos, rootPath, selectionSetOptimizers);
8585
CompileSelectionSet(context);
8686

@@ -419,9 +419,7 @@ private void ResolveField(
419419

420420
if (context.Type.Fields.TryGetField(fieldName, out var field))
421421
{
422-
var fieldType = context.EnableNullBubbling
423-
? field.Type
424-
: field.Type.RewriteToNullableType();
422+
var fieldType = field.Type;
425423

426424
if (context.Fields.TryGetValue(responseName, out var preparedSelection))
427425
{
@@ -739,7 +737,7 @@ private CompilerContext RentContext(CompilerContext context)
739737
{
740738
if (_deferContext is null)
741739
{
742-
return new CompilerContext(context.Schema, context.Document, context.EnableNullBubbling);
740+
return new CompilerContext(context.Schema, context.Document);
743741
}
744742

745743
var temp = _deferContext;

src/HotChocolate/Core/src/Execution/Processing/OperationCompilerOptimizers.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ public OperationCompilerRequest(
6060
ObjectType rootType,
6161
ISchema schema,
6262
ImmutableArray<IOperationOptimizer>? operationOptimizers = null,
63-
ImmutableArray<ISelectionSetOptimizer>? selectionSetOptimizers = null,
64-
bool enableNullBubbling = true)
63+
ImmutableArray<ISelectionSetOptimizer>? selectionSetOptimizers = null)
6564
{
6665
if (string.IsNullOrEmpty(id))
6766
{
@@ -77,7 +76,6 @@ public OperationCompilerRequest(
7776
Schema = schema ?? throw new ArgumentNullException(nameof(schema));
7877
OperationOptimizers = operationOptimizers ?? ImmutableArray<IOperationOptimizer>.Empty;
7978
SelectionSetOptimizers = selectionSetOptimizers ?? ImmutableArray<ISelectionSetOptimizer>.Empty;
80-
EnableNullBubbling = enableNullBubbling;
8179
}
8280

8381
/// <summary>
@@ -109,6 +107,4 @@ public OperationCompilerRequest(
109107
public ImmutableArray<IOperationOptimizer> OperationOptimizers { get; }
110108

111109
public ImmutableArray<ISelectionSetOptimizer> SelectionSetOptimizers { get; }
112-
113-
public bool EnableNullBubbling { get; }
114110
}

0 commit comments

Comments
 (0)