From 248227b7177f65da2f1d7329045ff3aa1980e117 Mon Sep 17 00:00:00 2001 From: Nishchal Date: Sat, 11 Jul 2020 22:49:38 +0700 Subject: [PATCH] fix(api): serialize enums as string --- Feature.Manager.Api/Startup.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Feature.Manager.Api/Startup.cs b/Feature.Manager.Api/Startup.cs index 85a8b06..44e7dac 100644 --- a/Feature.Manager.Api/Startup.cs +++ b/Feature.Manager.Api/Startup.cs @@ -1,3 +1,4 @@ +using System.Text.Json.Serialization; using Feature.Manager.Api.StartupExtensions; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -23,7 +24,10 @@ public void ConfigureServices(IServiceCollection services) services.AddMetrics(); services.ConfigureRequiredDependencies(); services.ConfigureHealthChecks(); - services.AddControllers(); + services.AddControllers().AddJsonOptions(x => + { + x.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); + }); services.ConfigureSwagger(); services.RegisterWorker(); }