From e872b16067529953bd029e9017eb2652de22f787 Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sun, 2 Aug 2026 15:30:59 +0200 Subject: [PATCH] Fixed JSON serialization of enums to use member names --- .../Assistants/VisualBriefing/VisualBriefingJson.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/MindWork AI Studio/Assistants/VisualBriefing/VisualBriefingJson.cs b/app/MindWork AI Studio/Assistants/VisualBriefing/VisualBriefingJson.cs index 2fc6068c..143d1360 100644 --- a/app/MindWork AI Studio/Assistants/VisualBriefing/VisualBriefingJson.cs +++ b/app/MindWork AI Studio/Assistants/VisualBriefing/VisualBriefingJson.cs @@ -22,6 +22,14 @@ internal static class VisualBriefingJson /// /// Creates the shared JSON configuration. /// + /// + /// Enums are written as their member names instead of numbers. Stored briefings outlive many + /// releases, so a numeric value would silently change meaning as soon as somebody inserts or + /// reorders an enum member. Most visual briefing enums carry the converter as an attribute + /// already; this option covers the ones defined outside the feature, such as the target language + /// and the audience enums. Reading still accepts numbers, so briefings written before this + /// change keep loading. + /// /// Whether serialized JSON should be indented. /// The configured serializer options. private static JsonSerializerOptions Create(bool writeIndented) => new() @@ -31,5 +39,6 @@ internal static class VisualBriefingJson WriteIndented = writeIndented, Encoder = JavaScriptEncoder.Default, UnmappedMemberHandling = JsonUnmappedMemberHandling.Disallow, + Converters = { new JsonStringEnumConverter() }, }; }