Skip to content

Commit

Permalink
Fixing Enum Deserialization for Logging
Browse files Browse the repository at this point in the history
It was defaulting to integers instead of strings
  • Loading branch information
digitalcoyote committed Sep 21, 2020
1 parent 6c7c1a0 commit 96bca90
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Src/NuGetDefense/Configuration/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.IO;
using System.Linq;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
using NuGetDefense.Core;

Expand Down Expand Up @@ -90,6 +91,7 @@ private static Settings LoadSettingsFile(string settingsFilePath)
PropertyNameCaseInsensitive = true,
ReadCommentHandling = JsonCommentHandling.Skip,
AllowTrailingCommas = true,
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase)},
};

settings = JsonSerializer.Deserialize<Settings>(settingsFileContents, ops);
Expand Down Expand Up @@ -127,6 +129,8 @@ private static bool SaveSettings(Settings settings, string settingsFilePath)
IgnoreNullValues = true,
AllowTrailingCommas = true,
WriteIndented = true,
Converters = { new JsonStringEnumConverter(JsonNamingPolicy.CamelCase)},

};

try
Expand Down
8 changes: 4 additions & 4 deletions Src/NuGetDefense/NuGetDefense.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MessagePack" Version="2.1.194" />
<PackageReference Include="MessagePack" Version="[2.1.194]" />
<PackageReference Include="NuGet.Versioning" Version="[5.7.0]" />
<PackageReference Include="NuGetDefense.Core" Version="[1.0.6]" />
<PackageReference Include="NuGetDefense.NVD" Version="1.0.2.2" />
<PackageReference Include="NuGetDefense.OSSIndex" Version="1.0.2" />
<PackageReference Include="NuGetDefense.Core" Version="[1.0.7]" />
<PackageReference Include="NuGetDefense.NVD" Version="[1.0.3]" />
<PackageReference Include="NuGetDefense.OSSIndex" Version="[1.0.2]" />
<PackageReference Include="Serilog.Sinks.Console" Version="[3.1.1]" />
<PackageReference Include="Serilog.Sinks.File" Version="[4.1.0]" />
<PackageReference Include="System.Text.Json" Version="[4.7.2]" />
Expand Down
2 changes: 1 addition & 1 deletion Src/NuGetDefense/NuGetDefense.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<metadata>
<id>NuGetDefense</id>
<title>NuGetDefense</title>
<version>1.0.8</version>
<version>1.0.9</version>
<authors>Curtis Carter</authors>
<owners>Curtis Carter</owners>
<projectUrl>https://digitalcoyote.github.io/NuGetDefense/</projectUrl>
Expand Down

0 comments on commit 96bca90

Please sign in to comment.