Skip to content

Commit

Permalink
Fix wrapper extension JSON serialization (#821)
Browse files Browse the repository at this point in the history
  • Loading branch information
timostamm authored Apr 30, 2024
1 parent 6a9cce0 commit 896338d
Show file tree
Hide file tree
Showing 11 changed files with 253 additions and 41 deletions.
1 change: 1 addition & 0 deletions packages/protobuf-test/extra/extensions-proto2.proto
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ extend Proto2Extendee {
repeated string repeated_string_ext = 7002;
repeated uint32 packed_uint32_ext = 7003 [packed = true];
repeated uint32 unpacked_uint32_ext = 7004; // unpacked by default in proto2
repeated uint64 repeated_uint64_ext_js_string = 7006 [jstype = JS_STRING];

optional google.protobuf.UInt32Value wrapper_ext = 8001;

Expand Down
6 changes: 6 additions & 0 deletions packages/protobuf-test/extra/extensions-proto3.proto
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,10 @@ extend google.protobuf.FileOptions {
optional uint32 optional_uint32_ext = 1002;
repeated uint32 packed_uint32_ext = 7003;
repeated uint32 unpacked_uint32_ext = 7004 [packed = false];
Proto3ExtMessage message_ext = 7005;
}

// A message used in extensions
message Proto3ExtMessage {
string string_field = 1;
}
3 changes: 3 additions & 0 deletions packages/protobuf-test/src/extension-accessor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
repeated_enum_ext,
repeated_message_ext,
repeated_string_ext,
repeated_uint64_ext_js_string,
repeatedgroupext,
string_ext,
string_ext_with_default,
Expand Down Expand Up @@ -99,6 +100,7 @@ const goldenValues: extensionWithValueCollection = [
{ ext: repeated_string_ext, val: ["a", "b", "c"] },
{ ext: packed_uint32_ext, val: [1, 2, 3] },
{ ext: unpacked_uint32_ext, val: [4, 5, 6] },
{ ext: repeated_uint64_ext_js_string, val: ["1", "2", "3"] },
{ ext: wrapper_ext, val: 123 },
{ ext: groupext, val: create(GroupExtDesc, { a: 123 }) },
{
Expand Down Expand Up @@ -130,6 +132,7 @@ const goldenValuesZero: extensionWithValueCollection = [
{ ext: repeated_string_ext, val: [] },
{ ext: packed_uint32_ext, val: [] },
{ ext: unpacked_uint32_ext, val: [] },
{ ext: repeated_uint64_ext_js_string, val: [] },
{ ext: wrapper_ext, val: 0 },
{ ext: groupext, val: create(GroupExtDesc) },
{ ext: repeatedgroupext, val: [] },
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions packages/protobuf-test/src/gen/js/extra/extensions-proto2_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 15 additions & 2 deletions packages/protobuf-test/src/gen/js/extra/extensions-proto3_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 896338d

Please sign in to comment.