From 48dfaa61bfa9f149c41c44ccf2ca5583dce5f867 Mon Sep 17 00:00:00 2001 From: donkey <84121166+iadonkey@users.noreply.github.com> Date: Mon, 20 Nov 2023 07:53:27 +0100 Subject: [PATCH] fix: ignore optional config values in deserialization (cherry picked from commit 8efd10ff6ff3c7c2e07603084c4c47c21be6c429) --- TwinpackShared/Models/Config.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/TwinpackShared/Models/Config.cs b/TwinpackShared/Models/Config.cs index 328e721..ae29a30 100644 --- a/TwinpackShared/Models/Config.cs +++ b/TwinpackShared/Models/Config.cs @@ -188,7 +188,10 @@ public PlcProjectType PlcType { [JsonPropertyName("name")] public string Name { get; set; } + [JsonPropertyName("title")] + [DefaultValue(null)] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string Title { get; set; } [JsonPropertyName("type")] @@ -213,29 +216,48 @@ public PlcProjectType PlcType { public ConfigPatches Patches { get; set; } [JsonPropertyName("description")] + [DefaultValue("")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string Description { get; set; } [JsonPropertyName("icon-file")] + [DefaultValue("")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string IconFile { get; set; } [JsonPropertyName("project-url")] + [DefaultValue("")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string ProjectUrl { get; set; } [JsonPropertyName("display-name")] + [DefaultValue("")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string DisplayName { get; set; } [JsonPropertyName("authors")] + [DefaultValue("")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string Authors { get; set; } [JsonPropertyName("entitlement")] + [DefaultValue("")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string Entitlement { get; set; } [JsonPropertyName("license")] + [DefaultValue("")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string License { get; set; } [JsonPropertyName("license-file")] + [DefaultValue("")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string LicenseFile { get; set; } + [JsonPropertyName("license-tmc-file")] + [DefaultValue("")] + [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public string LicenseTmcFile { get; set; } }