fix: put [JsonPropertyName("@type")] on each concrete JsonLdNode override

System.Text.Json emitted both "@type" and a bare "Type" because the attribute was only on the abstract base member. Adds regression assertions for all node types.
This commit is contained in:
daniel-c-harvey
2026-06-23 06:57:05 -04:00
parent 2653e62eeb
commit 56f7013314
2 changed files with 119 additions and 4 deletions
+4 -4
View File
@@ -63,7 +63,7 @@ public abstract record JsonLdNode
/// <summary>The Deep DRFT collective entity — the home/about node.</summary>
public sealed record MusicGroupNode : JsonLdNode
{
public override string Type => "MusicGroup";
[JsonPropertyName("@type")] public override string Type => "MusicGroup";
[JsonPropertyName("name")] public string Name { get; init; } = string.Empty;
[JsonPropertyName("url")] public string? Url { get; init; }
@@ -76,7 +76,7 @@ public sealed record MusicGroupNode : JsonLdNode
/// <summary>A studio cut or a live session release. <c>AlbumProductionType</c> distinguishes them.</summary>
public sealed record MusicAlbumNode : JsonLdNode
{
public override string Type => "MusicAlbum";
[JsonPropertyName("@type")] public override string Type => "MusicAlbum";
[JsonPropertyName("name")] public string Name { get; init; } = string.Empty;
[JsonPropertyName("byArtist")] public ArtistRef? ByArtist { get; init; }
@@ -96,7 +96,7 @@ public sealed record MusicAlbumNode : JsonLdNode
/// <summary>A single recording — a mix release, or one track inside an album's <c>track</c> list.</summary>
public sealed record MusicRecordingNode : JsonLdNode
{
public override string Type => "MusicRecording";
[JsonPropertyName("@type")] public override string Type => "MusicRecording";
[JsonPropertyName("name")] public string Name { get; init; } = string.Empty;
[JsonPropertyName("byArtist")] public ArtistRef? ByArtist { get; init; }
@@ -112,7 +112,7 @@ public sealed record MusicRecordingNode : JsonLdNode
/// <summary>A browse/index surface listing releases (cuts/sessions/mixes/archive).</summary>
public sealed record CollectionPageNode : JsonLdNode
{
public override string Type => "CollectionPage";
[JsonPropertyName("@type")] public override string Type => "CollectionPage";
[JsonPropertyName("name")] public string Name { get; init; } = string.Empty;
[JsonPropertyName("description")] public string? Description { get; init; }