Skip to content

Commit

Permalink
Add json enum config so Swagger will display enums as strings
Browse files Browse the repository at this point in the history
  • Loading branch information
nwarms committed Jan 25, 2024
1 parent 51056f9 commit f18ada3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion TramsDataApi/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Text.Json.Serialization;
using Dfe.Academisation.CorrelationIdMiddleware;

namespace TramsDataApi
Expand Down Expand Up @@ -36,7 +37,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.AddControllers();
services.AddControllers().AddJsonOptions(c => {c.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter());});
services.AddApiVersioning();
services.AddFeatureManagement();

Expand Down

0 comments on commit f18ada3

Please sign in to comment.