From 592e1d66b635c8268f4d2bfd3a838f2c0cbb3162 Mon Sep 17 00:00:00 2001 From: Goncalo Oliveira Date: Wed, 28 Jul 2021 11:08:02 +0200 Subject: [PATCH] removed newtonsoft dependency --- src/Api/Startup.cs | 17 ++--------------- src/Functions/Startup.cs | 9 +-------- src/faas-run.csproj | 5 ++--- 3 files changed, 5 insertions(+), 26 deletions(-) diff --git a/src/Api/Startup.cs b/src/Api/Startup.cs index 5cc2888..b103ae8 100644 --- a/src/Api/Startup.cs +++ b/src/Api/Startup.cs @@ -6,8 +6,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Hosting; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Serialization; namespace OpenFaaS.Api { @@ -22,19 +20,8 @@ public Startup( IConfiguration configuration ) public void ConfigureServices( IServiceCollection services ) { - var mvcBuilder = services.AddControllers( options => - { - } ); - - mvcBuilder.AddNewtonsoftJson( options => - { - options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); - options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; - options.SerializerSettings.Converters.Add( new StringEnumConverter( new CamelCaseNamingStrategy(), false ) ); - }); - // Replaced with Newtonsoft because Microsoft's serializer doesn't do polymorphic serialization - - mvcBuilder.AddPluginControllers(); + services.AddControllers() + .AddPluginControllers(); } public void Configure( IApplicationBuilder app, IWebHostEnvironment env ) diff --git a/src/Functions/Startup.cs b/src/Functions/Startup.cs index 21a1bd4..90dd247 100644 --- a/src/Functions/Startup.cs +++ b/src/Functions/Startup.cs @@ -5,7 +5,6 @@ using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; -using Newtonsoft.Json.Serialization; namespace OpenFaaS.Functions { @@ -21,13 +20,7 @@ public Startup( IConfiguration configuration ) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices( IServiceCollection services ) { - services.AddMvc() - .AddNewtonsoftJson( options => - { - options.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); - options.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; - } ); - // Replaced with Newtonsoft because Microsoft's serializer doesn't do polymorphic serialization + services.AddMvc(); services.AddSingleton(); diff --git a/src/faas-run.csproj b/src/faas-run.csproj index 500a891..b9c0776 100644 --- a/src/faas-run.csproj +++ b/src/faas-run.csproj @@ -3,7 +3,7 @@ Exe net5.0 - 1.6.2 + 1.7 Goncalo Oliveira FaaS runner for ASPNET functions https://github.com/goncalo-oliveira/faas-run @@ -11,11 +11,10 @@ - - +