From 3435d970f1f04fc41649e3a0c550c0973f5d9075 Mon Sep 17 00:00:00 2001 From: Jeremiah Greer Date: Wed, 16 Mar 2022 13:16:04 -0700 Subject: [PATCH] Set FormatEnumsAsIntegers to true by default Enums should be formatted as integers by default, as deserializing string-based enums can cause exceptions when the value names (not the values themselves) are changed, or when new values are added (unlike integers, which are handled gracefully on deserialization generally). --- .../src/Microsoft.AspNetCore.Grpc.HttpApi/JsonSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GrpcHttpApi/src/Microsoft.AspNetCore.Grpc.HttpApi/JsonSettings.cs b/src/GrpcHttpApi/src/Microsoft.AspNetCore.Grpc.HttpApi/JsonSettings.cs index bc5d449ee..4227a80c4 100644 --- a/src/GrpcHttpApi/src/Microsoft.AspNetCore.Grpc.HttpApi/JsonSettings.cs +++ b/src/GrpcHttpApi/src/Microsoft.AspNetCore.Grpc.HttpApi/JsonSettings.cs @@ -33,7 +33,7 @@ public JsonSettings() /// public bool FormatDefaultValues { get; set; } = true; - public bool FormatEnumsAsIntegers { get; set; } + public bool FormatEnumsAsIntegers { get; set; } = true; public TypeRegistry TypeRegistry { get; set; } = TypeRegistry.Empty;