using System.Text.Json; using System.Text.Json.Serialization; namespace DeepDrftPublic.Client.Common; /// /// Typed schema.org JSON-LD nodes (Phase 22, OQ5 — the typed-builder option). Each record mirrors one /// schema.org type; renders a node to the <script type="application/ld+json"> /// body. Keeping the shape in C# (not hand-written JSON in pages) is what makes the medium→type mapping /// live in one place (DRY, §4.3) and the output unit-testable (AC5) rather than a manual validator pass. /// /// /// All nodes share so the @context/@type pair serialises first and /// once. Null properties are omitted (the serializer ignores nulls) so partial data never emits an empty /// or broken node (C6/AC4). /// /// public static class SeoJsonLd { private static readonly JsonSerializerOptions Options = new() { DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, // schema.org keys are PascalCase ("@type", "byArtist", "datePublished"); JsonPropertyName drives // each. Encoder relaxed so the JSON sits inline in HTML without over-escaping apostrophes etc. // Note: the relaxed encoder leaves <, >, & raw — InlineSafe re-escapes exactly those before the // body is injected into the