Skip to content
This repository has been archived by the owner on Nov 26, 2021. It is now read-only.

Commit

Permalink
removed newtonsoft dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
goncalo-oliveira committed Jul 28, 2021
1 parent 57538d7 commit 592e1d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 26 deletions.
17 changes: 2 additions & 15 deletions src/Api/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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 )
Expand Down
9 changes: 1 addition & 8 deletions src/Functions/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Newtonsoft.Json.Serialization;

namespace OpenFaaS.Functions
{
Expand All @@ -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<ISystemClock, SystemClock>();

Expand Down
5 changes: 2 additions & 3 deletions src/faas-run.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<Version>1.6.2</Version>
<Version>1.7</Version>
<Authors>Goncalo Oliveira</Authors>
<Description>FaaS runner for ASPNET functions</Description>
<RepositoryUrl>https://github.com/goncalo-oliveira/faas-run</RepositoryUrl>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommandLineParser" Version="2.8.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="5.0.0" />
<PackageReference Include="OpenFaaS.Functions" Version="1.4.0" />
<PackageReference Include="OpenFaaS.Functions" Version="1.5.0" />
</ItemGroup>

</Project>

0 comments on commit 592e1d6

Please sign in to comment.