Skip to content

Commit 87cde80

Browse files
authored
Fix nullability context handling in RDG (#54354)
1 parent 67d74e2 commit 87cde80

15 files changed

+15
-14
lines changed

src/Http/Http.Extensions/gen/StaticRouteHandlerModel/StaticRouteHandlerModel.Emitter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ public static void EmitJsonAcceptsMetadata(this Endpoint endpoint, CodeWriter co
325325
{
326326
codeWriter.WriteLine($$"""({{(parameter.IsOptional ? "true" : "false")}}, typeof({{parameter.Type.ToDisplayString(EmitterConstants.DisplayFormatWithoutNullability)}})),""");
327327
}
328-
codeWriter.WriteLine("#nullable restore");
328+
codeWriter.WriteLine("#nullable enable");
329329
codeWriter.Indent--;
330330
codeWriter.WriteLine("};");
331331
codeWriter.WriteLine("foreach (var (isOptional, type) in jsonBodyOrServiceTypeTuples)");

src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ImplicitQuery_NullableStringArrayParam.generated.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.Http.Generated
7474
var jsonBodyOrServiceTypeTuples = new (bool, Type)[] {
7575
#nullable disable
7676
(false, typeof(global::System.String[])),
77-
#nullable restore
77+
#nullable enable
7878
};
7979
foreach (var (isOptional, type) in jsonBodyOrServiceTypeTuples)
8080
{

src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ImplicitQuery_NullableStringArrayParam_EmptyQueryValues.generated.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.Http.Generated
7474
var jsonBodyOrServiceTypeTuples = new (bool, Type)[] {
7575
#nullable disable
7676
(false, typeof(global::System.String[])),
77-
#nullable restore
77+
#nullable enable
7878
};
7979
foreach (var (isOptional, type) in jsonBodyOrServiceTypeTuples)
8080
{

src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ImplicitQuery_NullableStringArrayParam_QueryNotPresent.generated.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.Http.Generated
7474
var jsonBodyOrServiceTypeTuples = new (bool, Type)[] {
7575
#nullable disable
7676
(false, typeof(global::System.String[])),
77-
#nullable restore
77+
#nullable enable
7878
};
7979
foreach (var (isOptional, type) in jsonBodyOrServiceTypeTuples)
8080
{

src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_ImplicitQuery_StringArrayParam.generated.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.Http.Generated
7474
var jsonBodyOrServiceTypeTuples = new (bool, Type)[] {
7575
#nullable disable
7676
(false, typeof(global::System.String[])),
77-
#nullable restore
77+
#nullable enable
7878
};
7979
foreach (var (isOptional, type) in jsonBodyOrServiceTypeTuples)
8080
{

src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_JsonBodyOrService_HandlesBothJsonAndService.generated.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ namespace Microsoft.AspNetCore.Http.Generated
7575
#nullable disable
7676
(false, typeof(global::Microsoft.AspNetCore.Http.Generators.Tests.Todo)),
7777
(false, typeof(global::Microsoft.AspNetCore.Http.Generators.Tests.TestService)),
78-
#nullable restore
78+
#nullable enable
7979
};
8080
foreach (var (isOptional, type) in jsonBodyOrServiceTypeTuples)
8181
{

src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapAction_TakesCustomMetadataEmitter_Has_Metadata.generated.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.Http.Generated
7474
var jsonBodyOrServiceTypeTuples = new (bool, Type)[] {
7575
#nullable disable
7676
(false, typeof(global::Microsoft.AspNetCore.Http.Generators.Tests.CustomMetadataEmitter)),
77-
#nullable restore
77+
#nullable enable
7878
};
7979
foreach (var (isOptional, type) in jsonBodyOrServiceTypeTuples)
8080
{

src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapMethods_Get_WithArrayQueryString_AndBody_ShouldUseQueryString.generated.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.Http.Generated
7474
var jsonBodyOrServiceTypeTuples = new (bool, Type)[] {
7575
#nullable disable
7676
(false, typeof(global::System.String[])),
77-
#nullable restore
77+
#nullable enable
7878
};
7979
foreach (var (isOptional, type) in jsonBodyOrServiceTypeTuples)
8080
{

src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapMethods_PostAndGet_WithArrayQueryString_AndBody_ShouldUseQueryString.generated.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.Http.Generated
7474
var jsonBodyOrServiceTypeTuples = new (bool, Type)[] {
7575
#nullable disable
7676
(false, typeof(global::System.String[])),
77-
#nullable restore
77+
#nullable enable
7878
};
7979
foreach (var (isOptional, type) in jsonBodyOrServiceTypeTuples)
8080
{

src/Http/Http.Extensions/test/RequestDelegateGenerator/Baselines/MapMethods_PostAndPut_WithArrayQueryString_AndBody_ShouldUseBody.generated.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace Microsoft.AspNetCore.Http.Generated
7474
var jsonBodyOrServiceTypeTuples = new (bool, Type)[] {
7575
#nullable disable
7676
(false, typeof(global::System.String[])),
77-
#nullable restore
77+
#nullable enable
7878
};
7979
foreach (var (isOptional, type) in jsonBodyOrServiceTypeTuples)
8080
{

0 commit comments

Comments
 (0)