Skip to content

Commit f942bd6

Browse files
dmealingclaude
andcommitted
test(csharp): fix 2 pre-existing failures from the #38 @required nullability change
Both stem from the #38 '@required CLR nullability' generator change (2026-06-17) not propagating to committed fixtures + a test expectation: - IntegrationFixtureDriftTests: regenerate the drifted committed integration fixtures — BridgeAuth.g.cs (int? Quantity → int Quantity) + Settings.g.cs (added a using directive the generator now emits). - TphCodegenTests.Entity_subtypes_extend_base...: stale test expectation, NOT a generator bug — the generator correctly emits non-null int Quantity for a @required TPH-subtype field (EF auto-nullables the column); the test still asserted int?. Updated the expectation + comment to the #38 rationale. Verified: dotnet test MetaObjects.sln — Render 290, Conformance 666, Cli 34, Codegen 222 (0 failed); the regen harness stays Skip-gated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LuZWKnWzYGVnESijL7uuky
1 parent b21cdc7 commit f942bd6

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

server/csharp/MetaObjects.Codegen.Tests/TphCodegenTests.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,11 @@ public void Entity_subtypes_extend_base_with_only_own_fields_and_no_table()
116116
var bridge = FileContent(files, "BridgeAuth.g.cs");
117117
Assert.Contains("public class BridgeAuth : Auth", bridge);
118118
Assert.DoesNotContain("[Table", bridge);
119-
// Own field only — subtype column is nullable in the single table (EF folds it),
120-
// so even an @required subtype field is emitted nullable.
121-
Assert.Contains("public int? Quantity { get; set; }", bridge);
119+
// Own field only. A @required subtype field is non-null in CLR (logically
120+
// required); EF Core auto-nullables the underlying COLUMN for TPH-derived
121+
// properties (a row of another subtype stores NULL there), so the non-null CLR
122+
// type still maps to a nullable column correctly (#38, @required CLR nullability).
123+
Assert.Contains("public int Quantity { get; set; }", bridge);
122124
// Inherited columns are NOT re-emitted on the subtype.
123125
Assert.DoesNotContain("public long Id", bridge);
124126
Assert.DoesNotContain("public string Reference", bridge);

server/csharp/MetaObjects.IntegrationTests/Generated/BridgeAuth.g.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ namespace MetaObjects.IntegrationTests.Generated;
1111
public class BridgeAuth : Auth
1212
{
1313
[Column("quantity")]
14-
public int? Quantity { get; set; }
14+
public int Quantity { get; set; }
1515
}

server/csharp/MetaObjects.IntegrationTests/Generated/Settings.g.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#nullable enable
44
using System;
55
using System.Collections.Generic;
6+
using System.ComponentModel.DataAnnotations.Schema;
67

78
namespace MetaObjects.IntegrationTests.Generated;
89

0 commit comments

Comments
 (0)