mirror of
https://github.com/protocolbuffers/protobuf
synced 2026-08-26 02:23:14 -04:00
Allow later enum aliases to overwrite in C# custom JSON enum mapping.
When constructing the custom JSON enum name map in C# JsonParser, remove the ContainsKey check so that subsequent aliased enum values overwrite earlier ones, aligning with the "last match wins" semantics used across C++, Java, PHP, and Python. PiperOrigin-RevId: 970656172
This commit is contained in:
parent
b445fe13b1
commit
6836552e25
1 changed files with 1 additions and 2 deletions
|
|
@ -774,8 +774,7 @@ namespace Google.Protobuf
|
|||
{
|
||||
var jsonOptions = value.GetOptions()?.GetExtension(
|
||||
Pb.Enumvalue.JsonEnumvalueOptionsExtensions.Json);
|
||||
if (jsonOptions != null && jsonOptions.HasString &&
|
||||
!map.ContainsKey(jsonOptions.String))
|
||||
if (jsonOptions != null && jsonOptions.HasString)
|
||||
{
|
||||
map[jsonOptions.String] = value;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue