diff options
author | Adam Cozzette <acozzette@google.com> | 2018-05-25 14:12:43 -0700 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2018-05-25 14:44:22 -0700 |
commit | d1af029104e9b594a99209484914b822addb08fa (patch) | |
tree | ea2c0cfe72f25c79e6bb0e0d7f8f4da320cc3c4a /js/testbinary.proto | |
parent | 6f723a6624de0e0f9b1ae16ae002e678613e07b8 (diff) |
Fixed JS parsing of unspecified map keys
We need to use a default of 0 when parsing unspecified map keys, instead
of failing an assertion.
This change was written by Michael Aaron (michaelaaron@google.com) but I
am cherry-picking it directly instead of waiting for the next sync of
Google-internal changes.
Diffstat (limited to 'js/testbinary.proto')
-rw-r--r-- | js/testbinary.proto | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/js/testbinary.proto b/js/testbinary.proto index 116f17fb..ed5bdfc6 100644 --- a/js/testbinary.proto +++ b/js/testbinary.proto @@ -201,6 +201,38 @@ message TestMapFields { map<string, TestMapFields> map_string_testmapfields = 12; } +// These proto are 'mock map' entries to test the above map deserializing with +// undefined keys. Make sure TestMapFieldsOptionalKeys is written to be +// deserialized by TestMapFields +message MapEntryOptionalKeysStringKey { + optional string key = 1; + optional string value = 2; +} + +message MapEntryOptionalKeysInt32Key { + optional int32 key = 1; + optional string value = 2; +} + +message MapEntryOptionalKeysInt64Key { + optional int64 key = 1; + optional string value = 2; +} + +message MapEntryOptionalKeysBoolKey { + optional bool key = 1; + optional string value = 2; +} + +message TestMapFieldsOptionalKeys { + optional MapEntryOptionalKeysStringKey map_string_string = 1; + optional MapEntryOptionalKeysInt32Key map_int32_string= 8; + optional MapEntryOptionalKeysInt64Key map_int64_string = 9; + optional MapEntryOptionalKeysBoolKey map_bool_string = 10; +} + +// End mock-map entries + enum MapValueEnum { MAP_VALUE_FOO = 0; MAP_VALUE_BAR = 1; |