Skip to content

Commit

Permalink
Add workaround for JustArchiNET/ASF-ui#871
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Jan 29, 2020
1 parent 4fdb9cb commit 18a9821
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ArchiSteamFarm/IPC/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;

namespace ArchiSteamFarm.IPC {
Expand Down Expand Up @@ -220,18 +219,20 @@ public void ConfigureServices(IServiceCollection services) {
mvc.AddApiExplorer();
#endif

// Add JSON formatters that will be used as default ones if no specific formatters are asked for
// Fix default contract resolver to use original names and not a camel case and add debugging aid while we're at it
#if NETFRAMEWORK
// Add JSON formatters that will be used as default ones if no specific formatters are asked for
mvc.AddJsonFormatters();

mvc.AddJsonOptions(
#else
mvc.AddNewtonsoftJson(
#endif
options => {
// Fix default contract resolver to use original names and not a camel case
options.SerializerSettings.ContractResolver = new DefaultContractResolver();
options.SerializerSettings.Converters.Add(new StringEnumConverter());

// TODO: Enable this again once ASF-ui adds support in https://github.com/JustArchiNET/ASF-ui/issues/871
//options.SerializerSettings.Converters.Add(new StringEnumConverter());

if (Debugging.IsUserDebugging) {
options.SerializerSettings.Formatting = Formatting.Indented;
Expand Down

0 comments on commit 18a9821

Please sign in to comment.