Skip to content

Commit

Permalink
tweak: use "snake_case" for API response fields
Browse files Browse the repository at this point in the history
  • Loading branch information
roydejong committed Apr 14, 2024
1 parent 402cb5d commit 3b8978c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions BeatTogether.Status.Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<ItemGroup>
<PackageReference Include="BeatTogether.Extensions.Serilog" Version="1.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.18" />
</ItemGroup>

</Project>
8 changes: 8 additions & 0 deletions Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json.Serialization;

namespace BeatTogether.Status.Api
{
Expand All @@ -24,6 +25,13 @@ public static IHostBuilder CreateHostBuilder(string[] args) =>
.Configure<StatusConfiguration>(hostBuilderContext.Configuration.GetSection("Status"))
.Configure<QuickplayConfiguration>(hostBuilderContext.Configuration.GetSection("Quickplay"))
.AddControllers()
.AddNewtonsoftJson(options =>
{
options.SerializerSettings.ContractResolver = new DefaultContractResolver
{
NamingStrategy = new SnakeCaseNamingStrategy()
};
})
)
.Configure(applicationBuilder =>
applicationBuilder
Expand Down

0 comments on commit 3b8978c

Please sign in to comment.