Skip to content

Commit

Permalink
fix: ignore optional config values in deserialization
Browse files Browse the repository at this point in the history
(cherry picked from commit 8efd10f)
  • Loading branch information
iadonkey authored and seehma committed Nov 21, 2023
1 parent e6e5336 commit 48dfaa6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions TwinpackShared/Models/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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; }
}

Expand Down

0 comments on commit 48dfaa6

Please sign in to comment.