From 24ecbb65ad88e408f37de3c212b4ceb162da96b8 Mon Sep 17 00:00:00 2001 From: Tate Thurston Date: Wed, 18 Oct 2023 10:01:23 -0700 Subject: [PATCH] JSON wireformat fixes --- .nvmrc | 2 +- CHANGELOG.md | 2 +- .../expected_proto2_failing_tests.txt | 653 +++++++ e2e/conformance/failing_tests.txt | 791 +-------- .../proto/conformance/conformance.pb.ts | 69 +- .../protobuf/test_messages_proto3.pb.ts | 369 ++-- e2e/conformance/test.ts | 1 + e2e/serialization/json.pb.ts | 1497 +++++++++++++++++ e2e/serialization/json.proto | 133 ++ e2e/serialization/message.pb.ts | 88 +- e2e/serialization/test.ts | 619 +++++++ e2e/treeshaking/treeshaking.pb.ts | 33 +- .../closure-compiler/src/haberdasher.pb.ts | 38 +- examples/javascript/src/haberdasher.pb.js | 26 +- examples/protoc/src/haberdasher.pb.js | 26 +- examples/typescript/src/haberdasher.pb.ts | 18 +- examples/typescript/src/size.pb.ts | 20 +- examples/typescript/src/user.pb.ts | 24 +- .../src/codegen/autogenerate/index.ts | 129 +- packages/protoscript/src/runtime/index.ts | 2 +- packages/protoscript/src/runtime/json.ts | 67 +- .../src/runtime/well-known-types/any.pb.ts | 30 +- .../src/runtime/well-known-types/api.pb.ts | 57 +- .../runtime/well-known-types/duration.pb.ts | 20 +- .../src/runtime/well-known-types/empty.pb.ts | 11 +- .../runtime/well-known-types/field_mask.pb.ts | 18 +- .../well-known-types/source_context.pb.ts | 12 +- .../src/runtime/well-known-types/struct.pb.ts | 63 +- .../runtime/well-known-types/timestamp.pb.ts | 20 +- .../src/runtime/well-known-types/type.pb.ts | 99 +- .../runtime/well-known-types/wrappers.pb.ts | 163 +- 31 files changed, 3804 insertions(+), 1296 deletions(-) create mode 100644 e2e/conformance/expected_proto2_failing_tests.txt create mode 100644 e2e/serialization/json.pb.ts create mode 100644 e2e/serialization/json.proto diff --git a/.nvmrc b/.nvmrc index b492b08..87ec884 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -18.16 +18.18.2 diff --git a/CHANGELOG.md b/CHANGELOG.md index adc90be..af0548f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,7 @@ - language=typescript strategy: all ``` - + ## v0.0.15 This release includes a number of bug fixes diff --git a/e2e/conformance/expected_proto2_failing_tests.txt b/e2e/conformance/expected_proto2_failing_tests.txt new file mode 100644 index 0000000..636ef56 --- /dev/null +++ b/e2e/conformance/expected_proto2_failing_tests.txt @@ -0,0 +1,653 @@ +Recommended.Proto2.JsonInput.FieldNameExtension.Validator +Recommended.Proto2.ProtobufInput.OneofZeroBool.ProtobufOutput +Recommended.Proto2.ProtobufInput.OneofZeroBytes.ProtobufOutput +Recommended.Proto2.ProtobufInput.OneofZeroDouble.ProtobufOutput +Recommended.Proto2.ProtobufInput.OneofZeroEnum.ProtobufOutput +Recommended.Proto2.ProtobufInput.OneofZeroFloat.ProtobufOutput +Recommended.Proto2.ProtobufInput.OneofZeroMessage.ProtobufOutput +Recommended.Proto2.ProtobufInput.OneofZeroMessageSetTwice.ProtobufOutput +Recommended.Proto2.ProtobufInput.OneofZeroString.ProtobufOutput +Recommended.Proto2.ProtobufInput.OneofZeroUint32.ProtobufOutput +Recommended.Proto2.ProtobufInput.OneofZeroUint64.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BOOL.DefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BOOL.MultipleValuesForDifferentField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BOOL.MultipleValuesForSameField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BOOL.NonDefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BYTES.DefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BYTES.MultipleValuesForDifferentField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BYTES.MultipleValuesForSameField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BYTES.NonDefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.DOUBLE.DefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.DOUBLE.MultipleValuesForDifferentField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.DOUBLE.MultipleValuesForSameField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.DOUBLE.NonDefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.ENUM.DefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.ENUM.MultipleValuesForDifferentField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.ENUM.MultipleValuesForSameField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.ENUM.NonDefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.FLOAT.DefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.FLOAT.MultipleValuesForDifferentField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.FLOAT.MultipleValuesForSameField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.FLOAT.NonDefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.MESSAGE.DefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.MESSAGE.Merge.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.MESSAGE.MultipleValuesForDifferentField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.MESSAGE.MultipleValuesForSameField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.MESSAGE.NonDefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.STRING.DefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.STRING.MultipleValuesForDifferentField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.STRING.MultipleValuesForSameField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.STRING.NonDefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT32.DefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT32.MultipleValuesForDifferentField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT32.MultipleValuesForSameField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT32.NonDefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT64.DefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT64.MultipleValuesForDifferentField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT64.MultipleValuesForSameField.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT64.NonDefaultValue.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.DefaultOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.UnpackedOutput.ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BOOL[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BOOL[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BOOL[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BOOL[3].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BOOL[4].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BOOL[5].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BOOL[6].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BYTES[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BYTES[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BYTES[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BYTES[3].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.DOUBLE[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.DOUBLE[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.DOUBLE[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.DOUBLE[3].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.ENUM[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.ENUM[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.ENUM[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.ENUM[3].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.ENUM[4].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.ENUM[5].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FIXED32[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FIXED32[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FIXED32[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FIXED64[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FIXED64[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FIXED64[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FLOAT[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FLOAT[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FLOAT[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FLOAT[3].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FLOAT[4].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[3].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[4].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[5].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[6].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[7].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[8].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[9].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT64[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT64[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT64[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT64[3].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.MESSAGE[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.MESSAGE[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED32[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED32[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED32[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED32[3].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED64[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED64[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED64[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED64[3].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT32[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT32[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT32[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT32[3].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT32[4].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT64[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT64[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT64[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT64[3].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.STRING[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.STRING[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.STRING[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.STRING[3].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.STRING[4].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.STRING[5].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.STRING[6].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[2].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[3].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[4].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[5].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[6].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[7].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[8].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[9].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT64[0].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT64[1].ProtobufOutput +Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT64[2].ProtobufOutput +Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator +Required.Proto2.ProtobufInput.IllegalZeroFieldNum_Case_0 +Required.Proto2.ProtobufInput.IllegalZeroFieldNum_Case_1 +Required.Proto2.ProtobufInput.IllegalZeroFieldNum_Case_2 +Required.Proto2.ProtobufInput.IllegalZeroFieldNum_Case_3 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.BOOL +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.BYTES +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.DOUBLE +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.ENUM +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.FIXED32 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.FIXED64 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.FLOAT +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.INT32 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.INT64 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.SFIXED32 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.SFIXED64 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.SINT32 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.SINT64 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.STRING +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.UINT32 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.UINT64 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.BOOL +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.BYTES +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.DOUBLE +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.ENUM +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.FIXED32 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.FIXED64 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.FLOAT +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.INT32 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.INT64 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.SFIXED32 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.SFIXED64 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.SINT32 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.SINT64 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.STRING +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.UINT32 +Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.UINT64 +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.BOOL +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.BYTES +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.DOUBLE +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.ENUM +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.FIXED32 +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.FIXED64 +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.FLOAT +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.INT32 +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.INT64 +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.SFIXED32 +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.SFIXED64 +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.SINT32 +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.SINT64 +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.STRING +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.UINT32 +Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.UINT64 +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.BYTES +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.STRING +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.BYTES +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.STRING +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForUnknownValue.BYTES +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForUnknownValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForUnknownValue.STRING +Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL +Required.Proto2.ProtobufInput.PrematureEofInPackedField.DOUBLE +Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM +Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED32 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED64 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.FLOAT +Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED32 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED64 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32 +Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64 +Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.BOOL +Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.DOUBLE +Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.ENUM +Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.FIXED32 +Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.FIXED64 +Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.FLOAT +Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.INT32 +Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.INT64 +Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.SFIXED32 +Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.SFIXED64 +Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.SINT32 +Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.SINT64 +Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.UINT32 +Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.UINT64 +Required.Proto2.ProtobufInput.PrematureEofInSubmessageValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.BOOL +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.BYTES +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.DOUBLE +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.ENUM +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.FIXED32 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.FIXED64 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.FLOAT +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.INT32 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.INT64 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.SFIXED32 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.SFIXED64 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.SINT32 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.SINT64 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.STRING +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.UINT32 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.UINT64 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.BOOL +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.BYTES +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.DOUBLE +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.ENUM +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.FIXED32 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.FIXED64 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.FLOAT +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.INT32 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.INT64 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.SFIXED32 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.SFIXED64 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.SINT32 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.SINT64 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.STRING +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.UINT32 +Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.UINT64 +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.BOOL +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.BYTES +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.DOUBLE +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.ENUM +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.FIXED32 +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.FIXED64 +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.FLOAT +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.INT32 +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.INT64 +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.MESSAGE +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.SFIXED32 +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.SFIXED64 +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.SINT32 +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.SINT64 +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.STRING +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.UINT32 +Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.UINT64 +Required.Proto2.ProtobufInput.RepeatedScalarMessageMerge.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.BOOL.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.BYTES.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.DOUBLE.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.ENUM.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.FIXED32.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.FIXED64.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.FLOAT.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.INT32.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.INT64.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.SFIXED32.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.SFIXED64.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.SINT32.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.SINT64.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.STRING.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.UINT32.ProtobufOutput +Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.UINT64.ProtobufOutput +Required.Proto2.ProtobufInput.UnknownVarint.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.BOOL.BOOL.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.BOOL.BOOL.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.BOOL.BOOL.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.BOOL.BOOL.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.FIXED32.FIXED32.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.FIXED32.FIXED32.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.FIXED32.FIXED32.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.FIXED32.FIXED32.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.FIXED64.FIXED64.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.FIXED64.FIXED64.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.FIXED64.FIXED64.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.FIXED64.FIXED64.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.DOUBLE.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.DOUBLE.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.DOUBLE.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.DOUBLE.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.FLOAT.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.FLOAT.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.FLOAT.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.FLOAT.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.INT32.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.INT32.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.INT32.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT32.INT32.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT64.INT64.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT64.INT64.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT64.INT64.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.INT64.INT64.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SINT32.SINT32.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SINT32.SINT32.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SINT32.SINT32.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SINT32.SINT32.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SINT64.SINT64.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SINT64.SINT64.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SINT64.SINT64.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.SINT64.SINT64.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.BYTES.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.BYTES.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.BYTES.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.BYTES.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.ENUM.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.ENUM.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.ENUM.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.ENUM.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.MergeValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.STRING.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.STRING.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.STRING.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.STRING.STRING.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.UINT32.UINT32.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.UINT32.UINT32.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.UINT32.UINT32.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.UINT32.UINT32.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.UINT64.UINT64.Default.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateKey.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateKeyInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateValueInMapEntry.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.UINT64.UINT64.MissingDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.UINT64.UINT64.NonDefault.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataMap.UINT64.UINT64.Unordered.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.BOOL.DefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.BOOL.MultipleValuesForDifferentField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.BOOL.MultipleValuesForSameField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.BOOL.NonDefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.BYTES.DefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.BYTES.MultipleValuesForDifferentField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.BYTES.MultipleValuesForSameField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.BYTES.NonDefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.DOUBLE.DefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.DOUBLE.MultipleValuesForDifferentField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.DOUBLE.MultipleValuesForSameField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.DOUBLE.NonDefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.ENUM.DefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.ENUM.MultipleValuesForDifferentField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.ENUM.MultipleValuesForSameField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.ENUM.NonDefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.FLOAT.DefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.FLOAT.MultipleValuesForDifferentField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.FLOAT.MultipleValuesForSameField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.FLOAT.NonDefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.MESSAGE.DefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.MESSAGE.Merge.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.MESSAGE.MultipleValuesForDifferentField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.MESSAGE.MultipleValuesForSameField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.MESSAGE.NonDefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.STRING.DefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.STRING.MultipleValuesForDifferentField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.STRING.MultipleValuesForSameField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.STRING.NonDefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.UINT32.DefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.UINT32.MultipleValuesForDifferentField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.UINT32.MultipleValuesForSameField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.UINT32.NonDefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.UINT64.DefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.UINT64.MultipleValuesForDifferentField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.UINT64.MultipleValuesForSameField.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataOneof.UINT64.NonDefaultValue.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.BYTES.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.MESSAGE.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.STRING.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.BOOL[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.BOOL[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.BOOL[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.BOOL[3].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.BOOL[4].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.BOOL[5].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.BOOL[6].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.BYTES[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.BYTES[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.BYTES[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.BYTES[3].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.DOUBLE[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.DOUBLE[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.DOUBLE[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.DOUBLE[3].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.ENUM[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.ENUM[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.ENUM[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.ENUM[3].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.ENUM[4].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.ENUM[5].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.FIXED32[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.FIXED32[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.FIXED32[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.FIXED64[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.FIXED64[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.FIXED64[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.FLOAT[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.FLOAT[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.FLOAT[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.FLOAT[3].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.FLOAT[4].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.INT32[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.INT32[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.INT32[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.INT32[3].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.INT32[4].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.INT32[5].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.INT32[6].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.INT32[7].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.INT32[8].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.INT32[9].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.INT64[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.INT64[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.INT64[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.INT64[3].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.MESSAGE[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.MESSAGE[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED32[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED32[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED32[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED32[3].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED64[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED64[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED64[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED64[3].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SINT32[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SINT32[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SINT32[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SINT32[3].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SINT32[4].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SINT64[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SINT64[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SINT64[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.SINT64[3].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.STRING[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.STRING[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.STRING[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.STRING[3].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.STRING[4].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.STRING[5].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.STRING[6].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[2].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[3].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[4].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[5].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[6].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[7].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[8].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[9].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.UINT64[0].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.UINT64[1].ProtobufOutput +Required.Proto2.ProtobufInput.ValidDataScalar.UINT64[2].ProtobufOutput diff --git a/e2e/conformance/failing_tests.txt b/e2e/conformance/failing_tests.txt index 3414ba5..99a2149 100644 --- a/e2e/conformance/failing_tests.txt +++ b/e2e/conformance/failing_tests.txt @@ -1,246 +1,27 @@ Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput Recommended.FieldMaskPathsDontRoundTrip.JsonOutput Recommended.FieldMaskTooManyUnderscore.JsonOutput -Recommended.Proto2.JsonInput.FieldNameExtension.Validator -Recommended.Proto2.ProtobufInput.OneofZeroBool.ProtobufOutput -Recommended.Proto2.ProtobufInput.OneofZeroBytes.ProtobufOutput -Recommended.Proto2.ProtobufInput.OneofZeroDouble.ProtobufOutput -Recommended.Proto2.ProtobufInput.OneofZeroEnum.ProtobufOutput -Recommended.Proto2.ProtobufInput.OneofZeroFloat.ProtobufOutput -Recommended.Proto2.ProtobufInput.OneofZeroMessage.ProtobufOutput -Recommended.Proto2.ProtobufInput.OneofZeroMessageSetTwice.ProtobufOutput -Recommended.Proto2.ProtobufInput.OneofZeroString.ProtobufOutput -Recommended.Proto2.ProtobufInput.OneofZeroUint32.ProtobufOutput -Recommended.Proto2.ProtobufInput.OneofZeroUint64.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BOOL.DefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BOOL.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BOOL.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BOOL.NonDefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BYTES.DefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BYTES.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BYTES.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.BYTES.NonDefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.DOUBLE.DefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.DOUBLE.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.DOUBLE.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.DOUBLE.NonDefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.ENUM.DefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.ENUM.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.ENUM.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.ENUM.NonDefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.FLOAT.DefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.FLOAT.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.FLOAT.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.FLOAT.NonDefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.MESSAGE.DefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.MESSAGE.Merge.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.MESSAGE.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.MESSAGE.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.MESSAGE.NonDefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.STRING.DefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.STRING.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.STRING.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.STRING.NonDefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT32.DefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT32.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT32.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT32.NonDefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT64.DefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT64.MultipleValuesForDifferentField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT64.MultipleValuesForSameField.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataOneofBinary.UINT64.NonDefaultValue.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.DefaultOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.UnpackedOutput.ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BOOL[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BOOL[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BOOL[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BOOL[3].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BOOL[4].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BOOL[5].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BOOL[6].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BYTES[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BYTES[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BYTES[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.BYTES[3].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.DOUBLE[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.DOUBLE[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.DOUBLE[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.DOUBLE[3].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.ENUM[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.ENUM[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.ENUM[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.ENUM[3].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.ENUM[4].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.ENUM[5].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FIXED32[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FIXED32[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FIXED32[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FIXED64[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FIXED64[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FIXED64[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FLOAT[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FLOAT[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FLOAT[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FLOAT[3].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.FLOAT[4].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[3].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[4].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[5].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[6].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[7].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[8].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT32[9].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT64[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT64[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT64[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.INT64[3].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.MESSAGE[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.MESSAGE[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED32[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED32[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED32[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED32[3].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED64[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED64[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED64[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SFIXED64[3].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT32[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT32[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT32[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT32[3].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT32[4].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT64[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT64[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT64[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.SINT64[3].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.STRING[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.STRING[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.STRING[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.STRING[3].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.STRING[4].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.STRING[5].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.STRING[6].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[2].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[3].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[4].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[5].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[6].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[7].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[8].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT32[9].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT64[0].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT64[1].ProtobufOutput -Recommended.Proto2.ProtobufInput.ValidDataScalarBinary.UINT64[2].ProtobufOutput +Recommended.Proto3.JsonInput.BoolFieldDoubleQuotedFalse +Recommended.Proto3.JsonInput.BoolFieldDoubleQuotedTrue +Recommended.Proto3.JsonInput.BoolFieldIntegerOne +Recommended.Proto3.JsonInput.BoolFieldIntegerZero Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator Recommended.Proto3.JsonInput.DurationHas9FractionalDigits.Validator Recommended.Proto3.JsonInput.DurationHasZeroFractionalDigit.Validator -Recommended.Proto3.JsonInput.FieldNameWithDoubleUnderscores.JsonOutput +Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter Recommended.Proto3.JsonInput.FieldNameWithDoubleUnderscores.ProtobufOutput -Recommended.Proto3.JsonInput.FieldNameWithDoubleUnderscores.Validator Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInOptionalField.ProtobufOutput Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedField.ProtobufOutput -Recommended.Proto3.JsonInput.Int64FieldBeString.Validator -Recommended.Proto3.JsonInput.MultilineNoSpaces.JsonOutput +Recommended.Proto3.JsonInput.MapFieldValueIsNull Recommended.Proto3.JsonInput.MultilineNoSpaces.ProtobufOutput -Recommended.Proto3.JsonInput.MultilineWithSpaces.JsonOutput Recommended.Proto3.JsonInput.MultilineWithSpaces.ProtobufOutput -Recommended.Proto3.JsonInput.NullValueInNormalMessage.Validator Recommended.Proto3.JsonInput.NullValueInOtherOneofNewFormat.Validator Recommended.Proto3.JsonInput.NullValueInOtherOneofOldFormat.Validator -Recommended.Proto3.JsonInput.OneLineNoSpaces.JsonOutput Recommended.Proto3.JsonInput.OneLineNoSpaces.ProtobufOutput -Recommended.Proto3.JsonInput.OneLineWithSpaces.JsonOutput Recommended.Proto3.JsonInput.OneLineWithSpaces.ProtobufOutput Recommended.Proto3.JsonInput.OneofZeroBool.JsonOutput Recommended.Proto3.JsonInput.OneofZeroBool.ProtobufOutput @@ -248,11 +29,9 @@ Recommended.Proto3.JsonInput.OneofZeroBytes.JsonOutput Recommended.Proto3.JsonInput.OneofZeroBytes.ProtobufOutput Recommended.Proto3.JsonInput.OneofZeroDouble.JsonOutput Recommended.Proto3.JsonInput.OneofZeroDouble.ProtobufOutput -Recommended.Proto3.JsonInput.OneofZeroEnum.JsonOutput Recommended.Proto3.JsonInput.OneofZeroEnum.ProtobufOutput Recommended.Proto3.JsonInput.OneofZeroFloat.JsonOutput Recommended.Proto3.JsonInput.OneofZeroFloat.ProtobufOutput -Recommended.Proto3.JsonInput.OneofZeroMessage.JsonOutput Recommended.Proto3.JsonInput.OneofZeroMessage.ProtobufOutput Recommended.Proto3.JsonInput.OneofZeroString.JsonOutput Recommended.Proto3.JsonInput.OneofZeroString.ProtobufOutput @@ -260,12 +39,18 @@ Recommended.Proto3.JsonInput.OneofZeroUint32.JsonOutput Recommended.Proto3.JsonInput.OneofZeroUint32.ProtobufOutput Recommended.Proto3.JsonInput.OneofZeroUint64.JsonOutput Recommended.Proto3.JsonInput.OneofZeroUint64.ProtobufOutput +Recommended.Proto3.JsonInput.RejectUnknownEnumStringValueInMapValue +Recommended.Proto3.JsonInput.RejectUnknownEnumStringValueInOptionalField +Recommended.Proto3.JsonInput.RejectUnknownEnumStringValueInRepeatedField +Recommended.Proto3.JsonInput.RepeatedFieldPrimitiveElementIsNull +Recommended.Proto3.JsonInput.StringFieldSurrogateInWrongOrder +Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate +Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate Recommended.Proto3.JsonInput.TimestampHas3FractionalDigits.Validator Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator Recommended.Proto3.JsonInput.TimestampHas9FractionalDigits.Validator Recommended.Proto3.JsonInput.TimestampHasZeroFractionalDigit.Validator Recommended.Proto3.JsonInput.TimestampZeroNormalized.Validator -Recommended.Proto3.JsonInput.Uint64FieldBeString.Validator Recommended.Proto3.ProtobufInput.OneofZeroBool.ProtobufOutput Recommended.Proto3.ProtobufInput.OneofZeroBytes.JsonOutput Recommended.Proto3.ProtobufInput.OneofZeroBytes.ProtobufOutput @@ -487,443 +272,6 @@ Recommended.ValueRejectInfNumberValue.JsonOutput Recommended.ValueRejectNanNumberValue.JsonOutput Required.DurationProtoInputTooLarge.JsonOutput Required.DurationProtoInputTooSmall.JsonOutput -Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator -Required.Proto2.ProtobufInput.IllegalZeroFieldNum_Case_0 -Required.Proto2.ProtobufInput.IllegalZeroFieldNum_Case_1 -Required.Proto2.ProtobufInput.IllegalZeroFieldNum_Case_2 -Required.Proto2.ProtobufInput.IllegalZeroFieldNum_Case_3 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.BOOL -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.BYTES -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.DOUBLE -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.ENUM -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.FIXED32 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.FIXED64 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.FLOAT -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.INT32 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.INT64 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.MESSAGE -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.SFIXED32 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.SFIXED64 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.SINT32 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.SINT64 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.STRING -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.UINT32 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownNonRepeatedValue.UINT64 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.BOOL -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.BYTES -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.DOUBLE -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.ENUM -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.FIXED32 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.FIXED64 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.FLOAT -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.INT32 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.INT64 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.MESSAGE -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.SFIXED32 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.SFIXED64 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.SINT32 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.SINT64 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.STRING -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.UINT32 -Required.Proto2.ProtobufInput.PrematureEofBeforeKnownRepeatedValue.UINT64 -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.BOOL -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.BYTES -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.DOUBLE -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.ENUM -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.FIXED32 -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.FIXED64 -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.FLOAT -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.INT32 -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.INT64 -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.MESSAGE -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.SFIXED32 -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.SFIXED64 -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.SINT32 -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.SINT64 -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.STRING -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.UINT32 -Required.Proto2.ProtobufInput.PrematureEofBeforeUnknownValue.UINT64 -Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.BYTES -Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE -Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.STRING -Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.BYTES -Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE -Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.STRING -Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForUnknownValue.BYTES -Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForUnknownValue.MESSAGE -Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForUnknownValue.STRING -Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL -Required.Proto2.ProtobufInput.PrematureEofInPackedField.DOUBLE -Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM -Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED32 -Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED64 -Required.Proto2.ProtobufInput.PrematureEofInPackedField.FLOAT -Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32 -Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64 -Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED32 -Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED64 -Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32 -Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64 -Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32 -Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64 -Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.BOOL -Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.DOUBLE -Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.ENUM -Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.FIXED32 -Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.FIXED64 -Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.FLOAT -Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.INT32 -Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.INT64 -Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.SFIXED32 -Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.SFIXED64 -Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.SINT32 -Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.SINT64 -Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.UINT32 -Required.Proto2.ProtobufInput.PrematureEofInPackedFieldValue.UINT64 -Required.Proto2.ProtobufInput.PrematureEofInSubmessageValue.MESSAGE -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.BOOL -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.BYTES -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.DOUBLE -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.ENUM -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.FIXED32 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.FIXED64 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.FLOAT -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.INT32 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.INT64 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.MESSAGE -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.SFIXED32 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.SFIXED64 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.SINT32 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.SINT64 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.STRING -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.UINT32 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.UINT64 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.BOOL -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.BYTES -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.DOUBLE -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.ENUM -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.FIXED32 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.FIXED64 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.FLOAT -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.INT32 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.INT64 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.MESSAGE -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.SFIXED32 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.SFIXED64 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.SINT32 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.SINT64 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.STRING -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.UINT32 -Required.Proto2.ProtobufInput.PrematureEofInsideKnownRepeatedValue.UINT64 -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.BOOL -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.BYTES -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.DOUBLE -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.ENUM -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.FIXED32 -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.FIXED64 -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.FLOAT -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.INT32 -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.INT64 -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.MESSAGE -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.SFIXED32 -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.SFIXED64 -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.SINT32 -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.SINT64 -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.STRING -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.UINT32 -Required.Proto2.ProtobufInput.PrematureEofInsideUnknownValue.UINT64 -Required.Proto2.ProtobufInput.RepeatedScalarMessageMerge.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.BOOL.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.BYTES.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.DOUBLE.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.ENUM.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.FIXED32.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.FIXED64.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.FLOAT.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.INT32.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.INT64.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.SFIXED32.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.SFIXED64.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.SINT32.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.SINT64.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.STRING.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.UINT32.ProtobufOutput -Required.Proto2.ProtobufInput.RepeatedScalarSelectsLast.UINT64.ProtobufOutput -Required.Proto2.ProtobufInput.UnknownVarint.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.BOOL.BOOL.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.BOOL.BOOL.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.BOOL.BOOL.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.BOOL.BOOL.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.FIXED32.FIXED32.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.FIXED32.FIXED32.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.FIXED32.FIXED32.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.FIXED32.FIXED32.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.FIXED64.FIXED64.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.FIXED64.FIXED64.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.FIXED64.FIXED64.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.FIXED64.FIXED64.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.DOUBLE.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.DOUBLE.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.DOUBLE.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.DOUBLE.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.FLOAT.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.FLOAT.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.FLOAT.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.FLOAT.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.INT32.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.INT32.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.INT32.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT32.INT32.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT64.INT64.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT64.INT64.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT64.INT64.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.INT64.INT64.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SINT32.SINT32.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SINT32.SINT32.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SINT32.SINT32.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SINT32.SINT32.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SINT64.SINT64.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SINT64.SINT64.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SINT64.SINT64.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.SINT64.SINT64.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.BYTES.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.BYTES.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.BYTES.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.BYTES.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.ENUM.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.ENUM.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.ENUM.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.ENUM.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.MergeValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.MESSAGE.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.STRING.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.STRING.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.STRING.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.STRING.STRING.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.UINT32.UINT32.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.UINT32.UINT32.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.UINT32.UINT32.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.UINT32.UINT32.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.UINT64.UINT64.Default.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateKey.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateKeyInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateValueInMapEntry.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.UINT64.UINT64.MissingDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.UINT64.UINT64.NonDefault.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataMap.UINT64.UINT64.Unordered.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.BOOL.DefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.BOOL.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.BOOL.MultipleValuesForSameField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.BOOL.NonDefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.BYTES.DefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.BYTES.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.BYTES.MultipleValuesForSameField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.BYTES.NonDefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.DOUBLE.DefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.DOUBLE.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.DOUBLE.MultipleValuesForSameField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.DOUBLE.NonDefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.ENUM.DefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.ENUM.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.ENUM.MultipleValuesForSameField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.ENUM.NonDefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.FLOAT.DefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.FLOAT.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.FLOAT.MultipleValuesForSameField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.FLOAT.NonDefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.MESSAGE.DefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.MESSAGE.Merge.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.MESSAGE.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.MESSAGE.MultipleValuesForSameField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.MESSAGE.NonDefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.STRING.DefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.STRING.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.STRING.MultipleValuesForSameField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.STRING.NonDefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.UINT32.DefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.UINT32.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.UINT32.MultipleValuesForSameField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.UINT32.NonDefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.UINT64.DefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.UINT64.MultipleValuesForDifferentField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.UINT64.MultipleValuesForSameField.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataOneof.UINT64.NonDefaultValue.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.BYTES.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.MESSAGE.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.STRING.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.BOOL[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.BOOL[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.BOOL[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.BOOL[3].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.BOOL[4].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.BOOL[5].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.BOOL[6].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.BYTES[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.BYTES[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.BYTES[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.BYTES[3].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.DOUBLE[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.DOUBLE[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.DOUBLE[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.DOUBLE[3].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.ENUM[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.ENUM[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.ENUM[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.ENUM[3].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.ENUM[4].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.ENUM[5].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.FIXED32[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.FIXED32[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.FIXED32[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.FIXED64[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.FIXED64[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.FIXED64[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.FLOAT[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.FLOAT[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.FLOAT[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.FLOAT[3].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.FLOAT[4].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.INT32[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.INT32[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.INT32[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.INT32[3].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.INT32[4].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.INT32[5].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.INT32[6].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.INT32[7].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.INT32[8].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.INT32[9].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.INT64[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.INT64[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.INT64[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.INT64[3].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.MESSAGE[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.MESSAGE[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED32[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED32[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED32[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED32[3].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED64[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED64[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED64[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SFIXED64[3].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SINT32[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SINT32[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SINT32[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SINT32[3].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SINT32[4].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SINT64[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SINT64[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SINT64[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.SINT64[3].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.STRING[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.STRING[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.STRING[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.STRING[3].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.STRING[4].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.STRING[5].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.STRING[6].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[2].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[3].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[4].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[5].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[6].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[7].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[8].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.UINT32[9].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.UINT64[0].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.UINT64[1].ProtobufOutput -Required.Proto2.ProtobufInput.ValidDataScalar.UINT64[2].ProtobufOutput -Required.Proto3.JsonInput.AllFieldAcceptNull.JsonOutput Required.Proto3.JsonInput.AllFieldAcceptNull.ProtobufOutput Required.Proto3.JsonInput.Any.JsonOutput Required.Proto3.JsonInput.Any.ProtobufOutput @@ -945,95 +293,62 @@ Required.Proto3.JsonInput.AnyWithValueForInteger.JsonOutput Required.Proto3.JsonInput.AnyWithValueForInteger.ProtobufOutput Required.Proto3.JsonInput.AnyWithValueForJsonObject.JsonOutput Required.Proto3.JsonInput.AnyWithValueForJsonObject.ProtobufOutput -Required.Proto3.JsonInput.BoolFieldFalse.JsonOutput Required.Proto3.JsonInput.BoolFieldFalse.ProtobufOutput -Required.Proto3.JsonInput.BoolFieldTrue.JsonOutput Required.Proto3.JsonInput.BoolFieldTrue.ProtobufOutput -Required.Proto3.JsonInput.BoolMapEscapedKey.JsonOutput Required.Proto3.JsonInput.BoolMapEscapedKey.ProtobufOutput Required.Proto3.JsonInput.BoolMapField.JsonOutput Required.Proto3.JsonInput.BoolMapField.ProtobufOutput -Required.Proto3.JsonInput.BytesField.JsonOutput Required.Proto3.JsonInput.BytesField.ProtobufOutput -Required.Proto3.JsonInput.BytesRepeatedField.JsonOutput Required.Proto3.JsonInput.BytesRepeatedField.ProtobufOutput -Required.Proto3.JsonInput.DoubleFieldInfinity.JsonOutput Required.Proto3.JsonInput.DoubleFieldInfinity.ProtobufOutput -Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput -Required.Proto3.JsonInput.DoubleFieldMaxPositiveValue.JsonOutput Required.Proto3.JsonInput.DoubleFieldMaxPositiveValue.ProtobufOutput -Required.Proto3.JsonInput.DoubleFieldMinNegativeValue.JsonOutput Required.Proto3.JsonInput.DoubleFieldMinNegativeValue.ProtobufOutput -Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.JsonOutput Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput -Required.Proto3.JsonInput.DoubleFieldNan.JsonOutput Required.Proto3.JsonInput.DoubleFieldNan.ProtobufOutput -Required.Proto3.JsonInput.DoubleFieldNegativeInfinity.JsonOutput Required.Proto3.JsonInput.DoubleFieldNegativeInfinity.ProtobufOutput -Required.Proto3.JsonInput.DoubleFieldQuotedValue.JsonOutput Required.Proto3.JsonInput.DoubleFieldQuotedValue.ProtobufOutput +Required.Proto3.JsonInput.DoubleFieldTooSmall +Required.Proto3.JsonInput.DurationJsonInputTooLarge +Required.Proto3.JsonInput.DurationJsonInputTooSmall Required.Proto3.JsonInput.DurationMaxValue.JsonOutput Required.Proto3.JsonInput.DurationMaxValue.ProtobufOutput Required.Proto3.JsonInput.DurationMinValue.JsonOutput Required.Proto3.JsonInput.DurationMinValue.ProtobufOutput +Required.Proto3.JsonInput.DurationMissingS Required.Proto3.JsonInput.DurationNegativeNanos.JsonOutput Required.Proto3.JsonInput.DurationNegativeNanos.ProtobufOutput Required.Proto3.JsonInput.DurationNegativeSeconds.JsonOutput Required.Proto3.JsonInput.DurationNegativeSeconds.ProtobufOutput -Required.Proto3.JsonInput.DurationNull.JsonOutput Required.Proto3.JsonInput.DurationNull.ProtobufOutput Required.Proto3.JsonInput.DurationRepeatedValue.JsonOutput Required.Proto3.JsonInput.DurationRepeatedValue.ProtobufOutput Required.Proto3.JsonInput.EmptyFieldMask.JsonOutput Required.Proto3.JsonInput.EmptyFieldMask.ProtobufOutput -Required.Proto3.JsonInput.EnumField.JsonOutput Required.Proto3.JsonInput.EnumField.ProtobufOutput -Required.Proto3.JsonInput.EnumFieldNumericValueNonZero.JsonOutput Required.Proto3.JsonInput.EnumFieldNumericValueNonZero.ProtobufOutput -Required.Proto3.JsonInput.EnumFieldNumericValueZero.JsonOutput Required.Proto3.JsonInput.EnumFieldNumericValueZero.ProtobufOutput -Required.Proto3.JsonInput.EnumFieldUnknownValue.Validator -Required.Proto3.JsonInput.EnumFieldWithAlias.JsonOutput Required.Proto3.JsonInput.EnumFieldWithAlias.ProtobufOutput -Required.Proto3.JsonInput.EnumFieldWithAliasDifferentCase.JsonOutput Required.Proto3.JsonInput.EnumFieldWithAliasDifferentCase.ProtobufOutput -Required.Proto3.JsonInput.EnumFieldWithAliasLowerCase.JsonOutput Required.Proto3.JsonInput.EnumFieldWithAliasLowerCase.ProtobufOutput -Required.Proto3.JsonInput.EnumFieldWithAliasUseAlias.JsonOutput Required.Proto3.JsonInput.EnumFieldWithAliasUseAlias.ProtobufOutput -Required.Proto3.JsonInput.EnumRepeatedField.JsonOutput Required.Proto3.JsonInput.EnumRepeatedField.ProtobufOutput Required.Proto3.JsonInput.FieldMask.JsonOutput Required.Proto3.JsonInput.FieldMask.ProtobufOutput -Required.Proto3.JsonInput.FieldNameEscaped.JsonOutput Required.Proto3.JsonInput.FieldNameEscaped.ProtobufOutput -Required.Proto3.JsonInput.FieldNameInLowerCamelCase.Validator -Required.Proto3.JsonInput.FieldNameInSnakeCase.JsonOutput Required.Proto3.JsonInput.FieldNameInSnakeCase.ProtobufOutput -Required.Proto3.JsonInput.FieldNameWithMixedCases.JsonOutput Required.Proto3.JsonInput.FieldNameWithMixedCases.ProtobufOutput -Required.Proto3.JsonInput.FieldNameWithMixedCases.Validator -Required.Proto3.JsonInput.FieldNameWithNumbers.JsonOutput Required.Proto3.JsonInput.FieldNameWithNumbers.ProtobufOutput -Required.Proto3.JsonInput.FieldNameWithNumbers.Validator -Required.Proto3.JsonInput.FloatFieldInfinity.JsonOutput Required.Proto3.JsonInput.FloatFieldInfinity.ProtobufOutput -Required.Proto3.JsonInput.FloatFieldMaxNegativeValue.JsonOutput Required.Proto3.JsonInput.FloatFieldMaxNegativeValue.ProtobufOutput -Required.Proto3.JsonInput.FloatFieldMaxPositiveValue.JsonOutput Required.Proto3.JsonInput.FloatFieldMaxPositiveValue.ProtobufOutput -Required.Proto3.JsonInput.FloatFieldMinNegativeValue.JsonOutput Required.Proto3.JsonInput.FloatFieldMinNegativeValue.ProtobufOutput -Required.Proto3.JsonInput.FloatFieldMinPositiveValue.JsonOutput Required.Proto3.JsonInput.FloatFieldMinPositiveValue.ProtobufOutput -Required.Proto3.JsonInput.FloatFieldNan.JsonOutput Required.Proto3.JsonInput.FloatFieldNan.ProtobufOutput -Required.Proto3.JsonInput.FloatFieldNegativeInfinity.JsonOutput Required.Proto3.JsonInput.FloatFieldNegativeInfinity.ProtobufOutput -Required.Proto3.JsonInput.FloatFieldQuotedValue.JsonOutput Required.Proto3.JsonInput.FloatFieldQuotedValue.ProtobufOutput -Required.Proto3.JsonInput.HelloWorld.JsonOutput +Required.Proto3.JsonInput.FloatFieldTooLarge +Required.Proto3.JsonInput.FloatFieldTooSmall Required.Proto3.JsonInput.HelloWorld.ProtobufOutput Required.Proto3.JsonInput.IgnoreUnknownJsonFalse.ProtobufOutput Required.Proto3.JsonInput.IgnoreUnknownJsonNull.ProtobufOutput @@ -1041,47 +356,35 @@ Required.Proto3.JsonInput.IgnoreUnknownJsonNumber.ProtobufOutput Required.Proto3.JsonInput.IgnoreUnknownJsonObject.ProtobufOutput Required.Proto3.JsonInput.IgnoreUnknownJsonString.ProtobufOutput Required.Proto3.JsonInput.IgnoreUnknownJsonTrue.ProtobufOutput -Required.Proto3.JsonInput.Int32FieldExponentialFormat.JsonOutput Required.Proto3.JsonInput.Int32FieldExponentialFormat.ProtobufOutput -Required.Proto3.JsonInput.Int32FieldFloatTrailingZero.JsonOutput Required.Proto3.JsonInput.Int32FieldFloatTrailingZero.ProtobufOutput -Required.Proto3.JsonInput.Int32FieldMaxFloatValue.JsonOutput +Required.Proto3.JsonInput.Int32FieldLeadingSpace Required.Proto3.JsonInput.Int32FieldMaxFloatValue.ProtobufOutput -Required.Proto3.JsonInput.Int32FieldMaxValue.JsonOutput Required.Proto3.JsonInput.Int32FieldMaxValue.ProtobufOutput -Required.Proto3.JsonInput.Int32FieldMinFloatValue.JsonOutput Required.Proto3.JsonInput.Int32FieldMinFloatValue.ProtobufOutput -Required.Proto3.JsonInput.Int32FieldMinValue.JsonOutput Required.Proto3.JsonInput.Int32FieldMinValue.ProtobufOutput -Required.Proto3.JsonInput.Int32FieldStringValue.JsonOutput +Required.Proto3.JsonInput.Int32FieldNotInteger +Required.Proto3.JsonInput.Int32FieldNotNumber Required.Proto3.JsonInput.Int32FieldStringValue.ProtobufOutput -Required.Proto3.JsonInput.Int32FieldStringValueEscaped.JsonOutput Required.Proto3.JsonInput.Int32FieldStringValueEscaped.ProtobufOutput -Required.Proto3.JsonInput.Int32MapEscapedKey.JsonOutput +Required.Proto3.JsonInput.Int32FieldTooLarge +Required.Proto3.JsonInput.Int32FieldTooSmall +Required.Proto3.JsonInput.Int32FieldTrailingSpace Required.Proto3.JsonInput.Int32MapEscapedKey.ProtobufOutput -Required.Proto3.JsonInput.Int32MapField.JsonOutput Required.Proto3.JsonInput.Int32MapField.ProtobufOutput -Required.Proto3.JsonInput.Int64FieldMaxValue.JsonOutput Required.Proto3.JsonInput.Int64FieldMaxValue.ProtobufOutput -Required.Proto3.JsonInput.Int64FieldMaxValueNotQuoted.JsonOutput Required.Proto3.JsonInput.Int64FieldMaxValueNotQuoted.ProtobufOutput -Required.Proto3.JsonInput.Int64FieldMinValue.JsonOutput Required.Proto3.JsonInput.Int64FieldMinValue.ProtobufOutput -Required.Proto3.JsonInput.Int64FieldMinValueNotQuoted.JsonOutput Required.Proto3.JsonInput.Int64FieldMinValueNotQuoted.ProtobufOutput -Required.Proto3.JsonInput.Int64MapEscapedKey.JsonOutput +Required.Proto3.JsonInput.Int64FieldTooLarge +Required.Proto3.JsonInput.Int64FieldTooSmall Required.Proto3.JsonInput.Int64MapEscapedKey.ProtobufOutput -Required.Proto3.JsonInput.Int64MapField.JsonOutput Required.Proto3.JsonInput.Int64MapField.ProtobufOutput -Required.Proto3.JsonInput.MessageField.JsonOutput Required.Proto3.JsonInput.MessageField.ProtobufOutput -Required.Proto3.JsonInput.MessageMapField.JsonOutput Required.Proto3.JsonInput.MessageMapField.ProtobufOutput -Required.Proto3.JsonInput.MessageRepeatedField.JsonOutput Required.Proto3.JsonInput.MessageRepeatedField.ProtobufOutput -Required.Proto3.JsonInput.OneofFieldNullFirst.JsonOutput +Required.Proto3.JsonInput.OneofFieldDuplicate Required.Proto3.JsonInput.OneofFieldNullFirst.ProtobufOutput -Required.Proto3.JsonInput.OneofFieldNullSecond.JsonOutput Required.Proto3.JsonInput.OneofFieldNullSecond.ProtobufOutput Required.Proto3.JsonInput.OptionalBoolWrapper.JsonOutput Required.Proto3.JsonInput.OptionalBoolWrapper.ProtobufOutput @@ -1103,9 +406,7 @@ Required.Proto3.JsonInput.OptionalUint64Wrapper.JsonOutput Required.Proto3.JsonInput.OptionalUint64Wrapper.ProtobufOutput Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput -Required.Proto3.JsonInput.OriginalProtoFieldName.JsonOutput Required.Proto3.JsonInput.OriginalProtoFieldName.ProtobufOutput -Required.Proto3.JsonInput.PrimitiveRepeatedField.JsonOutput Required.Proto3.JsonInput.PrimitiveRepeatedField.ProtobufOutput Required.Proto3.JsonInput.RepeatedBoolWrapper.JsonOutput Required.Proto3.JsonInput.RepeatedBoolWrapper.ProtobufOutput @@ -1113,6 +414,15 @@ Required.Proto3.JsonInput.RepeatedBytesWrapper.JsonOutput Required.Proto3.JsonInput.RepeatedBytesWrapper.ProtobufOutput Required.Proto3.JsonInput.RepeatedDoubleWrapper.JsonOutput Required.Proto3.JsonInput.RepeatedDoubleWrapper.ProtobufOutput +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotMessage +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotString +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingMessagesGotBool +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingMessagesGotInt +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingMessagesGotString +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt +Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotMessage Required.Proto3.JsonInput.RepeatedFloatWrapper.JsonOutput Required.Proto3.JsonInput.RepeatedFloatWrapper.ProtobufOutput Required.Proto3.JsonInput.RepeatedInt32Wrapper.JsonOutput @@ -1129,32 +439,30 @@ Required.Proto3.JsonInput.RepeatedUint64Wrapper.JsonOutput Required.Proto3.JsonInput.RepeatedUint64Wrapper.ProtobufOutput Required.Proto3.JsonInput.RepeatedValue.JsonOutput Required.Proto3.JsonInput.RepeatedValue.ProtobufOutput -Required.Proto3.JsonInput.SkipsDefaultPrimitive.Validator -Required.Proto3.JsonInput.StringField.JsonOutput Required.Proto3.JsonInput.StringField.ProtobufOutput -Required.Proto3.JsonInput.StringFieldEscape.JsonOutput Required.Proto3.JsonInput.StringFieldEscape.ProtobufOutput -Required.Proto3.JsonInput.StringFieldSurrogatePair.JsonOutput +Required.Proto3.JsonInput.StringFieldNotAString Required.Proto3.JsonInput.StringFieldSurrogatePair.ProtobufOutput -Required.Proto3.JsonInput.StringFieldUnicode.JsonOutput Required.Proto3.JsonInput.StringFieldUnicode.ProtobufOutput -Required.Proto3.JsonInput.StringFieldUnicodeEscape.JsonOutput Required.Proto3.JsonInput.StringFieldUnicodeEscape.ProtobufOutput -Required.Proto3.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.JsonOutput Required.Proto3.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.ProtobufOutput -Required.Proto3.JsonInput.StringRepeatedField.JsonOutput Required.Proto3.JsonInput.StringRepeatedField.ProtobufOutput Required.Proto3.JsonInput.Struct.JsonOutput Required.Proto3.JsonInput.Struct.ProtobufOutput Required.Proto3.JsonInput.StructWithEmptyListValue.JsonOutput Required.Proto3.JsonInput.StructWithEmptyListValue.ProtobufOutput +Required.Proto3.JsonInput.TimestampJsonInputLowercaseT +Required.Proto3.JsonInput.TimestampJsonInputLowercaseZ +Required.Proto3.JsonInput.TimestampJsonInputMissingT +Required.Proto3.JsonInput.TimestampJsonInputMissingZ +Required.Proto3.JsonInput.TimestampJsonInputTooLarge +Required.Proto3.JsonInput.TimestampJsonInputTooSmall Required.Proto3.JsonInput.TimestampLeap.JsonOutput Required.Proto3.JsonInput.TimestampLeap.ProtobufOutput Required.Proto3.JsonInput.TimestampMaxValue.JsonOutput Required.Proto3.JsonInput.TimestampMaxValue.ProtobufOutput Required.Proto3.JsonInput.TimestampMinValue.JsonOutput Required.Proto3.JsonInput.TimestampMinValue.ProtobufOutput -Required.Proto3.JsonInput.TimestampNull.JsonOutput Required.Proto3.JsonInput.TimestampNull.ProtobufOutput Required.Proto3.JsonInput.TimestampRepeatedValue.JsonOutput Required.Proto3.JsonInput.TimestampRepeatedValue.ProtobufOutput @@ -1162,17 +470,15 @@ Required.Proto3.JsonInput.TimestampWithNegativeOffset.JsonOutput Required.Proto3.JsonInput.TimestampWithNegativeOffset.ProtobufOutput Required.Proto3.JsonInput.TimestampWithPositiveOffset.JsonOutput Required.Proto3.JsonInput.TimestampWithPositiveOffset.ProtobufOutput -Required.Proto3.JsonInput.Uint32FieldMaxFloatValue.JsonOutput Required.Proto3.JsonInput.Uint32FieldMaxFloatValue.ProtobufOutput -Required.Proto3.JsonInput.Uint32FieldMaxValue.JsonOutput Required.Proto3.JsonInput.Uint32FieldMaxValue.ProtobufOutput -Required.Proto3.JsonInput.Uint32MapField.JsonOutput +Required.Proto3.JsonInput.Uint32FieldNotInteger +Required.Proto3.JsonInput.Uint32FieldNotNumber +Required.Proto3.JsonInput.Uint32FieldTooLarge Required.Proto3.JsonInput.Uint32MapField.ProtobufOutput -Required.Proto3.JsonInput.Uint64FieldMaxValue.JsonOutput Required.Proto3.JsonInput.Uint64FieldMaxValue.ProtobufOutput -Required.Proto3.JsonInput.Uint64FieldMaxValueNotQuoted.JsonOutput Required.Proto3.JsonInput.Uint64FieldMaxValueNotQuoted.ProtobufOutput -Required.Proto3.JsonInput.Uint64MapField.JsonOutput +Required.Proto3.JsonInput.Uint64FieldTooLarge Required.Proto3.JsonInput.Uint64MapField.ProtobufOutput Required.Proto3.JsonInput.ValueAcceptBool.JsonOutput Required.Proto3.JsonInput.ValueAcceptBool.ProtobufOutput @@ -1188,7 +494,6 @@ Required.Proto3.JsonInput.ValueAcceptObject.JsonOutput Required.Proto3.JsonInput.ValueAcceptObject.ProtobufOutput Required.Proto3.JsonInput.ValueAcceptString.JsonOutput Required.Proto3.JsonInput.ValueAcceptString.ProtobufOutput -Required.Proto3.JsonInput.WrapperTypesWithNullValue.JsonOutput Required.Proto3.JsonInput.WrapperTypesWithNullValue.ProtobufOutput Required.Proto3.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput Required.Proto3.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput diff --git a/e2e/conformance/proto/conformance/conformance.pb.ts b/e2e/conformance/proto/conformance/conformance.pb.ts index 7d3722a..9134b0f 100644 --- a/e2e/conformance/proto/conformance/conformance.pb.ts +++ b/e2e/conformance/proto/conformance/conformance.pb.ts @@ -3,12 +3,7 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { - BinaryReader, - BinaryWriter, - encodeBase64Bytes, - decodeBase64Bytes, -} from "protoscript"; +import * as protoscript from "protoscript"; //========================================// // Types // @@ -299,7 +294,10 @@ export const FailureSet = { * Serializes FailureSet to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return FailureSet._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return FailureSet._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** @@ -308,7 +306,7 @@ export const FailureSet = { decode: function (bytes: ByteSource): FailureSet { return FailureSet._readMessage( FailureSet.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -326,8 +324,8 @@ export const FailureSet = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.failure?.length) { writer.writeRepeatedString(1, msg.failure); } @@ -337,7 +335,10 @@ export const FailureSet = { /** * @private */ - _readMessage: function (msg: FailureSet, reader: BinaryReader): FailureSet { + _readMessage: function ( + msg: FailureSet, + reader: protoscript.BinaryReader, + ): FailureSet { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -362,7 +363,7 @@ export const ConformanceRequest = { encode: function (msg: PartialDeep): Uint8Array { return ConformanceRequest._writeMessage( msg, - new BinaryWriter(), + new protoscript.BinaryWriter(), ).getResultBuffer(); }, @@ -372,7 +373,7 @@ export const ConformanceRequest = { decode: function (bytes: ByteSource): ConformanceRequest { return ConformanceRequest._readMessage( ConformanceRequest.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -398,8 +399,8 @@ export const ConformanceRequest = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.protobufPayload?.length) { writer.writeBytes(1, msg.protobufPayload); } @@ -442,7 +443,7 @@ export const ConformanceRequest = { */ _readMessage: function ( msg: ConformanceRequest, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): ConformanceRequest { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -503,7 +504,7 @@ export const ConformanceResponse = { encode: function (msg: PartialDeep): Uint8Array { return ConformanceResponse._writeMessage( msg, - new BinaryWriter(), + new protoscript.BinaryWriter(), ).getResultBuffer(); }, @@ -513,7 +514,7 @@ export const ConformanceResponse = { decode: function (bytes: ByteSource): ConformanceResponse { return ConformanceResponse._readMessage( ConformanceResponse.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -539,8 +540,8 @@ export const ConformanceResponse = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.parseError != undefined) { writer.writeString(1, msg.parseError); } @@ -576,7 +577,7 @@ export const ConformanceResponse = { */ _readMessage: function ( msg: ConformanceResponse, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): ConformanceResponse { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -634,7 +635,7 @@ export const JspbEncodingConfig = { encode: function (msg: PartialDeep): Uint8Array { return JspbEncodingConfig._writeMessage( msg, - new BinaryWriter(), + new protoscript.BinaryWriter(), ).getResultBuffer(); }, @@ -644,7 +645,7 @@ export const JspbEncodingConfig = { decode: function (bytes: ByteSource): JspbEncodingConfig { return JspbEncodingConfig._readMessage( JspbEncodingConfig.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -662,8 +663,8 @@ export const JspbEncodingConfig = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.useJspbArrayAnyFormat) { writer.writeBool(1, msg.useJspbArrayAnyFormat); } @@ -675,7 +676,7 @@ export const JspbEncodingConfig = { */ _readMessage: function ( msg: JspbEncodingConfig, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): JspbEncodingConfig { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -935,7 +936,9 @@ export const ConformanceRequestJSON = { ): Record { const json: Record = {}; if (msg.protobufPayload?.length) { - json["protobufPayload"] = encodeBase64Bytes(msg.protobufPayload); + json["protobufPayload"] = protoscript.encodeBase64Bytes( + msg.protobufPayload, + ); } if (msg.jsonPayload != undefined) { json["jsonPayload"] = msg.jsonPayload; @@ -982,7 +985,7 @@ export const ConformanceRequestJSON = { const _protobufPayload_ = json["protobufPayload"] ?? json["protobuf_payload"]; if (_protobufPayload_) { - msg.protobufPayload = decodeBase64Bytes(_protobufPayload_); + msg.protobufPayload = protoscript.parseBytes(_protobufPayload_); } const _jsonPayload_ = json["jsonPayload"] ?? json["json_payload"]; if (_jsonPayload_) { @@ -999,7 +1002,7 @@ export const ConformanceRequestJSON = { const _requestedOutputFormat_ = json["requestedOutputFormat"] ?? json["requested_output_format"]; if (_requestedOutputFormat_) { - msg.requestedOutputFormat = _requestedOutputFormat_; + msg.requestedOutputFormat = WireFormat._fromInt(_requestedOutputFormat_); } const _messageType_ = json["messageType"] ?? json["message_type"]; if (_messageType_) { @@ -1007,7 +1010,7 @@ export const ConformanceRequestJSON = { } const _testCategory_ = json["testCategory"] ?? json["test_category"]; if (_testCategory_) { - msg.testCategory = _testCategory_; + msg.testCategory = TestCategory._fromInt(_testCategory_); } const _jspbEncodingOptions_ = json["jspbEncodingOptions"] ?? json["jspb_encoding_options"]; @@ -1081,7 +1084,9 @@ export const ConformanceResponseJSON = { json["runtimeError"] = msg.runtimeError; } if (msg.protobufPayload?.length) { - json["protobufPayload"] = encodeBase64Bytes(msg.protobufPayload); + json["protobufPayload"] = protoscript.encodeBase64Bytes( + msg.protobufPayload, + ); } if (msg.jsonPayload != undefined) { json["jsonPayload"] = msg.jsonPayload; @@ -1124,7 +1129,7 @@ export const ConformanceResponseJSON = { const _protobufPayload_ = json["protobufPayload"] ?? json["protobuf_payload"]; if (_protobufPayload_) { - msg.protobufPayload = decodeBase64Bytes(_protobufPayload_); + msg.protobufPayload = protoscript.parseBytes(_protobufPayload_); } const _jsonPayload_ = json["jsonPayload"] ?? json["json_payload"]; if (_jsonPayload_) { diff --git a/e2e/conformance/proto/google/protobuf/test_messages_proto3.pb.ts b/e2e/conformance/proto/google/protobuf/test_messages_proto3.pb.ts index e51511a..b288064 100644 --- a/e2e/conformance/proto/google/protobuf/test_messages_proto3.pb.ts +++ b/e2e/conformance/proto/google/protobuf/test_messages_proto3.pb.ts @@ -3,13 +3,6 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { - BinaryReader, - BinaryWriter, - encodeBase64Bytes, - decodeBase64Bytes, -} from "protoscript"; - import * as protoscript from "protoscript"; //========================================// @@ -441,7 +434,7 @@ export const TestAllTypesProto3 = { encode: function (msg: PartialDeep): Uint8Array { return TestAllTypesProto3._writeMessage( msg, - new BinaryWriter(), + new protoscript.BinaryWriter(), ).getResultBuffer(); }, @@ -451,7 +444,7 @@ export const TestAllTypesProto3 = { decode: function (bytes: ByteSource): TestAllTypesProto3 { return TestAllTypesProto3._readMessage( TestAllTypesProto3.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -619,8 +612,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.optionalInt32) { writer.writeInt32(1, msg.optionalInt32); } @@ -1440,7 +1433,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3 { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -2592,7 +2585,7 @@ export const TestAllTypesProto3 = { ): Uint8Array { return TestAllTypesProto3.NestedMessage._writeMessage( msg, - new BinaryWriter(), + new protoscript.BinaryWriter(), ).getResultBuffer(); }, @@ -2602,7 +2595,7 @@ export const TestAllTypesProto3 = { decode: function (bytes: ByteSource): TestAllTypesProto3.NestedMessage { return TestAllTypesProto3.NestedMessage._readMessage( TestAllTypesProto3.NestedMessage.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -2621,8 +2614,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.a) { writer.writeInt32(1, msg.a); } @@ -2641,7 +2634,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.NestedMessage, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.NestedMessage { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -2674,8 +2667,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeInt32(1, msg.key); } @@ -2690,7 +2683,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapInt32Int32, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapInt32Int32 { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -2719,8 +2712,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeInt64String(1, msg.key.toString() as any); } @@ -2735,7 +2728,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapInt64Int64, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapInt64Int64 { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -2764,8 +2757,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeUint32(1, msg.key); } @@ -2780,7 +2773,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapUint32Uint32, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapUint32Uint32 { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -2809,8 +2802,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeUint64String(1, msg.key.toString() as any); } @@ -2825,7 +2818,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapUint64Uint64, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapUint64Uint64 { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -2854,8 +2847,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeSint32(1, msg.key); } @@ -2870,7 +2863,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapSint32Sint32, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapSint32Sint32 { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -2899,8 +2892,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeSint64String(1, msg.key.toString() as any); } @@ -2915,7 +2908,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapSint64Sint64, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapSint64Sint64 { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -2944,8 +2937,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeFixed32(1, msg.key); } @@ -2960,7 +2953,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapFixed32Fixed32, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapFixed32Fixed32 { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -2989,8 +2982,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeFixed64String(1, msg.key.toString() as any); } @@ -3005,7 +2998,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapFixed64Fixed64, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapFixed64Fixed64 { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -3034,8 +3027,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeSfixed32(1, msg.key); } @@ -3050,7 +3043,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapSfixed32Sfixed32, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapSfixed32Sfixed32 { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -3079,8 +3072,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeSfixed64String(1, msg.key.toString() as any); } @@ -3095,7 +3088,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapSfixed64Sfixed64, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapSfixed64Sfixed64 { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -3124,8 +3117,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeInt32(1, msg.key); } @@ -3140,7 +3133,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapInt32Float, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapInt32Float { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -3169,8 +3162,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeInt32(1, msg.key); } @@ -3185,7 +3178,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapInt32Double, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapInt32Double { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -3214,8 +3207,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeBool(1, msg.key); } @@ -3230,7 +3223,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapBoolBool, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapBoolBool { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -3259,8 +3252,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeString(1, msg.key); } @@ -3275,7 +3268,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapStringString, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapStringString { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -3304,8 +3297,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeString(1, msg.key); } @@ -3320,7 +3313,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapStringBytes, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapStringBytes { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -3349,8 +3342,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeString(1, msg.key); } @@ -3369,7 +3362,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapStringNestedMessage, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapStringNestedMessage { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -3402,8 +3395,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeString(1, msg.key); } @@ -3418,7 +3411,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapStringForeignMessage, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapStringForeignMessage { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -3448,8 +3441,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeString(1, msg.key); } @@ -3464,7 +3457,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapStringNestedEnum, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapStringNestedEnum { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -3495,8 +3488,8 @@ export const TestAllTypesProto3 = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeString(1, msg.key); } @@ -3511,7 +3504,7 @@ export const TestAllTypesProto3 = { */ _readMessage: function ( msg: TestAllTypesProto3.MapStringForeignEnum, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TestAllTypesProto3.MapStringForeignEnum { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -3542,7 +3535,7 @@ export const ForeignMessage = { encode: function (msg: PartialDeep): Uint8Array { return ForeignMessage._writeMessage( msg, - new BinaryWriter(), + new protoscript.BinaryWriter(), ).getResultBuffer(); }, @@ -3552,7 +3545,7 @@ export const ForeignMessage = { decode: function (bytes: ByteSource): ForeignMessage { return ForeignMessage._readMessage( ForeignMessage.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -3570,8 +3563,8 @@ export const ForeignMessage = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.c) { writer.writeInt32(1, msg.c); } @@ -3583,7 +3576,7 @@ export const ForeignMessage = { */ _readMessage: function ( msg: ForeignMessage, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): ForeignMessage { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -3629,8 +3622,8 @@ export const NullHypothesisProto3 = { */ _writeMessage: function ( _msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { return writer; }, @@ -3639,7 +3632,7 @@ export const NullHypothesisProto3 = { */ _readMessage: function ( _msg: NullHypothesisProto3, - _reader: BinaryReader, + _reader: protoscript.BinaryReader, ): NullHypothesisProto3 { return _msg; }, @@ -3672,8 +3665,8 @@ export const EnumOnlyProto3 = { */ _writeMessage: function ( _msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { return writer; }, @@ -3682,7 +3675,7 @@ export const EnumOnlyProto3 = { */ _readMessage: function ( _msg: EnumOnlyProto3, - _reader: BinaryReader, + _reader: protoscript.BinaryReader, ): EnumOnlyProto3 { return _msg; }, @@ -4004,7 +3997,7 @@ export const TestAllTypesProto3JSON = { json["optionalString"] = msg.optionalString; } if (msg.optionalBytes?.length) { - json["optionalBytes"] = encodeBase64Bytes(msg.optionalBytes); + json["optionalBytes"] = protoscript.encodeBase64Bytes(msg.optionalBytes); } if (msg.optionalNestedMessage) { const _optionalNestedMessage_ = @@ -4098,7 +4091,9 @@ export const TestAllTypesProto3JSON = { json["repeatedString"] = msg.repeatedString; } if (msg.repeatedBytes?.length) { - json["repeatedBytes"] = msg.repeatedBytes.map(encodeBase64Bytes); + json["repeatedBytes"] = msg.repeatedBytes.map( + protoscript.encodeBase64Bytes, + ); } if (msg.repeatedNestedMessage?.length) { json["repeatedNestedMessage"] = msg.repeatedNestedMessage.map( @@ -4429,7 +4424,7 @@ export const TestAllTypesProto3JSON = { json["oneofString"] = msg.oneofString; } if (msg.oneofBytes?.length) { - json["oneofBytes"] = encodeBase64Bytes(msg.oneofBytes); + json["oneofBytes"] = protoscript.encodeBase64Bytes(msg.oneofBytes); } if (msg.oneofBool != undefined) { json["oneofBool"] = msg.oneofBool; @@ -4719,7 +4714,7 @@ export const TestAllTypesProto3JSON = { ): TestAllTypesProto3 { const _optionalInt32_ = json["optionalInt32"] ?? json["optional_int32"]; if (_optionalInt32_) { - msg.optionalInt32 = _optionalInt32_; + msg.optionalInt32 = protoscript.parseNumber(_optionalInt32_); } const _optionalInt64_ = json["optionalInt64"] ?? json["optional_int64"]; if (_optionalInt64_) { @@ -4727,7 +4722,7 @@ export const TestAllTypesProto3JSON = { } const _optionalUint32_ = json["optionalUint32"] ?? json["optional_uint32"]; if (_optionalUint32_) { - msg.optionalUint32 = _optionalUint32_; + msg.optionalUint32 = protoscript.parseNumber(_optionalUint32_); } const _optionalUint64_ = json["optionalUint64"] ?? json["optional_uint64"]; if (_optionalUint64_) { @@ -4739,12 +4734,12 @@ export const TestAllTypesProto3JSON = { } const _optionalSint64_ = json["optionalSint64"] ?? json["optional_sint64"]; if (_optionalSint64_) { - msg.optionalSint64 = BigInt(_optionalSint64_); + msg.optionalSint64 = _optionalSint64_; } const _optionalFixed32_ = json["optionalFixed32"] ?? json["optional_fixed32"]; if (_optionalFixed32_) { - msg.optionalFixed32 = _optionalFixed32_; + msg.optionalFixed32 = protoscript.parseNumber(_optionalFixed32_); } const _optionalFixed64_ = json["optionalFixed64"] ?? json["optional_fixed64"]; @@ -4759,15 +4754,15 @@ export const TestAllTypesProto3JSON = { const _optionalSfixed64_ = json["optionalSfixed64"] ?? json["optional_sfixed64"]; if (_optionalSfixed64_) { - msg.optionalSfixed64 = BigInt(_optionalSfixed64_); + msg.optionalSfixed64 = _optionalSfixed64_; } const _optionalFloat_ = json["optionalFloat"] ?? json["optional_float"]; if (_optionalFloat_) { - msg.optionalFloat = _optionalFloat_; + msg.optionalFloat = protoscript.parseDouble(_optionalFloat_); } const _optionalDouble_ = json["optionalDouble"] ?? json["optional_double"]; if (_optionalDouble_) { - msg.optionalDouble = _optionalDouble_; + msg.optionalDouble = protoscript.parseDouble(_optionalDouble_); } const _optionalBool_ = json["optionalBool"] ?? json["optional_bool"]; if (_optionalBool_) { @@ -4779,7 +4774,7 @@ export const TestAllTypesProto3JSON = { } const _optionalBytes_ = json["optionalBytes"] ?? json["optional_bytes"]; if (_optionalBytes_) { - msg.optionalBytes = decodeBase64Bytes(_optionalBytes_); + msg.optionalBytes = protoscript.parseBytes(_optionalBytes_); } const _optionalNestedMessage_ = json["optionalNestedMessage"] ?? json["optional_nested_message"]; @@ -4800,17 +4795,20 @@ export const TestAllTypesProto3JSON = { const _optionalNestedEnum_ = json["optionalNestedEnum"] ?? json["optional_nested_enum"]; if (_optionalNestedEnum_) { - msg.optionalNestedEnum = _optionalNestedEnum_; + msg.optionalNestedEnum = + TestAllTypesProto3.NestedEnum._fromInt(_optionalNestedEnum_); } const _optionalForeignEnum_ = json["optionalForeignEnum"] ?? json["optional_foreign_enum"]; if (_optionalForeignEnum_) { - msg.optionalForeignEnum = _optionalForeignEnum_; + msg.optionalForeignEnum = ForeignEnum._fromInt(_optionalForeignEnum_); } const _optionalAliasedEnum_ = json["optionalAliasedEnum"] ?? json["optional_aliased_enum"]; if (_optionalAliasedEnum_) { - msg.optionalAliasedEnum = _optionalAliasedEnum_; + msg.optionalAliasedEnum = TestAllTypesProto3.AliasedEnum._fromInt( + _optionalAliasedEnum_, + ); } const _optionalStringPiece_ = json["optionalStringPiece"] ?? json["optional_string_piece"]; @@ -4832,7 +4830,7 @@ export const TestAllTypesProto3JSON = { } const _repeatedInt32_ = json["repeatedInt32"] ?? json["repeated_int32"]; if (_repeatedInt32_) { - msg.repeatedInt32 = _repeatedInt32_; + msg.repeatedInt32 = _repeatedInt32_.map(protoscript.parseNumber); } const _repeatedInt64_ = json["repeatedInt64"] ?? json["repeated_int64"]; if (_repeatedInt64_) { @@ -4840,7 +4838,7 @@ export const TestAllTypesProto3JSON = { } const _repeatedUint32_ = json["repeatedUint32"] ?? json["repeated_uint32"]; if (_repeatedUint32_) { - msg.repeatedUint32 = _repeatedUint32_; + msg.repeatedUint32 = _repeatedUint32_.map(protoscript.parseNumber); } const _repeatedUint64_ = json["repeatedUint64"] ?? json["repeated_uint64"]; if (_repeatedUint64_) { @@ -4852,12 +4850,12 @@ export const TestAllTypesProto3JSON = { } const _repeatedSint64_ = json["repeatedSint64"] ?? json["repeated_sint64"]; if (_repeatedSint64_) { - msg.repeatedSint64 = _repeatedSint64_.map(BigInt); + msg.repeatedSint64 = _repeatedSint64_; } const _repeatedFixed32_ = json["repeatedFixed32"] ?? json["repeated_fixed32"]; if (_repeatedFixed32_) { - msg.repeatedFixed32 = _repeatedFixed32_; + msg.repeatedFixed32 = _repeatedFixed32_.map(protoscript.parseNumber); } const _repeatedFixed64_ = json["repeatedFixed64"] ?? json["repeated_fixed64"]; @@ -4872,15 +4870,15 @@ export const TestAllTypesProto3JSON = { const _repeatedSfixed64_ = json["repeatedSfixed64"] ?? json["repeated_sfixed64"]; if (_repeatedSfixed64_) { - msg.repeatedSfixed64 = _repeatedSfixed64_.map(BigInt); + msg.repeatedSfixed64 = _repeatedSfixed64_; } const _repeatedFloat_ = json["repeatedFloat"] ?? json["repeated_float"]; if (_repeatedFloat_) { - msg.repeatedFloat = _repeatedFloat_; + msg.repeatedFloat = _repeatedFloat_.map(protoscript.parseDouble); } const _repeatedDouble_ = json["repeatedDouble"] ?? json["repeated_double"]; if (_repeatedDouble_) { - msg.repeatedDouble = _repeatedDouble_; + msg.repeatedDouble = _repeatedDouble_.map(protoscript.parseDouble); } const _repeatedBool_ = json["repeatedBool"] ?? json["repeated_bool"]; if (_repeatedBool_) { @@ -4892,7 +4890,7 @@ export const TestAllTypesProto3JSON = { } const _repeatedBytes_ = json["repeatedBytes"] ?? json["repeated_bytes"]; if (_repeatedBytes_) { - msg.repeatedBytes = _repeatedBytes_.map(decodeBase64Bytes); + msg.repeatedBytes = _repeatedBytes_.map(protoscript.parseBytes); } const _repeatedNestedMessage_ = json["repeatedNestedMessage"] ?? json["repeated_nested_message"]; @@ -4915,12 +4913,14 @@ export const TestAllTypesProto3JSON = { const _repeatedNestedEnum_ = json["repeatedNestedEnum"] ?? json["repeated_nested_enum"]; if (_repeatedNestedEnum_) { - msg.repeatedNestedEnum = _repeatedNestedEnum_; + msg.repeatedNestedEnum = _repeatedNestedEnum_.map( + TestAllTypesProto3.NestedEnum._fromInt, + ); } const _repeatedForeignEnum_ = json["repeatedForeignEnum"] ?? json["repeated_foreign_enum"]; if (_repeatedForeignEnum_) { - msg.repeatedForeignEnum = _repeatedForeignEnum_; + msg.repeatedForeignEnum = _repeatedForeignEnum_.map(ForeignEnum._fromInt); } const _repeatedStringPiece_ = json["repeatedStringPiece"] ?? json["repeated_string_piece"]; @@ -4933,7 +4933,7 @@ export const TestAllTypesProto3JSON = { } const _packedInt32_ = json["packedInt32"] ?? json["packed_int32"]; if (_packedInt32_) { - msg.packedInt32 = _packedInt32_; + msg.packedInt32 = _packedInt32_.map(protoscript.parseNumber); } const _packedInt64_ = json["packedInt64"] ?? json["packed_int64"]; if (_packedInt64_) { @@ -4941,7 +4941,7 @@ export const TestAllTypesProto3JSON = { } const _packedUint32_ = json["packedUint32"] ?? json["packed_uint32"]; if (_packedUint32_) { - msg.packedUint32 = _packedUint32_; + msg.packedUint32 = _packedUint32_.map(protoscript.parseNumber); } const _packedUint64_ = json["packedUint64"] ?? json["packed_uint64"]; if (_packedUint64_) { @@ -4953,11 +4953,11 @@ export const TestAllTypesProto3JSON = { } const _packedSint64_ = json["packedSint64"] ?? json["packed_sint64"]; if (_packedSint64_) { - msg.packedSint64 = _packedSint64_.map(BigInt); + msg.packedSint64 = _packedSint64_; } const _packedFixed32_ = json["packedFixed32"] ?? json["packed_fixed32"]; if (_packedFixed32_) { - msg.packedFixed32 = _packedFixed32_; + msg.packedFixed32 = _packedFixed32_.map(protoscript.parseNumber); } const _packedFixed64_ = json["packedFixed64"] ?? json["packed_fixed64"]; if (_packedFixed64_) { @@ -4969,15 +4969,15 @@ export const TestAllTypesProto3JSON = { } const _packedSfixed64_ = json["packedSfixed64"] ?? json["packed_sfixed64"]; if (_packedSfixed64_) { - msg.packedSfixed64 = _packedSfixed64_.map(BigInt); + msg.packedSfixed64 = _packedSfixed64_; } const _packedFloat_ = json["packedFloat"] ?? json["packed_float"]; if (_packedFloat_) { - msg.packedFloat = _packedFloat_; + msg.packedFloat = _packedFloat_.map(protoscript.parseDouble); } const _packedDouble_ = json["packedDouble"] ?? json["packed_double"]; if (_packedDouble_) { - msg.packedDouble = _packedDouble_; + msg.packedDouble = _packedDouble_.map(protoscript.parseDouble); } const _packedBool_ = json["packedBool"] ?? json["packed_bool"]; if (_packedBool_) { @@ -4986,11 +4986,13 @@ export const TestAllTypesProto3JSON = { const _packedNestedEnum_ = json["packedNestedEnum"] ?? json["packed_nested_enum"]; if (_packedNestedEnum_) { - msg.packedNestedEnum = _packedNestedEnum_; + msg.packedNestedEnum = _packedNestedEnum_.map( + TestAllTypesProto3.NestedEnum._fromInt, + ); } const _unpackedInt32_ = json["unpackedInt32"] ?? json["unpacked_int32"]; if (_unpackedInt32_) { - msg.unpackedInt32 = _unpackedInt32_; + msg.unpackedInt32 = _unpackedInt32_.map(protoscript.parseNumber); } const _unpackedInt64_ = json["unpackedInt64"] ?? json["unpacked_int64"]; if (_unpackedInt64_) { @@ -4998,7 +5000,7 @@ export const TestAllTypesProto3JSON = { } const _unpackedUint32_ = json["unpackedUint32"] ?? json["unpacked_uint32"]; if (_unpackedUint32_) { - msg.unpackedUint32 = _unpackedUint32_; + msg.unpackedUint32 = _unpackedUint32_.map(protoscript.parseNumber); } const _unpackedUint64_ = json["unpackedUint64"] ?? json["unpacked_uint64"]; if (_unpackedUint64_) { @@ -5010,12 +5012,12 @@ export const TestAllTypesProto3JSON = { } const _unpackedSint64_ = json["unpackedSint64"] ?? json["unpacked_sint64"]; if (_unpackedSint64_) { - msg.unpackedSint64 = _unpackedSint64_.map(BigInt); + msg.unpackedSint64 = _unpackedSint64_; } const _unpackedFixed32_ = json["unpackedFixed32"] ?? json["unpacked_fixed32"]; if (_unpackedFixed32_) { - msg.unpackedFixed32 = _unpackedFixed32_; + msg.unpackedFixed32 = _unpackedFixed32_.map(protoscript.parseNumber); } const _unpackedFixed64_ = json["unpackedFixed64"] ?? json["unpacked_fixed64"]; @@ -5030,15 +5032,15 @@ export const TestAllTypesProto3JSON = { const _unpackedSfixed64_ = json["unpackedSfixed64"] ?? json["unpacked_sfixed64"]; if (_unpackedSfixed64_) { - msg.unpackedSfixed64 = _unpackedSfixed64_.map(BigInt); + msg.unpackedSfixed64 = _unpackedSfixed64_; } const _unpackedFloat_ = json["unpackedFloat"] ?? json["unpacked_float"]; if (_unpackedFloat_) { - msg.unpackedFloat = _unpackedFloat_; + msg.unpackedFloat = _unpackedFloat_.map(protoscript.parseDouble); } const _unpackedDouble_ = json["unpackedDouble"] ?? json["unpacked_double"]; if (_unpackedDouble_) { - msg.unpackedDouble = _unpackedDouble_; + msg.unpackedDouble = _unpackedDouble_.map(protoscript.parseDouble); } const _unpackedBool_ = json["unpackedBool"] ?? json["unpacked_bool"]; if (_unpackedBool_) { @@ -5047,7 +5049,9 @@ export const TestAllTypesProto3JSON = { const _unpackedNestedEnum_ = json["unpackedNestedEnum"] ?? json["unpacked_nested_enum"]; if (_unpackedNestedEnum_) { - msg.unpackedNestedEnum = _unpackedNestedEnum_; + msg.unpackedNestedEnum = _unpackedNestedEnum_.map( + TestAllTypesProto3.NestedEnum._fromInt, + ); } const _mapInt32Int32_ = json["mapInt32Int32"] ?? json["map_int32_int32"]; if (_mapInt32Int32_) { @@ -5235,7 +5239,7 @@ export const TestAllTypesProto3JSON = { } const _oneofUint32_ = json["oneofUint32"] ?? json["oneof_uint32"]; if (_oneofUint32_) { - msg.oneofUint32 = _oneofUint32_; + msg.oneofUint32 = protoscript.parseNumber(_oneofUint32_); } const _oneofNestedMessage_ = json["oneofNestedMessage"] ?? json["oneof_nested_message"]; @@ -5253,7 +5257,7 @@ export const TestAllTypesProto3JSON = { } const _oneofBytes_ = json["oneofBytes"] ?? json["oneof_bytes"]; if (_oneofBytes_) { - msg.oneofBytes = decodeBase64Bytes(_oneofBytes_); + msg.oneofBytes = protoscript.parseBytes(_oneofBytes_); } const _oneofBool_ = json["oneofBool"] ?? json["oneof_bool"]; if (_oneofBool_) { @@ -5265,19 +5269,19 @@ export const TestAllTypesProto3JSON = { } const _oneofFloat_ = json["oneofFloat"] ?? json["oneof_float"]; if (_oneofFloat_) { - msg.oneofFloat = _oneofFloat_; + msg.oneofFloat = protoscript.parseDouble(_oneofFloat_); } const _oneofDouble_ = json["oneofDouble"] ?? json["oneof_double"]; if (_oneofDouble_) { - msg.oneofDouble = _oneofDouble_; + msg.oneofDouble = protoscript.parseDouble(_oneofDouble_); } const _oneofEnum_ = json["oneofEnum"] ?? json["oneof_enum"]; if (_oneofEnum_) { - msg.oneofEnum = _oneofEnum_; + msg.oneofEnum = TestAllTypesProto3.NestedEnum._fromInt(_oneofEnum_); } const _oneofNullValue_ = json["oneofNullValue"] ?? json["oneof_null_value"]; if (_oneofNullValue_) { - msg.oneofNullValue = _oneofNullValue_; + msg.oneofNullValue = protoscript.NullValue._fromInt(_oneofNullValue_); } const _optionalBoolWrapper_ = json["optionalBoolWrapper"] ?? json["optional_bool_wrapper"]; @@ -5435,18 +5439,12 @@ export const TestAllTypesProto3JSON = { const _optionalDuration_ = json["optionalDuration"] ?? json["optional_duration"]; if (_optionalDuration_) { - protoscript.DurationJSON._readMessage( - msg.optionalDuration, - _optionalDuration_, - ); + msg.optionalDuration = protoscript.parseDuration(_optionalDuration_); } const _optionalTimestamp_ = json["optionalTimestamp"] ?? json["optional_timestamp"]; if (_optionalTimestamp_) { - protoscript.TimestampJSON._readMessage( - msg.optionalTimestamp, - _optionalTimestamp_, - ); + msg.optionalTimestamp = protoscript.parseTimestamp(_optionalTimestamp_); } const _optionalFieldMask_ = json["optionalFieldMask"] ?? json["optional_field_mask"]; @@ -5471,25 +5469,20 @@ export const TestAllTypesProto3JSON = { const _optionalNullValue_ = json["optionalNullValue"] ?? json["optional_null_value"]; if (_optionalNullValue_) { - msg.optionalNullValue = _optionalNullValue_; + msg.optionalNullValue = + protoscript.NullValue._fromInt(_optionalNullValue_); } const _repeatedDuration_ = json["repeatedDuration"] ?? json["repeated_duration"]; if (_repeatedDuration_) { - for (const item of _repeatedDuration_) { - const m = protoscript.DurationJSON.initialize(); - protoscript.DurationJSON._readMessage(m, item); - msg.repeatedDuration.push(m); - } + msg.repeatedDuration = _repeatedDuration_.map(protoscript.parseDuration); } const _repeatedTimestamp_ = json["repeatedTimestamp"] ?? json["repeated_timestamp"]; if (_repeatedTimestamp_) { - for (const item of _repeatedTimestamp_) { - const m = protoscript.TimestampJSON.initialize(); - protoscript.TimestampJSON._readMessage(m, item); - msg.repeatedTimestamp.push(m); - } + msg.repeatedTimestamp = _repeatedTimestamp_.map( + protoscript.parseTimestamp, + ); } const _repeatedFieldmask_ = json["repeatedFieldmask"] ?? json["repeated_fieldmask"]; @@ -5535,77 +5528,77 @@ export const TestAllTypesProto3JSON = { } const _fieldname1_ = json["fieldname1"]; if (_fieldname1_) { - msg.fieldname1 = _fieldname1_; + msg.fieldname1 = protoscript.parseNumber(_fieldname1_); } const _fieldName2_ = json["fieldName2"] ?? json["field_name2"]; if (_fieldName2_) { - msg.fieldName2 = _fieldName2_; + msg.fieldName2 = protoscript.parseNumber(_fieldName2_); } const _fieldName3_ = json["FieldName3"] ?? json["fieldName3"] ?? json["_field_name3"]; if (_fieldName3_) { - msg.fieldName3 = _fieldName3_; + msg.fieldName3 = protoscript.parseNumber(_fieldName3_); } const _fieldName4_ = json["fieldName4"] ?? json["field__name4_"]; if (_fieldName4_) { - msg.fieldName4 = _fieldName4_; + msg.fieldName4 = protoscript.parseNumber(_fieldName4_); } const _field0name5_ = json["field0name5"]; if (_field0name5_) { - msg.field0name5 = _field0name5_; + msg.field0name5 = protoscript.parseNumber(_field0name5_); } const _field0Name6_ = json["field0Name6"] ?? json["field_0_name6"]; if (_field0Name6_) { - msg.field0Name6 = _field0Name6_; + msg.field0Name6 = protoscript.parseNumber(_field0Name6_); } const _fieldName7_ = json["fieldName7"]; if (_fieldName7_) { - msg.fieldName7 = _fieldName7_; + msg.fieldName7 = protoscript.parseNumber(_fieldName7_); } const _FieldName8_ = json["FieldName8"]; if (_FieldName8_) { - msg.FieldName8 = _FieldName8_; + msg.FieldName8 = protoscript.parseNumber(_FieldName8_); } const _fieldName9_ = json["fieldName9"] ?? json["field_Name9"]; if (_fieldName9_) { - msg.fieldName9 = _fieldName9_; + msg.fieldName9 = protoscript.parseNumber(_fieldName9_); } const _FieldName10_ = json["FieldName10"] ?? json["Field_Name10"]; if (_FieldName10_) { - msg.FieldName10 = _FieldName10_; + msg.FieldName10 = protoscript.parseNumber(_FieldName10_); } const _FIELDNAME11_ = json["FIELDNAME11"] ?? json["FIELD_NAME11"]; if (_FIELDNAME11_) { - msg.FIELDNAME11 = _FIELDNAME11_; + msg.FIELDNAME11 = protoscript.parseNumber(_FIELDNAME11_); } const _FIELDName12_ = json["FIELDName12"] ?? json["FIELD_name12"]; if (_FIELDName12_) { - msg.FIELDName12 = _FIELDName12_; + msg.FIELDName12 = protoscript.parseNumber(_FIELDName12_); } const _fieldName13_ = json["FieldName13"] ?? json["fieldName13"] ?? json["__field_name13"]; if (_fieldName13_) { - msg.fieldName13 = _fieldName13_; + msg.fieldName13 = protoscript.parseNumber(_fieldName13_); } const _FieldName14_ = json["FieldName14"] ?? json["__Field_name14"]; if (_FieldName14_) { - msg.FieldName14 = _FieldName14_; + msg.FieldName14 = protoscript.parseNumber(_FieldName14_); } const _fieldName15_ = json["fieldName15"] ?? json["field__name15"]; if (_fieldName15_) { - msg.fieldName15 = _fieldName15_; + msg.fieldName15 = protoscript.parseNumber(_fieldName15_); } const _fieldName16_ = json["fieldName16"] ?? json["field__Name16"]; if (_fieldName16_) { - msg.fieldName16 = _fieldName16_; + msg.fieldName16 = protoscript.parseNumber(_fieldName16_); } const _fieldName17_ = json["fieldName17"] ?? json["field_name17__"]; if (_fieldName17_) { - msg.fieldName17 = _fieldName17_; + msg.fieldName17 = protoscript.parseNumber(_fieldName17_); } const _FieldName18_ = json["FieldName18"] ?? json["Field_name18__"]; if (_FieldName18_) { - msg.FieldName18 = _FieldName18_; + msg.FieldName18 = protoscript.parseNumber(_FieldName18_); } return msg; }, @@ -5783,7 +5776,7 @@ export const TestAllTypesProto3JSON = { ): TestAllTypesProto3.NestedMessage { const _a_ = json["a"]; if (_a_) { - msg.a = _a_; + msg.a = protoscript.parseNumber(_a_); } const _corecursive_ = json["corecursive"]; if (_corecursive_) { @@ -5820,11 +5813,11 @@ export const TestAllTypesProto3JSON = { ): TestAllTypesProto3.MapInt32Int32 { const _key_ = json["key"]; if (_key_) { - msg.key = _key_; + msg.key = protoscript.parseNumber(_key_); } const _value_ = json["value"]; if (_value_) { - msg.value = _value_; + msg.value = protoscript.parseNumber(_value_); } return msg; }, @@ -5892,11 +5885,11 @@ export const TestAllTypesProto3JSON = { ): TestAllTypesProto3.MapUint32Uint32 { const _key_ = json["key"]; if (_key_) { - msg.key = _key_; + msg.key = protoscript.parseNumber(_key_); } const _value_ = json["value"]; if (_value_) { - msg.value = _value_; + msg.value = protoscript.parseNumber(_value_); } return msg; }, @@ -6000,11 +5993,11 @@ export const TestAllTypesProto3JSON = { ): TestAllTypesProto3.MapSint64Sint64 { const _key_ = json["key"]; if (_key_) { - msg.key = BigInt(_key_); + msg.key = _key_; } const _value_ = json["value"]; if (_value_) { - msg.value = BigInt(_value_); + msg.value = _value_; } return msg; }, @@ -6036,11 +6029,11 @@ export const TestAllTypesProto3JSON = { ): TestAllTypesProto3.MapFixed32Fixed32 { const _key_ = json["key"]; if (_key_) { - msg.key = _key_; + msg.key = protoscript.parseNumber(_key_); } const _value_ = json["value"]; if (_value_) { - msg.value = _value_; + msg.value = protoscript.parseNumber(_value_); } return msg; }, @@ -6144,11 +6137,11 @@ export const TestAllTypesProto3JSON = { ): TestAllTypesProto3.MapSfixed64Sfixed64 { const _key_ = json["key"]; if (_key_) { - msg.key = BigInt(_key_); + msg.key = _key_; } const _value_ = json["value"]; if (_value_) { - msg.value = BigInt(_value_); + msg.value = _value_; } return msg; }, @@ -6180,11 +6173,11 @@ export const TestAllTypesProto3JSON = { ): TestAllTypesProto3.MapInt32Float { const _key_ = json["key"]; if (_key_) { - msg.key = _key_; + msg.key = protoscript.parseNumber(_key_); } const _value_ = json["value"]; if (_value_) { - msg.value = _value_; + msg.value = protoscript.parseDouble(_value_); } return msg; }, @@ -6216,11 +6209,11 @@ export const TestAllTypesProto3JSON = { ): TestAllTypesProto3.MapInt32Double { const _key_ = json["key"]; if (_key_) { - msg.key = _key_; + msg.key = protoscript.parseNumber(_key_); } const _value_ = json["value"]; if (_value_) { - msg.value = _value_; + msg.value = protoscript.parseDouble(_value_); } return msg; }, @@ -6310,7 +6303,7 @@ export const TestAllTypesProto3JSON = { json["key"] = msg.key; } if (msg.value?.length) { - json["value"] = encodeBase64Bytes(msg.value); + json["value"] = protoscript.encodeBase64Bytes(msg.value); } return json; }, @@ -6328,7 +6321,7 @@ export const TestAllTypesProto3JSON = { } const _value_ = json["value"]; if (_value_) { - msg.value = decodeBase64Bytes(_value_); + msg.value = protoscript.parseBytes(_value_); } return msg; }, @@ -6444,7 +6437,7 @@ export const TestAllTypesProto3JSON = { } const _value_ = json["value"]; if (_value_) { - msg.value = _value_; + msg.value = TestAllTypesProto3.NestedEnum._fromInt(_value_); } return msg; }, @@ -6480,7 +6473,7 @@ export const TestAllTypesProto3JSON = { } const _value_ = json["value"]; if (_value_) { - msg.value = _value_; + msg.value = ForeignEnum._fromInt(_value_); } return msg; }, @@ -6533,7 +6526,7 @@ export const ForeignMessageJSON = { _readMessage: function (msg: ForeignMessage, json: any): ForeignMessage { const _c_ = json["c"]; if (_c_) { - msg.c = _c_; + msg.c = protoscript.parseNumber(_c_); } return msg; }, diff --git a/e2e/conformance/test.ts b/e2e/conformance/test.ts index 452f8ea..d293986 100644 --- a/e2e/conformance/test.ts +++ b/e2e/conformance/test.ts @@ -13,6 +13,7 @@ describe("Conformance", () => { const result = run( `./bin/conformance_test_runner \ --enforce_recommended \ + --failure_list ./expected_proto2_failing_tests.txt \ --output_dir . \ ./dist/runner.cjs`, ); diff --git a/e2e/serialization/json.pb.ts b/e2e/serialization/json.pb.ts new file mode 100644 index 0000000..d2ce785 --- /dev/null +++ b/e2e/serialization/json.pb.ts @@ -0,0 +1,1497 @@ +// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +// Source: json.proto +/* eslint-disable */ + +import type { ByteSource, PartialDeep } from "protoscript"; +import * as protoscript from "protoscript"; + +//========================================// +// Types // +//========================================// + +export type Enum = "FOO_BAR" | "BAZ"; + +export interface Message { + fooBar: string; + g: bigint; +} + +export interface SampleMessage { + sampleMessage: Message; + sampleEnum: Enum; + sampleMap: Record; + sampleRepeated: string[]; + sampleBool: boolean; + sampleString: string; + sampleBytes: Uint8Array; + sampleInt32: number; + sampleFixed32: number; + sampleUint32: number; + sampleInt64: bigint; + sampleFixed64: bigint; + sampleUint64: bigint; + sampleFloat: number; + sampleDouble: number; + sampleTimestamp: protoscript.Timestamp; + sampleDuration: protoscript.Duration; + sampleStruct: protoscript.Struct; +} + +export declare namespace SampleMessage { + interface SampleMap { + key: string; + value: string; + } +} + +export interface OptionalMessage { + fooBar?: string | null | undefined; + g?: bigint | null | undefined; +} + +export interface OptionalSampleMessage { + sampleMessage?: OptionalMessage | null | undefined; + sampleEnum?: Enum | null | undefined; + sampleMap: Record< + string, + OptionalSampleMessage.SampleMap["value"] | undefined + >; + sampleRepeated: string[]; + sampleBool?: boolean | null | undefined; + sampleString?: string | null | undefined; + sampleBytes?: Uint8Array | null | undefined; + sampleInt32?: number | null | undefined; + sampleFixed32?: number | null | undefined; + sampleUint32?: number | null | undefined; + sampleInt64?: bigint | null | undefined; + sampleFixed64?: bigint | null | undefined; + sampleUint64?: bigint | null | undefined; + sampleFloat?: number | null | undefined; + sampleDouble?: number | null | undefined; + sampleTimestamp?: protoscript.Timestamp | null | undefined; + sampleDuration?: protoscript.Duration | null | undefined; + sampleStruct?: protoscript.Struct | null | undefined; +} + +export declare namespace OptionalSampleMessage { + interface SampleMap { + key: string; + value: string; + } +} + +//========================================// +// Protobuf Encode / Decode // +//========================================// + +export const Enum = { + FOO_BAR: "FOO_BAR", + BAZ: "BAZ", + /** + * @private + */ + _fromInt: function (i: number): Enum { + switch (i) { + case 0: { + return "FOO_BAR"; + } + case 1: { + return "BAZ"; + } + // unknown values are preserved as numbers. this occurs when new enum values are introduced and the generated code is out of date. + default: { + return i as unknown as Enum; + } + } + }, + /** + * @private + */ + _toInt: function (i: Enum): number { + switch (i) { + case "FOO_BAR": { + return 0; + } + case "BAZ": { + return 1; + } + // unknown values are preserved as numbers. this occurs when new enum values are introduced and the generated code is out of date. + default: { + return i as unknown as number; + } + } + }, +} as const; + +export const Message = { + /** + * Serializes Message to protobuf. + */ + encode: function (msg: PartialDeep): Uint8Array { + return Message._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); + }, + + /** + * Deserializes Message from protobuf. + */ + decode: function (bytes: ByteSource): Message { + return Message._readMessage( + Message.initialize(), + new protoscript.BinaryReader(bytes), + ); + }, + + /** + * Initializes Message with all fields set to their default value. + */ + initialize: function (): Message { + return { + fooBar: "", + g: 0n, + }; + }, + + /** + * @private + */ + _writeMessage: function ( + msg: PartialDeep, + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { + if (msg.fooBar) { + writer.writeString(1, msg.fooBar); + } + if (msg.g) { + writer.writeInt64String(2, msg.g.toString() as any); + } + return writer; + }, + + /** + * @private + */ + _readMessage: function ( + msg: Message, + reader: protoscript.BinaryReader, + ): Message { + while (reader.nextField()) { + const field = reader.getFieldNumber(); + switch (field) { + case 1: { + msg.fooBar = reader.readString(); + break; + } + case 2: { + msg.g = BigInt(reader.readInt64String()); + break; + } + default: { + reader.skipField(); + break; + } + } + } + return msg; + }, +}; + +export const SampleMessage = { + /** + * Serializes SampleMessage to protobuf. + */ + encode: function (msg: PartialDeep): Uint8Array { + return SampleMessage._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); + }, + + /** + * Deserializes SampleMessage from protobuf. + */ + decode: function (bytes: ByteSource): SampleMessage { + return SampleMessage._readMessage( + SampleMessage.initialize(), + new protoscript.BinaryReader(bytes), + ); + }, + + /** + * Initializes SampleMessage with all fields set to their default value. + */ + initialize: function (): SampleMessage { + return { + sampleMessage: Message.initialize(), + sampleEnum: Enum._fromInt(0), + sampleMap: {}, + sampleRepeated: [], + sampleBool: false, + sampleString: "", + sampleBytes: new Uint8Array(), + sampleInt32: 0, + sampleFixed32: 0, + sampleUint32: 0, + sampleInt64: 0n, + sampleFixed64: 0n, + sampleUint64: 0n, + sampleFloat: 0, + sampleDouble: 0, + sampleTimestamp: protoscript.Timestamp.initialize(), + sampleDuration: protoscript.Duration.initialize(), + sampleStruct: protoscript.Struct.initialize(), + }; + }, + + /** + * @private + */ + _writeMessage: function ( + msg: PartialDeep, + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { + if (msg.sampleMessage) { + writer.writeMessage(1, msg.sampleMessage, Message._writeMessage); + } + if (msg.sampleEnum && Enum._toInt(msg.sampleEnum)) { + writer.writeEnum(2, Enum._toInt(msg.sampleEnum)); + } + if (msg.sampleMap) { + writer.writeRepeatedMessage( + 3, + Object.entries(msg.sampleMap).map(([key, value]) => ({ + key: key as any, + value: value as any, + })) as any, + SampleMessage.SampleMap._writeMessage, + ); + } + if (msg.sampleRepeated?.length) { + writer.writeRepeatedString(4, msg.sampleRepeated); + } + if (msg.sampleBool) { + writer.writeBool(5, msg.sampleBool); + } + if (msg.sampleString) { + writer.writeString(6, msg.sampleString); + } + if (msg.sampleBytes?.length) { + writer.writeBytes(7, msg.sampleBytes); + } + if (msg.sampleInt32) { + writer.writeInt32(8, msg.sampleInt32); + } + if (msg.sampleFixed32) { + writer.writeFixed32(9, msg.sampleFixed32); + } + if (msg.sampleUint32) { + writer.writeUint32(10, msg.sampleUint32); + } + if (msg.sampleInt64) { + writer.writeInt64String(11, msg.sampleInt64.toString() as any); + } + if (msg.sampleFixed64) { + writer.writeFixed64String(12, msg.sampleFixed64.toString() as any); + } + if (msg.sampleUint64) { + writer.writeUint64String(13, msg.sampleUint64.toString() as any); + } + if (msg.sampleFloat) { + writer.writeFloat(14, msg.sampleFloat); + } + if (msg.sampleDouble) { + writer.writeDouble(15, msg.sampleDouble); + } + if (msg.sampleTimestamp) { + writer.writeMessage( + 17, + msg.sampleTimestamp, + protoscript.Timestamp._writeMessage, + ); + } + if (msg.sampleDuration) { + writer.writeMessage( + 18, + msg.sampleDuration, + protoscript.Duration._writeMessage, + ); + } + if (msg.sampleStruct) { + writer.writeMessage( + 19, + msg.sampleStruct, + protoscript.Struct._writeMessage, + ); + } + return writer; + }, + + /** + * @private + */ + _readMessage: function ( + msg: SampleMessage, + reader: protoscript.BinaryReader, + ): SampleMessage { + while (reader.nextField()) { + const field = reader.getFieldNumber(); + switch (field) { + case 1: { + reader.readMessage(msg.sampleMessage, Message._readMessage); + break; + } + case 2: { + msg.sampleEnum = Enum._fromInt(reader.readEnum()); + break; + } + case 3: { + const map = {} as SampleMessage.SampleMap; + reader.readMessage(map, SampleMessage.SampleMap._readMessage); + msg.sampleMap[map.key.toString()] = map.value; + break; + } + case 4: { + msg.sampleRepeated.push(reader.readString()); + break; + } + case 5: { + msg.sampleBool = reader.readBool(); + break; + } + case 6: { + msg.sampleString = reader.readString(); + break; + } + case 7: { + msg.sampleBytes = reader.readBytes(); + break; + } + case 8: { + msg.sampleInt32 = reader.readInt32(); + break; + } + case 9: { + msg.sampleFixed32 = reader.readFixed32(); + break; + } + case 10: { + msg.sampleUint32 = reader.readUint32(); + break; + } + case 11: { + msg.sampleInt64 = BigInt(reader.readInt64String()); + break; + } + case 12: { + msg.sampleFixed64 = BigInt(reader.readFixed64String()); + break; + } + case 13: { + msg.sampleUint64 = BigInt(reader.readUint64String()); + break; + } + case 14: { + msg.sampleFloat = reader.readFloat(); + break; + } + case 15: { + msg.sampleDouble = reader.readDouble(); + break; + } + case 17: { + reader.readMessage( + msg.sampleTimestamp, + protoscript.Timestamp._readMessage, + ); + break; + } + case 18: { + reader.readMessage( + msg.sampleDuration, + protoscript.Duration._readMessage, + ); + break; + } + case 19: { + reader.readMessage(msg.sampleStruct, protoscript.Struct._readMessage); + break; + } + default: { + reader.skipField(); + break; + } + } + } + return msg; + }, + + SampleMap: { + /** + * @private + */ + _writeMessage: function ( + msg: PartialDeep, + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { + if (msg.key) { + writer.writeString(1, msg.key); + } + if (msg.value) { + writer.writeString(2, msg.value); + } + return writer; + }, + + /** + * @private + */ + _readMessage: function ( + msg: SampleMessage.SampleMap, + reader: protoscript.BinaryReader, + ): SampleMessage.SampleMap { + while (reader.nextField()) { + const field = reader.getFieldNumber(); + switch (field) { + case 1: { + msg.key = reader.readString(); + break; + } + case 2: { + msg.value = reader.readString(); + break; + } + default: { + reader.skipField(); + break; + } + } + } + return msg; + }, + }, +}; + +export const OptionalMessage = { + /** + * Serializes OptionalMessage to protobuf. + */ + encode: function (msg: PartialDeep): Uint8Array { + return OptionalMessage._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); + }, + + /** + * Deserializes OptionalMessage from protobuf. + */ + decode: function (bytes: ByteSource): OptionalMessage { + return OptionalMessage._readMessage( + OptionalMessage.initialize(), + new protoscript.BinaryReader(bytes), + ); + }, + + /** + * Initializes OptionalMessage with all fields set to their default value. + */ + initialize: function (): OptionalMessage { + return { + fooBar: undefined, + g: undefined, + }; + }, + + /** + * @private + */ + _writeMessage: function ( + msg: PartialDeep, + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { + if (msg.fooBar != undefined) { + writer.writeString(1, msg.fooBar); + } + if (msg.g != undefined) { + writer.writeInt64String(2, msg.g.toString() as any); + } + return writer; + }, + + /** + * @private + */ + _readMessage: function ( + msg: OptionalMessage, + reader: protoscript.BinaryReader, + ): OptionalMessage { + while (reader.nextField()) { + const field = reader.getFieldNumber(); + switch (field) { + case 1: { + msg.fooBar = reader.readString(); + break; + } + case 2: { + msg.g = BigInt(reader.readInt64String()); + break; + } + default: { + reader.skipField(); + break; + } + } + } + return msg; + }, +}; + +export const OptionalSampleMessage = { + /** + * Serializes OptionalSampleMessage to protobuf. + */ + encode: function (msg: PartialDeep): Uint8Array { + return OptionalSampleMessage._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); + }, + + /** + * Deserializes OptionalSampleMessage from protobuf. + */ + decode: function (bytes: ByteSource): OptionalSampleMessage { + return OptionalSampleMessage._readMessage( + OptionalSampleMessage.initialize(), + new protoscript.BinaryReader(bytes), + ); + }, + + /** + * Initializes OptionalSampleMessage with all fields set to their default value. + */ + initialize: function (): OptionalSampleMessage { + return { + sampleMessage: undefined, + sampleEnum: undefined, + sampleMap: {}, + sampleRepeated: [], + sampleBool: undefined, + sampleString: undefined, + sampleBytes: undefined, + sampleInt32: undefined, + sampleFixed32: undefined, + sampleUint32: undefined, + sampleInt64: undefined, + sampleFixed64: undefined, + sampleUint64: undefined, + sampleFloat: undefined, + sampleDouble: undefined, + sampleTimestamp: undefined, + sampleDuration: undefined, + sampleStruct: undefined, + }; + }, + + /** + * @private + */ + _writeMessage: function ( + msg: PartialDeep, + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { + if (msg.sampleMessage != undefined) { + writer.writeMessage(1, msg.sampleMessage, OptionalMessage._writeMessage); + } + if (msg.sampleEnum != undefined) { + writer.writeEnum(2, Enum._toInt(msg.sampleEnum)); + } + if (msg.sampleMap) { + writer.writeRepeatedMessage( + 3, + Object.entries(msg.sampleMap).map(([key, value]) => ({ + key: key as any, + value: value as any, + })) as any, + OptionalSampleMessage.SampleMap._writeMessage, + ); + } + if (msg.sampleRepeated?.length) { + writer.writeRepeatedString(4, msg.sampleRepeated); + } + if (msg.sampleBool != undefined) { + writer.writeBool(5, msg.sampleBool); + } + if (msg.sampleString != undefined) { + writer.writeString(6, msg.sampleString); + } + if (msg.sampleBytes?.length) { + writer.writeBytes(7, msg.sampleBytes); + } + if (msg.sampleInt32 != undefined) { + writer.writeInt32(8, msg.sampleInt32); + } + if (msg.sampleFixed32 != undefined) { + writer.writeFixed32(9, msg.sampleFixed32); + } + if (msg.sampleUint32 != undefined) { + writer.writeUint32(10, msg.sampleUint32); + } + if (msg.sampleInt64 != undefined) { + writer.writeInt64String(11, msg.sampleInt64.toString() as any); + } + if (msg.sampleFixed64 != undefined) { + writer.writeFixed64String(12, msg.sampleFixed64.toString() as any); + } + if (msg.sampleUint64 != undefined) { + writer.writeUint64String(13, msg.sampleUint64.toString() as any); + } + if (msg.sampleFloat != undefined) { + writer.writeFloat(14, msg.sampleFloat); + } + if (msg.sampleDouble != undefined) { + writer.writeDouble(15, msg.sampleDouble); + } + if (msg.sampleTimestamp != undefined) { + writer.writeMessage( + 17, + msg.sampleTimestamp, + protoscript.Timestamp._writeMessage, + ); + } + if (msg.sampleDuration != undefined) { + writer.writeMessage( + 18, + msg.sampleDuration, + protoscript.Duration._writeMessage, + ); + } + if (msg.sampleStruct != undefined) { + writer.writeMessage( + 19, + msg.sampleStruct, + protoscript.Struct._writeMessage, + ); + } + return writer; + }, + + /** + * @private + */ + _readMessage: function ( + msg: OptionalSampleMessage, + reader: protoscript.BinaryReader, + ): OptionalSampleMessage { + while (reader.nextField()) { + const field = reader.getFieldNumber(); + switch (field) { + case 1: { + msg.sampleMessage = OptionalMessage.initialize(); + reader.readMessage(msg.sampleMessage, OptionalMessage._readMessage); + break; + } + case 2: { + msg.sampleEnum = Enum._fromInt(reader.readEnum()); + break; + } + case 3: { + const map = {} as OptionalSampleMessage.SampleMap; + reader.readMessage(map, OptionalSampleMessage.SampleMap._readMessage); + msg.sampleMap[map.key.toString()] = map.value; + break; + } + case 4: { + msg.sampleRepeated.push(reader.readString()); + break; + } + case 5: { + msg.sampleBool = reader.readBool(); + break; + } + case 6: { + msg.sampleString = reader.readString(); + break; + } + case 7: { + msg.sampleBytes = reader.readBytes(); + break; + } + case 8: { + msg.sampleInt32 = reader.readInt32(); + break; + } + case 9: { + msg.sampleFixed32 = reader.readFixed32(); + break; + } + case 10: { + msg.sampleUint32 = reader.readUint32(); + break; + } + case 11: { + msg.sampleInt64 = BigInt(reader.readInt64String()); + break; + } + case 12: { + msg.sampleFixed64 = BigInt(reader.readFixed64String()); + break; + } + case 13: { + msg.sampleUint64 = BigInt(reader.readUint64String()); + break; + } + case 14: { + msg.sampleFloat = reader.readFloat(); + break; + } + case 15: { + msg.sampleDouble = reader.readDouble(); + break; + } + case 17: { + msg.sampleTimestamp = protoscript.Timestamp.initialize(); + reader.readMessage( + msg.sampleTimestamp, + protoscript.Timestamp._readMessage, + ); + break; + } + case 18: { + msg.sampleDuration = protoscript.Duration.initialize(); + reader.readMessage( + msg.sampleDuration, + protoscript.Duration._readMessage, + ); + break; + } + case 19: { + msg.sampleStruct = protoscript.Struct.initialize(); + reader.readMessage(msg.sampleStruct, protoscript.Struct._readMessage); + break; + } + default: { + reader.skipField(); + break; + } + } + } + return msg; + }, + + SampleMap: { + /** + * @private + */ + _writeMessage: function ( + msg: PartialDeep, + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { + if (msg.key) { + writer.writeString(1, msg.key); + } + if (msg.value) { + writer.writeString(2, msg.value); + } + return writer; + }, + + /** + * @private + */ + _readMessage: function ( + msg: OptionalSampleMessage.SampleMap, + reader: protoscript.BinaryReader, + ): OptionalSampleMessage.SampleMap { + while (reader.nextField()) { + const field = reader.getFieldNumber(); + switch (field) { + case 1: { + msg.key = reader.readString(); + break; + } + case 2: { + msg.value = reader.readString(); + break; + } + default: { + reader.skipField(); + break; + } + } + } + return msg; + }, + }, +}; + +//========================================// +// JSON Encode / Decode // +//========================================// + +export const EnumJSON = { + FOO_BAR: "FOO_BAR", + BAZ: "BAZ", + /** + * @private + */ + _fromInt: function (i: number): Enum { + switch (i) { + case 0: { + return "FOO_BAR"; + } + case 1: { + return "BAZ"; + } + // unknown values are preserved as numbers. this occurs when new enum values are introduced and the generated code is out of date. + default: { + return i as unknown as Enum; + } + } + }, + /** + * @private + */ + _toInt: function (i: Enum): number { + switch (i) { + case "FOO_BAR": { + return 0; + } + case "BAZ": { + return 1; + } + // unknown values are preserved as numbers. this occurs when new enum values are introduced and the generated code is out of date. + default: { + return i as unknown as number; + } + } + }, +} as const; + +export const MessageJSON = { + /** + * Serializes Message to JSON. + */ + encode: function (msg: PartialDeep): string { + return JSON.stringify(MessageJSON._writeMessage(msg)); + }, + + /** + * Deserializes Message from JSON. + */ + decode: function (json: string): Message { + return MessageJSON._readMessage(MessageJSON.initialize(), JSON.parse(json)); + }, + + /** + * Initializes Message with all fields set to their default value. + */ + initialize: function (): Message { + return { + fooBar: "", + g: 0n, + }; + }, + + /** + * @private + */ + _writeMessage: function (msg: PartialDeep): Record { + const json: Record = {}; + if (msg.fooBar) { + json["fooBar"] = msg.fooBar; + } + if (msg.g) { + json["g"] = msg.g.toString(); + } + return json; + }, + + /** + * @private + */ + _readMessage: function (msg: Message, json: any): Message { + const _fooBar_ = json["fooBar"] ?? json["foo_bar"]; + if (_fooBar_) { + msg.fooBar = _fooBar_; + } + const _g_ = json["g"]; + if (_g_) { + msg.g = BigInt(_g_); + } + return msg; + }, +}; + +export const SampleMessageJSON = { + /** + * Serializes SampleMessage to JSON. + */ + encode: function (msg: PartialDeep): string { + return JSON.stringify(SampleMessageJSON._writeMessage(msg)); + }, + + /** + * Deserializes SampleMessage from JSON. + */ + decode: function (json: string): SampleMessage { + return SampleMessageJSON._readMessage( + SampleMessageJSON.initialize(), + JSON.parse(json), + ); + }, + + /** + * Initializes SampleMessage with all fields set to their default value. + */ + initialize: function (): SampleMessage { + return { + sampleMessage: MessageJSON.initialize(), + sampleEnum: Enum._fromInt(0), + sampleMap: {}, + sampleRepeated: [], + sampleBool: false, + sampleString: "", + sampleBytes: new Uint8Array(), + sampleInt32: 0, + sampleFixed32: 0, + sampleUint32: 0, + sampleInt64: 0n, + sampleFixed64: 0n, + sampleUint64: 0n, + sampleFloat: 0, + sampleDouble: 0, + sampleTimestamp: protoscript.TimestampJSON.initialize(), + sampleDuration: protoscript.DurationJSON.initialize(), + sampleStruct: protoscript.StructJSON.initialize(), + }; + }, + + /** + * @private + */ + _writeMessage: function ( + msg: PartialDeep, + ): Record { + const json: Record = {}; + if (msg.sampleMessage) { + const _sampleMessage_ = MessageJSON._writeMessage(msg.sampleMessage); + if (Object.keys(_sampleMessage_).length > 0) { + json["sampleMessage"] = _sampleMessage_; + } + } + if (msg.sampleEnum && EnumJSON._toInt(msg.sampleEnum)) { + json["sampleEnum"] = msg.sampleEnum; + } + if (msg.sampleMap) { + const _sampleMap_ = Object.fromEntries( + Object.entries(msg.sampleMap) + .map(([key, value]) => ({ key: key as any, value: value as any })) + .map(SampleMessageJSON.SampleMap._writeMessage) + .map(({ key, value }) => [key, value]), + ); + if (Object.keys(_sampleMap_).length > 0) { + json["sampleMap"] = _sampleMap_; + } + } + if (msg.sampleRepeated?.length) { + json["sampleRepeated"] = msg.sampleRepeated; + } + if (msg.sampleBool) { + json["sampleBool"] = msg.sampleBool; + } + if (msg.sampleString) { + json["sampleString"] = msg.sampleString; + } + if (msg.sampleBytes?.length) { + json["sampleBytes"] = protoscript.encodeBase64Bytes(msg.sampleBytes); + } + if (msg.sampleInt32) { + json["sampleInt32"] = msg.sampleInt32; + } + if (msg.sampleFixed32) { + json["sampleFixed32"] = msg.sampleFixed32; + } + if (msg.sampleUint32) { + json["sampleUint32"] = msg.sampleUint32; + } + if (msg.sampleInt64) { + json["sampleInt64"] = msg.sampleInt64.toString(); + } + if (msg.sampleFixed64) { + json["sampleFixed64"] = msg.sampleFixed64.toString(); + } + if (msg.sampleUint64) { + json["sampleUint64"] = msg.sampleUint64.toString(); + } + if (msg.sampleFloat) { + json["sampleFloat"] = msg.sampleFloat; + } + if (msg.sampleDouble) { + json["sampleDouble"] = msg.sampleDouble; + } + if (msg.sampleTimestamp) { + const _sampleTimestamp_ = protoscript.TimestampJSON._writeMessage( + msg.sampleTimestamp, + ); + if (Object.keys(_sampleTimestamp_).length > 0) { + json["sampleTimestamp"] = _sampleTimestamp_; + } + } + if (msg.sampleDuration) { + const _sampleDuration_ = protoscript.DurationJSON._writeMessage( + msg.sampleDuration, + ); + if (Object.keys(_sampleDuration_).length > 0) { + json["sampleDuration"] = _sampleDuration_; + } + } + if (msg.sampleStruct) { + const _sampleStruct_ = protoscript.StructJSON._writeMessage( + msg.sampleStruct, + ); + if (Object.keys(_sampleStruct_).length > 0) { + json["sampleStruct"] = _sampleStruct_; + } + } + return json; + }, + + /** + * @private + */ + _readMessage: function (msg: SampleMessage, json: any): SampleMessage { + const _sampleMessage_ = json["sampleMessage"] ?? json["sample_message"]; + if (_sampleMessage_) { + MessageJSON._readMessage(msg.sampleMessage, _sampleMessage_); + } + const _sampleEnum_ = json["sampleEnum"] ?? json["sample_enum"]; + if (_sampleEnum_) { + msg.sampleEnum = Enum._fromInt(_sampleEnum_); + } + const _sampleMap_ = json["sampleMap"] ?? json["sample_map"]; + if (_sampleMap_) { + msg.sampleMap = Object.fromEntries( + Object.entries(_sampleMap_) + .map(([key, value]) => ({ key: key as any, value: value as any })) + .map(SampleMessageJSON.SampleMap._readMessage) + .map(({ key, value }) => [key, value]), + ); + } + const _sampleRepeated_ = json["sampleRepeated"] ?? json["sample_repeated"]; + if (_sampleRepeated_) { + msg.sampleRepeated = _sampleRepeated_; + } + const _sampleBool_ = json["sampleBool"] ?? json["sample_bool"]; + if (_sampleBool_) { + msg.sampleBool = _sampleBool_; + } + const _sampleString_ = json["sampleString"] ?? json["sample_string"]; + if (_sampleString_) { + msg.sampleString = _sampleString_; + } + const _sampleBytes_ = json["sampleBytes"] ?? json["sample_bytes"]; + if (_sampleBytes_) { + msg.sampleBytes = protoscript.parseBytes(_sampleBytes_); + } + const _sampleInt32_ = json["sampleInt32"] ?? json["sample_int32"]; + if (_sampleInt32_) { + msg.sampleInt32 = protoscript.parseNumber(_sampleInt32_); + } + const _sampleFixed32_ = json["sampleFixed32"] ?? json["sample_fixed32"]; + if (_sampleFixed32_) { + msg.sampleFixed32 = protoscript.parseNumber(_sampleFixed32_); + } + const _sampleUint32_ = json["sampleUint32"] ?? json["sample_uint32"]; + if (_sampleUint32_) { + msg.sampleUint32 = protoscript.parseNumber(_sampleUint32_); + } + const _sampleInt64_ = json["sampleInt64"] ?? json["sample_int64"]; + if (_sampleInt64_) { + msg.sampleInt64 = BigInt(_sampleInt64_); + } + const _sampleFixed64_ = json["sampleFixed64"] ?? json["sample_fixed64"]; + if (_sampleFixed64_) { + msg.sampleFixed64 = BigInt(_sampleFixed64_); + } + const _sampleUint64_ = json["sampleUint64"] ?? json["sample_uint64"]; + if (_sampleUint64_) { + msg.sampleUint64 = BigInt(_sampleUint64_); + } + const _sampleFloat_ = json["sampleFloat"] ?? json["sample_float"]; + if (_sampleFloat_) { + msg.sampleFloat = protoscript.parseDouble(_sampleFloat_); + } + const _sampleDouble_ = json["sampleDouble"] ?? json["sample_double"]; + if (_sampleDouble_) { + msg.sampleDouble = protoscript.parseDouble(_sampleDouble_); + } + const _sampleTimestamp_ = + json["sampleTimestamp"] ?? json["sample_timestamp"]; + if (_sampleTimestamp_) { + msg.sampleTimestamp = protoscript.parseTimestamp(_sampleTimestamp_); + } + const _sampleDuration_ = json["sampleDuration"] ?? json["sample_duration"]; + if (_sampleDuration_) { + msg.sampleDuration = protoscript.parseDuration(_sampleDuration_); + } + const _sampleStruct_ = json["sampleStruct"] ?? json["sample_struct"]; + if (_sampleStruct_) { + protoscript.StructJSON._readMessage(msg.sampleStruct, _sampleStruct_); + } + return msg; + }, + + SampleMap: { + /** + * @private + */ + _writeMessage: function ( + msg: PartialDeep, + ): Record { + const json: Record = {}; + if (msg.key) { + json["key"] = msg.key; + } + if (msg.value) { + json["value"] = msg.value; + } + return json; + }, + + /** + * @private + */ + _readMessage: function ( + msg: SampleMessage.SampleMap, + json: any, + ): SampleMessage.SampleMap { + const _key_ = json["key"]; + if (_key_) { + msg.key = _key_; + } + const _value_ = json["value"]; + if (_value_) { + msg.value = _value_; + } + return msg; + }, + }, +}; + +export const OptionalMessageJSON = { + /** + * Serializes OptionalMessage to JSON. + */ + encode: function (msg: PartialDeep): string { + return JSON.stringify(OptionalMessageJSON._writeMessage(msg)); + }, + + /** + * Deserializes OptionalMessage from JSON. + */ + decode: function (json: string): OptionalMessage { + return OptionalMessageJSON._readMessage( + OptionalMessageJSON.initialize(), + JSON.parse(json), + ); + }, + + /** + * Initializes OptionalMessage with all fields set to their default value. + */ + initialize: function (): OptionalMessage { + return { + fooBar: undefined, + g: undefined, + }; + }, + + /** + * @private + */ + _writeMessage: function ( + msg: PartialDeep, + ): Record { + const json: Record = {}; + if (msg.fooBar != undefined) { + json["fooBar"] = msg.fooBar; + } + if (msg.g != undefined) { + json["g"] = msg.g.toString(); + } + return json; + }, + + /** + * @private + */ + _readMessage: function (msg: OptionalMessage, json: any): OptionalMessage { + const _fooBar_ = json["fooBar"] ?? json["foo_bar"]; + if (_fooBar_) { + msg.fooBar = _fooBar_; + } + const _g_ = json["g"]; + if (_g_) { + msg.g = BigInt(_g_); + } + return msg; + }, +}; + +export const OptionalSampleMessageJSON = { + /** + * Serializes OptionalSampleMessage to JSON. + */ + encode: function (msg: PartialDeep): string { + return JSON.stringify(OptionalSampleMessageJSON._writeMessage(msg)); + }, + + /** + * Deserializes OptionalSampleMessage from JSON. + */ + decode: function (json: string): OptionalSampleMessage { + return OptionalSampleMessageJSON._readMessage( + OptionalSampleMessageJSON.initialize(), + JSON.parse(json), + ); + }, + + /** + * Initializes OptionalSampleMessage with all fields set to their default value. + */ + initialize: function (): OptionalSampleMessage { + return { + sampleMessage: undefined, + sampleEnum: undefined, + sampleMap: {}, + sampleRepeated: [], + sampleBool: undefined, + sampleString: undefined, + sampleBytes: undefined, + sampleInt32: undefined, + sampleFixed32: undefined, + sampleUint32: undefined, + sampleInt64: undefined, + sampleFixed64: undefined, + sampleUint64: undefined, + sampleFloat: undefined, + sampleDouble: undefined, + sampleTimestamp: undefined, + sampleDuration: undefined, + sampleStruct: undefined, + }; + }, + + /** + * @private + */ + _writeMessage: function ( + msg: PartialDeep, + ): Record { + const json: Record = {}; + if (msg.sampleMessage != undefined) { + const _sampleMessage_ = OptionalMessageJSON._writeMessage( + msg.sampleMessage, + ); + json["sampleMessage"] = _sampleMessage_; + } + if (msg.sampleEnum != undefined) { + json["sampleEnum"] = msg.sampleEnum; + } + if (msg.sampleMap) { + const _sampleMap_ = Object.fromEntries( + Object.entries(msg.sampleMap) + .map(([key, value]) => ({ key: key as any, value: value as any })) + .map(OptionalSampleMessageJSON.SampleMap._writeMessage) + .map(({ key, value }) => [key, value]), + ); + if (Object.keys(_sampleMap_).length > 0) { + json["sampleMap"] = _sampleMap_; + } + } + if (msg.sampleRepeated?.length) { + json["sampleRepeated"] = msg.sampleRepeated; + } + if (msg.sampleBool != undefined) { + json["sampleBool"] = msg.sampleBool; + } + if (msg.sampleString != undefined) { + json["sampleString"] = msg.sampleString; + } + if (msg.sampleBytes?.length) { + json["sampleBytes"] = protoscript.encodeBase64Bytes(msg.sampleBytes); + } + if (msg.sampleInt32 != undefined) { + json["sampleInt32"] = msg.sampleInt32; + } + if (msg.sampleFixed32 != undefined) { + json["sampleFixed32"] = msg.sampleFixed32; + } + if (msg.sampleUint32 != undefined) { + json["sampleUint32"] = msg.sampleUint32; + } + if (msg.sampleInt64 != undefined) { + json["sampleInt64"] = msg.sampleInt64.toString(); + } + if (msg.sampleFixed64 != undefined) { + json["sampleFixed64"] = msg.sampleFixed64.toString(); + } + if (msg.sampleUint64 != undefined) { + json["sampleUint64"] = msg.sampleUint64.toString(); + } + if (msg.sampleFloat != undefined) { + json["sampleFloat"] = msg.sampleFloat; + } + if (msg.sampleDouble != undefined) { + json["sampleDouble"] = msg.sampleDouble; + } + if (msg.sampleTimestamp != undefined) { + const _sampleTimestamp_ = protoscript.TimestampJSON._writeMessage( + msg.sampleTimestamp, + ); + json["sampleTimestamp"] = _sampleTimestamp_; + } + if (msg.sampleDuration != undefined) { + const _sampleDuration_ = protoscript.DurationJSON._writeMessage( + msg.sampleDuration, + ); + json["sampleDuration"] = _sampleDuration_; + } + if (msg.sampleStruct != undefined) { + const _sampleStruct_ = protoscript.StructJSON._writeMessage( + msg.sampleStruct, + ); + json["sampleStruct"] = _sampleStruct_; + } + return json; + }, + + /** + * @private + */ + _readMessage: function ( + msg: OptionalSampleMessage, + json: any, + ): OptionalSampleMessage { + const _sampleMessage_ = json["sampleMessage"] ?? json["sample_message"]; + if (_sampleMessage_) { + msg.sampleMessage = OptionalMessageJSON.initialize(); + OptionalMessageJSON._readMessage(msg.sampleMessage, _sampleMessage_); + } + const _sampleEnum_ = json["sampleEnum"] ?? json["sample_enum"]; + if (_sampleEnum_) { + msg.sampleEnum = Enum._fromInt(_sampleEnum_); + } + const _sampleMap_ = json["sampleMap"] ?? json["sample_map"]; + if (_sampleMap_) { + msg.sampleMap = Object.fromEntries( + Object.entries(_sampleMap_) + .map(([key, value]) => ({ key: key as any, value: value as any })) + .map(OptionalSampleMessageJSON.SampleMap._readMessage) + .map(({ key, value }) => [key, value]), + ); + } + const _sampleRepeated_ = json["sampleRepeated"] ?? json["sample_repeated"]; + if (_sampleRepeated_) { + msg.sampleRepeated = _sampleRepeated_; + } + const _sampleBool_ = json["sampleBool"] ?? json["sample_bool"]; + if (_sampleBool_) { + msg.sampleBool = _sampleBool_; + } + const _sampleString_ = json["sampleString"] ?? json["sample_string"]; + if (_sampleString_) { + msg.sampleString = _sampleString_; + } + const _sampleBytes_ = json["sampleBytes"] ?? json["sample_bytes"]; + if (_sampleBytes_) { + msg.sampleBytes = protoscript.parseBytes(_sampleBytes_); + } + const _sampleInt32_ = json["sampleInt32"] ?? json["sample_int32"]; + if (_sampleInt32_) { + msg.sampleInt32 = protoscript.parseNumber(_sampleInt32_); + } + const _sampleFixed32_ = json["sampleFixed32"] ?? json["sample_fixed32"]; + if (_sampleFixed32_) { + msg.sampleFixed32 = protoscript.parseNumber(_sampleFixed32_); + } + const _sampleUint32_ = json["sampleUint32"] ?? json["sample_uint32"]; + if (_sampleUint32_) { + msg.sampleUint32 = protoscript.parseNumber(_sampleUint32_); + } + const _sampleInt64_ = json["sampleInt64"] ?? json["sample_int64"]; + if (_sampleInt64_) { + msg.sampleInt64 = BigInt(_sampleInt64_); + } + const _sampleFixed64_ = json["sampleFixed64"] ?? json["sample_fixed64"]; + if (_sampleFixed64_) { + msg.sampleFixed64 = BigInt(_sampleFixed64_); + } + const _sampleUint64_ = json["sampleUint64"] ?? json["sample_uint64"]; + if (_sampleUint64_) { + msg.sampleUint64 = BigInt(_sampleUint64_); + } + const _sampleFloat_ = json["sampleFloat"] ?? json["sample_float"]; + if (_sampleFloat_) { + msg.sampleFloat = protoscript.parseDouble(_sampleFloat_); + } + const _sampleDouble_ = json["sampleDouble"] ?? json["sample_double"]; + if (_sampleDouble_) { + msg.sampleDouble = protoscript.parseDouble(_sampleDouble_); + } + const _sampleTimestamp_ = + json["sampleTimestamp"] ?? json["sample_timestamp"]; + if (_sampleTimestamp_) { + msg.sampleTimestamp = protoscript.parseTimestamp(_sampleTimestamp_); + } + const _sampleDuration_ = json["sampleDuration"] ?? json["sample_duration"]; + if (_sampleDuration_) { + msg.sampleDuration = protoscript.parseDuration(_sampleDuration_); + } + const _sampleStruct_ = json["sampleStruct"] ?? json["sample_struct"]; + if (_sampleStruct_) { + msg.sampleStruct = protoscript.StructJSON.initialize(); + protoscript.StructJSON._readMessage(msg.sampleStruct, _sampleStruct_); + } + return msg; + }, + + SampleMap: { + /** + * @private + */ + _writeMessage: function ( + msg: PartialDeep, + ): Record { + const json: Record = {}; + if (msg.key) { + json["key"] = msg.key; + } + if (msg.value) { + json["value"] = msg.value; + } + return json; + }, + + /** + * @private + */ + _readMessage: function ( + msg: OptionalSampleMessage.SampleMap, + json: any, + ): OptionalSampleMessage.SampleMap { + const _key_ = json["key"]; + if (_key_) { + msg.key = _key_; + } + const _value_ = json["value"]; + if (_value_) { + msg.value = _value_; + } + return msg; + }, + }, +}; diff --git a/e2e/serialization/json.proto b/e2e/serialization/json.proto new file mode 100644 index 0000000..de84994 --- /dev/null +++ b/e2e/serialization/json.proto @@ -0,0 +1,133 @@ +syntax = "proto3"; + +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; +// import "google/protobuf/any.proto"; +import "google/protobuf/struct.proto"; +// import "google/protobuf/wrappers.proto"; +// import "google/protobuf/field_mask.proto"; + +message Message { + string foo_bar = 1; + int64 g = 2; +} + +enum Enum { + FOO_BAR = 0; + BAZ = 1; +} + +message SampleMessage { + Message sample_message = 1; + + Enum sample_enum = 2; + + map sample_map = 3; + + repeated string sample_repeated = 4; + + bool sample_bool = 5; + + string sample_string = 6; + + bytes sample_bytes = 7; + + int32 sample_int32 = 8; + fixed32 sample_fixed32 = 9; + uint32 sample_uint32 = 10; + + int64 sample_int64 = 11; + fixed64 sample_fixed64 = 12; + uint64 sample_uint64 = 13; + + float sample_float = 14; + double sample_double = 15; + + // TODO: Any + // google.protobuf.Any sample_any = 16; + + google.protobuf.Timestamp sample_timestamp = 17; + + google.protobuf.Duration sample_duration = 18; + + google.protobuf.Struct sample_struct = 19; + + // TODO: Wrapper Types + // google.protobuf.BoolValue sample_bool_wrapper = 20; + // google.protobuf.BytesValue sample_bytes_wrapper = 21; + // google.protobuf.Int32Value sample_int32_wrapper = 22; + // google.protobuf.Int64Value sample_int64_wrapper = 23; + // google.protobuf.UInt32Value sample_uint32_wrapper = 24; + // google.protobuf.UInt64Value sample_uint64_wrapper = 25; + // google.protobuf.StringValue sample_string_wrapper = 26; + // google.protobuf.DoubleValue sample_double_wrapper = 27; + + // TODO: FieldMask + // google.protobuf.FieldMask sample_fieldmask = 28; + + // TODO: Remaining Well Known Types + // ListValue array [foo, bar, ...] + // Value value Any JSON value. Check google.protobuf.Value for details. + // NullValue null JSON null + // Empty object {} An empty JSON object +} + +message OptionalMessage { + optional string foo_bar = 1; + optional int64 g = 2; +} + +message OptionalSampleMessage { + optional OptionalMessage sample_message = 1; + + optional Enum sample_enum = 2; + + map sample_map = 3; + + repeated string sample_repeated = 4; + + optional bool sample_bool = 5; + + optional string sample_string = 6; + + optional bytes sample_bytes = 7; + + optional int32 sample_int32 = 8; + optional fixed32 sample_fixed32 = 9; + optional uint32 sample_uint32 = 10; + + optional int64 sample_int64 = 11; + optional fixed64 sample_fixed64 = 12; + optional uint64 sample_uint64 = 13; + + optional float sample_float = 14; + optional double sample_double = 15; + + // TODO: Any + // optional google.protobuf.Any sample_any = 16; + + optional google.protobuf.Timestamp sample_timestamp = 17; + + optional google.protobuf.Duration sample_duration = 18; + + optional google.protobuf.Struct sample_struct = 19; + + // TODO: Wrapper Types + // optional google.protobuf.BoolValue sample_bool_wrapper = 20; + // optional google.protobuf.BytesValue sample_bytes_wrapper = 21; + // optional google.protobuf.Int32Value sample_int32_wrapper = 22; + // optional google.protobuf.Int64Value sample_int64_wrapper = 23; + // optional google.protobuf.UInt32Value sample_uint32_wrapper = 24; + // optional google.protobuf.UInt64Value sample_uint64_wrapper = 25; + // optional google.protobuf.StringValue sample_string_wrapper = 26; + // optional google.protobuf.DoubleValue sample_double_wrapper = 27; + + // TODO: FieldMask + // optional google.protobuf.FieldMask sample_fieldmask = 28; + + // TODO: Remaining Well Known Types + // optional ListValue array [foo, bar, ...] + // optional Value value Any JSON value. Check google.protobuf.Value for details. + // optional NullValue null JSON null + // optional Empty object {} An empty JSON object +} diff --git a/e2e/serialization/message.pb.ts b/e2e/serialization/message.pb.ts index a95293d..a2bd9aa 100644 --- a/e2e/serialization/message.pb.ts +++ b/e2e/serialization/message.pb.ts @@ -3,12 +3,7 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { - BinaryReader, - BinaryWriter, - encodeBase64Bytes, - decodeBase64Bytes, -} from "protoscript"; +import * as protoscript from "protoscript"; //========================================// // Types // @@ -115,14 +110,20 @@ export const Foo = { * Serializes Foo to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Foo._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Foo._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Foo from protobuf. */ decode: function (bytes: ByteSource): Foo { - return Foo._readMessage(Foo.initialize(), new BinaryReader(bytes)); + return Foo._readMessage( + Foo.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -153,8 +154,8 @@ export const Foo = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.fieldOne != undefined) { writer.writeInt32(1, msg.fieldOne); } @@ -220,7 +221,7 @@ export const Foo = { /** * @private */ - _readMessage: function (msg: Foo, reader: BinaryReader): Foo { + _readMessage: function (msg: Foo, reader: protoscript.BinaryReader): Foo { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -318,7 +319,7 @@ export const Foo = { encode: function (msg: PartialDeep): Uint8Array { return Foo.FooBar._writeMessage( msg, - new BinaryWriter(), + new protoscript.BinaryWriter(), ).getResultBuffer(); }, @@ -328,7 +329,7 @@ export const Foo = { decode: function (bytes: ByteSource): Foo.FooBar { return Foo.FooBar._readMessage( Foo.FooBar.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -348,8 +349,8 @@ export const Foo = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.fieldOne) { writer.writeString(1, msg.fieldOne); } @@ -372,7 +373,10 @@ export const Foo = { /** * @private */ - _readMessage: function (msg: Foo.FooBar, reader: BinaryReader): Foo.FooBar { + _readMessage: function ( + msg: Foo.FooBar, + reader: protoscript.BinaryReader, + ): Foo.FooBar { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -409,8 +413,8 @@ export const Foo = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeString(1, msg.key); } @@ -425,7 +429,7 @@ export const Foo = { */ _readMessage: function ( msg: Foo.FooBar.FieldTwo, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): Foo.FooBar.FieldTwo { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -455,8 +459,8 @@ export const Foo = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeString(1, msg.key); } @@ -471,7 +475,7 @@ export const Foo = { */ _readMessage: function ( msg: Foo.FieldTwo, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): Foo.FieldTwo { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -501,14 +505,20 @@ export const Bar = { * Serializes Bar to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Bar._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Bar._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Bar from protobuf. */ decode: function (bytes: ByteSource): Bar { - return Bar._readMessage(Bar.initialize(), new BinaryReader(bytes)); + return Bar._readMessage( + Bar.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -527,8 +537,8 @@ export const Bar = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.fieldOne) { writer.writeString(1, msg.fieldOne); } @@ -551,7 +561,7 @@ export const Bar = { /** * @private */ - _readMessage: function (msg: Bar, reader: BinaryReader): Bar { + _readMessage: function (msg: Bar, reader: protoscript.BinaryReader): Bar { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -588,8 +598,8 @@ export const Bar = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeString(1, msg.key); } @@ -604,7 +614,7 @@ export const Bar = { */ _readMessage: function ( msg: Bar.FieldTwo, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): Bar.FieldTwo { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -750,10 +760,10 @@ export const FooJSON = { json["fieldEight"] = msg.fieldEight.toString(); } if (msg.fieldNine?.length) { - json["fieldNine"] = encodeBase64Bytes(msg.fieldNine); + json["fieldNine"] = protoscript.encodeBase64Bytes(msg.fieldNine); } if (msg.fieldTen?.length) { - json["fieldTen"] = msg.fieldTen.map(encodeBase64Bytes); + json["fieldTen"] = msg.fieldTen.map(protoscript.encodeBase64Bytes); } if (msg.fieldEleven != undefined) { const _fieldEleven_ = BarJSON._writeMessage(msg.fieldEleven); @@ -785,7 +795,7 @@ export const FooJSON = { _readMessage: function (msg: Foo, json: any): Foo { const _fieldOne_ = json["fieldOne"] ?? json["field_one"]; if (_fieldOne_) { - msg.fieldOne = _fieldOne_; + msg.fieldOne = protoscript.parseNumber(_fieldOne_); } const _fieldTwo_ = json["fieldTwo"] ?? json["field_two"]; if (_fieldTwo_) { @@ -814,12 +824,12 @@ export const FooJSON = { } const _fieldSix_ = json["fieldSix"] ?? json["field_six"]; if (_fieldSix_) { - msg.fieldSix = _fieldSix_; + msg.fieldSix = Baz._fromInt(_fieldSix_); } const _fieldSeven_ = json["luckySeven"] ?? json["fieldSeven"] ?? json["field_seven"]; if (_fieldSeven_) { - msg.fieldSeven = _fieldSeven_; + msg.fieldSeven = _fieldSeven_.map(Baz._fromInt); } const _fieldEight_ = json["fieldEight"] ?? json["field_eight"]; if (_fieldEight_) { @@ -827,11 +837,11 @@ export const FooJSON = { } const _fieldNine_ = json["fieldNine"] ?? json["field_nine"]; if (_fieldNine_) { - msg.fieldNine = decodeBase64Bytes(_fieldNine_); + msg.fieldNine = protoscript.parseBytes(_fieldNine_); } const _fieldTen_ = json["fieldTen"] ?? json["field_ten"]; if (_fieldTen_) { - msg.fieldTen = _fieldTen_.map(decodeBase64Bytes); + msg.fieldTen = _fieldTen_.map(protoscript.parseBytes); } const _fieldEleven_ = json["fieldEleven"] ?? json["field_eleven"]; if (_fieldEleven_) { @@ -939,7 +949,7 @@ export const FooJSON = { } const _fieldThree_ = json["fieldThree"] ?? json["field_three"]; if (_fieldThree_) { - msg.fieldThree = _fieldThree_; + msg.fieldThree = _fieldThree_.map(protoscript.parseNumber); } return msg; }, @@ -1088,7 +1098,7 @@ export const BarJSON = { } const _fieldThree_ = json["fieldThree"] ?? json["field_three"]; if (_fieldThree_) { - msg.fieldThree = _fieldThree_; + msg.fieldThree = _fieldThree_.map(protoscript.parseNumber); } return msg; }, diff --git a/e2e/serialization/test.ts b/e2e/serialization/test.ts index 24429c6..4ef0d95 100644 --- a/e2e/serialization/test.ts +++ b/e2e/serialization/test.ts @@ -1,4 +1,5 @@ import { Baz, Foo, FooJSON } from "./message.pb.js"; +import { OptionalSampleMessageJSON, SampleMessageJSON } from "./json.pb.js"; const nestedMessage: Foo.FooBar = { fieldOne: "foo", @@ -637,3 +638,621 @@ describe("Serialization/Deserialization", () => { }); }); }); + +// https://protobuf.dev/programming-guides/proto3/#json +describe("Protobuf3 JSON", () => { + describe("deserialization", () => { + it("populates default values when fields are missing", () => { + const jsonString = "{}"; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleMessage).toEqual({ fooBar: "", g: 0n }); + expect(decodedMessage.sampleEnum).toEqual("FOO_BAR"); + expect(decodedMessage.sampleMap).toEqual({}); + expect(decodedMessage.sampleRepeated).toEqual([]); + expect(decodedMessage.sampleBool).toEqual(false); + expect(decodedMessage.sampleString).toEqual(""); + expect(decodedMessage.sampleBytes).toEqual(new Uint8Array()); + expect(decodedMessage.sampleInt32).toEqual(0); + expect(decodedMessage.sampleFixed32).toEqual(0); + expect(decodedMessage.sampleUint32).toEqual(0); + expect(decodedMessage.sampleInt64).toEqual(0n); + expect(decodedMessage.sampleFixed64).toEqual(0n); + expect(decodedMessage.sampleUint64).toEqual(0n); + expect(decodedMessage.sampleFloat).toEqual(0); + expect(decodedMessage.sampleDouble).toEqual(0); + expect(decodedMessage.sampleTimestamp).toEqual({ seconds: 0n, nanos: 0 }); + expect(decodedMessage.sampleDuration).toEqual({ seconds: 0n, nanos: 0 }); + expect(decodedMessage.sampleStruct).toEqual({ fields: {} }); + }); + + it("populates default values when fields are null", () => { + const jsonString = `{ + "sampleMessage": null, + "sampleEnum": null, + "sampleMap": null, + "sampleRepeated": null, + "sampleBool": null, + "sampleString": null, + "sampleBytes": null, + "sampleInt32": null, + "sampleFixed32": null, + "sampleUint32": null, + "sampleInt64": null, + "sampleFixed64": null, + "sampleUint64": null, + "sampleFloat": null, + "sampleDouble": null, + "sampleTimestamp": null, + "sampleDuration": null, + "sampleStruct": null + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleMessage).toEqual({ fooBar: "", g: 0n }); + expect(decodedMessage.sampleEnum).toEqual("FOO_BAR"); + expect(decodedMessage.sampleMap).toEqual({}); + expect(decodedMessage.sampleRepeated).toEqual([]); + expect(decodedMessage.sampleBool).toEqual(false); + expect(decodedMessage.sampleString).toEqual(""); + expect(decodedMessage.sampleBytes).toEqual(new Uint8Array()); + expect(decodedMessage.sampleInt32).toEqual(0); + expect(decodedMessage.sampleFixed32).toEqual(0); + expect(decodedMessage.sampleUint32).toEqual(0); + expect(decodedMessage.sampleInt64).toEqual(0n); + expect(decodedMessage.sampleFixed64).toEqual(0n); + expect(decodedMessage.sampleUint64).toEqual(0n); + expect(decodedMessage.sampleFloat).toEqual(0); + expect(decodedMessage.sampleDouble).toEqual(0); + expect(decodedMessage.sampleTimestamp).toEqual({ seconds: 0n, nanos: 0 }); + expect(decodedMessage.sampleDuration).toEqual({ seconds: 0n, nanos: 0 }); + expect(decodedMessage.sampleStruct).toEqual({ fields: {} }); + }); + + it("preserves undefined for optional fields that are missing", () => { + const jsonString = "{}"; + const decodedMessage = OptionalSampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleMessage).toEqual(undefined); + expect(decodedMessage.sampleEnum).toEqual(undefined); + expect(decodedMessage.sampleMap).toEqual({}); + expect(decodedMessage.sampleRepeated).toEqual([]); + expect(decodedMessage.sampleBool).toEqual(undefined); + expect(decodedMessage.sampleString).toEqual(undefined); + expect(decodedMessage.sampleBytes).toEqual(undefined); + expect(decodedMessage.sampleInt32).toEqual(undefined); + expect(decodedMessage.sampleFixed32).toEqual(undefined); + expect(decodedMessage.sampleUint32).toEqual(undefined); + expect(decodedMessage.sampleInt64).toEqual(undefined); + expect(decodedMessage.sampleFixed64).toEqual(undefined); + expect(decodedMessage.sampleUint64).toEqual(undefined); + expect(decodedMessage.sampleFloat).toEqual(undefined); + expect(decodedMessage.sampleDouble).toEqual(undefined); + expect(decodedMessage.sampleTimestamp).toEqual(undefined); + expect(decodedMessage.sampleDuration).toEqual(undefined); + expect(decodedMessage.sampleStruct).toEqual(undefined); + }); + + it("preserves undefined for optional fields that are null", () => { + const jsonString = `{ + "sampleMessage": null, + "sampleEnum": null, + "sampleMap": null, + "sampleRepeated": null, + "sampleBool": null, + "sampleString": null, + "sampleBytes": null, + "sampleInt32": null, + "sampleFixed32": null, + "sampleUint32": null, + "sampleInt64": null, + "sampleFixed64": null, + "sampleUint64": null, + "sampleFloat": null, + "sampleDouble": null, + "sampleTimestamp": null, + "sampleDuration": null, + "sampleStruct": null + }`; + const decodedMessage = OptionalSampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleMessage).toEqual(undefined); + expect(decodedMessage.sampleEnum).toEqual(undefined); + expect(decodedMessage.sampleMap).toEqual({}); + expect(decodedMessage.sampleRepeated).toEqual([]); + expect(decodedMessage.sampleBool).toEqual(undefined); + expect(decodedMessage.sampleString).toEqual(undefined); + expect(decodedMessage.sampleBytes).toEqual(undefined); + expect(decodedMessage.sampleInt32).toEqual(undefined); + expect(decodedMessage.sampleFixed32).toEqual(undefined); + expect(decodedMessage.sampleUint32).toEqual(undefined); + expect(decodedMessage.sampleInt64).toEqual(undefined); + expect(decodedMessage.sampleFixed64).toEqual(undefined); + expect(decodedMessage.sampleUint64).toEqual(undefined); + expect(decodedMessage.sampleFloat).toEqual(undefined); + expect(decodedMessage.sampleDouble).toEqual(undefined); + expect(decodedMessage.sampleTimestamp).toEqual(undefined); + expect(decodedMessage.sampleDuration).toEqual(undefined); + expect(decodedMessage.sampleStruct).toEqual(undefined); + }); + + it("reads lowerCamelCase field names", () => { + const jsonString = `{ + "sampleMessage": {"fooBar": "test", "g": "12345"}, + "sampleEnum": "BAZ", + "sampleMap": {"key": "value"}, + "sampleRepeated": ["item1", "item2"], + "sampleBool": true, + "sampleString": "sample", + "sampleBytes": "${btoa("test")}", + "sampleInt32": 32, + "sampleFixed32": 32, + "sampleUint32": 32, + "sampleInt64": "64", + "sampleFixed64": "64", + "sampleUint64": "64", + "sampleFloat": 1.23, + "sampleDouble": 1.23, + "sampleTimestamp": "1972-01-01T10:00:20.021Z", + "sampleDuration": "1.003s", + "sampleStruct": {"fields": {"field1": {"stringValue": "value1"}}} + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleMessage).toEqual({ + fooBar: "test", + g: 12345n, + }); + expect(decodedMessage.sampleEnum).toEqual("BAZ"); + expect(decodedMessage.sampleMap).toEqual({ key: "value" }); + expect(decodedMessage.sampleRepeated).toEqual(["item1", "item2"]); + expect(decodedMessage.sampleBool).toEqual(true); + expect(decodedMessage.sampleString).toEqual("sample"); + expect(new TextDecoder().decode(decodedMessage.sampleBytes)).toEqual( + "test", + ); + expect(decodedMessage.sampleInt32).toEqual(32); + expect(decodedMessage.sampleFixed32).toEqual(32); + expect(decodedMessage.sampleUint32).toEqual(32); + expect(decodedMessage.sampleInt64).toEqual(64n); + expect(decodedMessage.sampleFixed64).toEqual(64n); + expect(decodedMessage.sampleUint64).toEqual(64n); + expect(decodedMessage.sampleFloat).toEqual(1.23); + expect(decodedMessage.sampleDouble).toEqual(1.23); + expect(decodedMessage.sampleTimestamp).toEqual({ + seconds: 63108020n, + nanos: 21_000_000, + }); + expect(decodedMessage.sampleDuration).toEqual({ + seconds: 1n, + nanos: 3_000_000, + }); + expect(decodedMessage.sampleStruct).toEqual({ + fields: { field1: { stringValue: "value1" } }, + }); + }); + + it("reads the original field names", () => { + const jsonString = `{ + "sample_message": {"foo_bar": "test", "g": "12345"}, + "sample_enum": "BAZ", + "sample_map": {"key": "value"}, + "sample_repeated": ["item1", "item2"], + "sample_bool": true, + "sample_string": "sample", + "sample_bytes": "${btoa("test")}", + "sample_int32": 32, + "sample_fixed32": 32, + "sample_uint32": 32, + "sample_int64": "64", + "sample_fixed64": "64", + "sample_uint64": "64", + "sample_float": 1.23, + "sample_double": 1.23, + "sample_timestamp": "1972-01-01T10:00:20.021Z", + "sample_duration": "1.003s", + "sample_struct": {"fields": {"field1": {"stringValue": "value1"}}} + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleMessage).toEqual({ + fooBar: "test", + g: 12345n, + }); + expect(decodedMessage.sampleEnum).toEqual("BAZ"); + expect(decodedMessage.sampleMap).toEqual({ key: "value" }); + expect(decodedMessage.sampleRepeated).toEqual(["item1", "item2"]); + expect(decodedMessage.sampleBool).toEqual(true); + expect(decodedMessage.sampleString).toEqual("sample"); + expect(new TextDecoder().decode(decodedMessage.sampleBytes)).toEqual( + "test", + ); + expect(decodedMessage.sampleInt32).toEqual(32); + expect(decodedMessage.sampleFixed32).toEqual(32); + expect(decodedMessage.sampleUint32).toEqual(32); + expect(decodedMessage.sampleInt64).toEqual(64n); + expect(decodedMessage.sampleFixed64).toEqual(64n); + expect(decodedMessage.sampleUint64).toEqual(64n); + expect(decodedMessage.sampleFloat).toEqual(1.23); + expect(decodedMessage.sampleDouble).toEqual(1.23); + expect(decodedMessage.sampleTimestamp).toEqual({ + seconds: 63108020n, + nanos: 21_000_000, + }); + expect(decodedMessage.sampleDuration).toEqual({ + seconds: 1n, + nanos: 3_000_000, + }); + expect(decodedMessage.sampleStruct).toEqual({ + fields: { field1: { stringValue: "value1" } }, + }); + }); + + describe("message", () => { + describe("nested message", () => { + it("populates default values when fields are missing", () => { + const jsonString = '{ "sampleMessage": {} }'; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleMessage).toEqual({ fooBar: "", g: 0n }); + }); + + it("accepts nested messages with null values", () => { + const jsonString = '{ "sampleMessage": { "fooBar": null } }'; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleMessage).toEqual({ fooBar: "", g: 0n }); + }); + }); + }); + + describe("enum", () => { + it("accepts the enum name", () => { + const jsonString = `{ + "sampleEnum": "BAZ" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + expect(decodedMessage.sampleEnum).toEqual("BAZ"); + }); + + it("accepts the integer values", () => { + const jsonString = `{ + "sampleEnum": 1 + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + expect(decodedMessage.sampleEnum).toEqual("BAZ"); + }); + }); + + describe("bytes", () => { + const bytes = new Uint8Array([251]); + + it("accepts standard base64 with padding", () => { + const encoded = Buffer.from(bytes).toString("base64"); + const jsonString = `{ + "sampleBytes": "${encoded}" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + expect(decodedMessage.sampleBytes).toEqual(bytes); + }); + + it("accepts standard base64 without padding", () => { + const encoded = Buffer.from(bytes) + .toString("base64") + .replace(/=+$/, ""); + const jsonString = `{ + "sampleBytes": "${encoded}" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + expect(decodedMessage.sampleBytes).toEqual(bytes); + }); + + it("accepts url-safe base64 with padding", () => { + const encoded = Buffer.from(bytes).toString("base64url"); + const jsonString = `{ + "sampleBytes": "${encoded}" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + expect(decodedMessage.sampleBytes).toEqual(bytes); + }); + + it("accepts url-safe base64 without padding", () => { + const encoded = Buffer.from(bytes) + .toString("base64url") + .replace(/=+$/, ""); + const jsonString = `{ + "sampleBytes": "${encoded}" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + expect(decodedMessage.sampleBytes).toEqual(bytes); + }); + }); + + describe("int32, fixed32, uint32", () => { + it("accepts string values", () => { + const jsonString = `{ + "sampleInt32": "32", + "sampleFixed32": "32", + "sampleUint32": "32" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleInt32).toEqual(32); + expect(decodedMessage.sampleFixed32).toEqual(32); + expect(decodedMessage.sampleUint32).toEqual(32); + }); + + it("accepts number values", () => { + const jsonString = `{ + "sampleInt32": 32, + "sampleFixed32": 32, + "sampleUint32": 32 + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleInt32).toEqual(32); + expect(decodedMessage.sampleFixed32).toEqual(32); + expect(decodedMessage.sampleUint32).toEqual(32); + }); + }); + + describe("int64, fixed64, uint64", () => { + it("accepts string values", () => { + const jsonString = `{ + "sampleInt64": "64", + "sampleFixed64": "64", + "sampleUint64": "64" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleInt64).toEqual(64n); + expect(decodedMessage.sampleFixed64).toEqual(64n); + expect(decodedMessage.sampleUint64).toEqual(64n); + }); + + it("accepts number values", () => { + const jsonString = `{ + "sampleInt64": 64, + "sampleFixed64": 64, + "sampleUint64": 64 + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleInt64).toEqual(64n); + expect(decodedMessage.sampleFixed64).toEqual(64n); + expect(decodedMessage.sampleUint64).toEqual(64n); + }); + }); + + describe("float, double", () => { + it("accepts string values", () => { + const jsonString = `{ + "sampleFloat": "1.23", + "sampleDouble": "1.23" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleFloat).toEqual(1.23); + expect(decodedMessage.sampleDouble).toEqual(1.23); + }); + + it("accepts number values", () => { + const jsonString = `{ + "sampleFloat": 1.23, + "sampleDouble": 1.23 + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleFloat).toEqual(1.23); + expect(decodedMessage.sampleDouble).toEqual(1.23); + }); + + describe("accepts special string value", () => { + it("NaN", () => { + const jsonString = `{ + "sampleFloat": "NaN", + "sampleDouble": "NaN" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleFloat).toEqual(NaN); + expect(decodedMessage.sampleDouble).toEqual(NaN); + }); + + it("Infinity", () => { + const jsonString = `{ + "sampleFloat": "Infinity", + "sampleDouble": "Infinity" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleFloat).toEqual(Infinity); + expect(decodedMessage.sampleDouble).toEqual(Infinity); + }); + + it("-Infinity", () => { + const jsonString = `{ + "sampleFloat": "-Infinity", + "sampleDouble": "-Infinity" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleFloat).toEqual(-Infinity); + expect(decodedMessage.sampleDouble).toEqual(-Infinity); + }); + }); + + describe("accepts -0", () => { + it("as a string", () => { + const jsonString = `{ + "sampleFloat": "-0", + "sampleDouble": "-0" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleFloat).toEqual(-0); + expect(decodedMessage.sampleDouble).toEqual(-0); + }); + + it("as a number", () => { + const jsonString = `{ + "sampleFloat": -0, + "sampleDouble": -0 + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleFloat).toEqual(0); + expect(decodedMessage.sampleDouble).toEqual(0); + }); + }); + + describe("accepts exponent notation", () => { + it("as a string", () => { + const jsonString = `{ + "sampleFloat": "3e-5", + "sampleDouble": "3e-5" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleFloat).toEqual(0.00003); + expect(decodedMessage.sampleDouble).toEqual(0.00003); + }); + + it("as a number", () => { + const jsonString = `{ + "sampleFloat": 3e-5, + "sampleDouble": 3e-5 + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleFloat).toEqual(0.00003); + expect(decodedMessage.sampleDouble).toEqual(0.00003); + }); + }); + }); + + describe("Timestamp", () => { + it("accepts 0 fractional digits", () => { + const jsonString = `{ + "sampleTimestamp": "2023-10-18T04:02:27Z" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleTimestamp).toEqual({ + nanos: 0, + seconds: 1697601747n, + }); + }); + + it("accepts 3 fractional digits", () => { + const jsonString = `{ + "sampleTimestamp": "2023-10-18T04:02:27.123Z" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleTimestamp).toEqual({ + nanos: 123_000_000, + seconds: 1697601747n, + }); + }); + + it("accepts 6 fractional digits", () => { + const jsonString = `{ + "sampleTimestamp": "2023-10-18T04:02:27.123456Z" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleTimestamp).toEqual({ + nanos: 123_456_000, + seconds: 1697601747n, + }); + }); + + it("accepts 9 fractional digits", () => { + const jsonString = `{ + "sampleTimestamp": "2023-10-18T04:02:27.123456789Z" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleTimestamp).toEqual({ + nanos: 123_456_789, + seconds: 1697601747n, + }); + }); + + it("accepts offsets other 'Z'", () => { + const jsonString = `{ + "sampleTimestamp": "2023-10-18T04:02:27.123-06:00" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + expect(decodedMessage.sampleTimestamp).toEqual({ + nanos: 123_000_000, + seconds: 1697623347n, + }); + }); + }); + + describe("Duration", () => { + it("accepts 0 fractional digits", () => { + const jsonString = `{ + "sampleDuration": "1s" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleDuration).toEqual({ + seconds: 1n, + nanos: 0, + }); + }); + + it("accepts 3 fractional digits", () => { + const jsonString = `{ + "sampleDuration": "1.003s" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleDuration).toEqual({ + seconds: 1n, + nanos: 3000000, + }); + }); + + it("accepts 6 fractional digits", () => { + const jsonString = `{ + "sampleDuration": "1.000003s" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleDuration).toEqual({ + seconds: 1n, + nanos: 3000, + }); + }); + + it("accepts 9 fractional digits", () => { + const jsonString = `{ + "sampleDuration": "1.000000003s" + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleDuration).toEqual({ + seconds: 1n, + nanos: 3, + }); + }); + }); + + describe("Struct", () => { + it("accepts any JSON object", () => { + const jsonString = `{ + "sampleStruct": { "fields": { "this": { "is": { "a": { "sample": { "struct": true } } } } } } + }`; + const decodedMessage = SampleMessageJSON.decode(jsonString); + + expect(decodedMessage.sampleStruct).toEqual({ + fields: { this: { is: { a: { sample: { struct: true } } } } }, + }); + }); + }); + }); +}); diff --git a/e2e/treeshaking/treeshaking.pb.ts b/e2e/treeshaking/treeshaking.pb.ts index 310fd4a..689ab63 100644 --- a/e2e/treeshaking/treeshaking.pb.ts +++ b/e2e/treeshaking/treeshaking.pb.ts @@ -3,8 +3,6 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { BinaryReader, BinaryWriter } from "protoscript"; - import * as protoscript from "protoscript"; //========================================// @@ -43,7 +41,7 @@ export const TreeshakingTest = { encode: function (msg: PartialDeep): Uint8Array { return TreeshakingTest._writeMessage( msg, - new BinaryWriter(), + new protoscript.BinaryWriter(), ).getResultBuffer(); }, @@ -53,7 +51,7 @@ export const TreeshakingTest = { decode: function (bytes: ByteSource): TreeshakingTest { return TreeshakingTest._readMessage( TreeshakingTest.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -77,8 +75,8 @@ export const TreeshakingTest = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.stringField) { writer.writeString(1, msg.stringField); } @@ -127,7 +125,7 @@ export const TreeshakingTest = { */ _readMessage: function ( msg: TreeshakingTest, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TreeshakingTest { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -186,8 +184,8 @@ export const TreeshakingTest = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeString(1, msg.key); } @@ -202,7 +200,7 @@ export const TreeshakingTest = { */ _readMessage: function ( msg: TreeshakingTest.MapField, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): TreeshakingTest.MapField { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -233,7 +231,7 @@ export const NestedMessage = { encode: function (msg: PartialDeep): Uint8Array { return NestedMessage._writeMessage( msg, - new BinaryWriter(), + new protoscript.BinaryWriter(), ).getResultBuffer(); }, @@ -243,7 +241,7 @@ export const NestedMessage = { decode: function (bytes: ByteSource): NestedMessage { return NestedMessage._readMessage( NestedMessage.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -261,8 +259,8 @@ export const NestedMessage = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.stringField != undefined) { writer.writeString(1, msg.stringField); } @@ -274,7 +272,7 @@ export const NestedMessage = { */ _readMessage: function ( msg: NestedMessage, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): NestedMessage { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -416,10 +414,7 @@ export const TreeshakingTestJSON = { } const _timestampField_ = json["timestampField"] ?? json["timestamp_field"]; if (_timestampField_) { - protoscript.TimestampJSON._readMessage( - msg.timestampField, - _timestampField_, - ); + msg.timestampField = protoscript.parseTimestamp(_timestampField_); } const _mapField_ = json["mapField"] ?? json["map_field"]; if (_mapField_) { diff --git a/examples/closure-compiler/src/haberdasher.pb.ts b/examples/closure-compiler/src/haberdasher.pb.ts index 4962a02..4512ec5 100644 --- a/examples/closure-compiler/src/haberdasher.pb.ts +++ b/examples/closure-compiler/src/haberdasher.pb.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { BinaryReader, BinaryWriter } from "protoscript"; +import * as protoscript from "protoscript"; //========================================// // Types // @@ -43,14 +43,20 @@ export const Size = { * Serializes Size to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Size._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Size._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Size from protobuf. */ decode: function (bytes: ByteSource): Size { - return Size._readMessage(Size.initialize(), new BinaryReader(bytes)); + return Size._readMessage( + Size.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -67,8 +73,8 @@ export const Size = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.inches) { writer.writeInt32(1, msg.inches); } @@ -78,7 +84,7 @@ export const Size = { /** * @private */ - _readMessage: function (msg: Size, reader: BinaryReader): Size { + _readMessage: function (msg: Size, reader: protoscript.BinaryReader): Size { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -101,14 +107,20 @@ export const Hat = { * Serializes Hat to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Hat._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Hat._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Hat from protobuf. */ decode: function (bytes: ByteSource): Hat { - return Hat._readMessage(Hat.initialize(), new BinaryReader(bytes)); + return Hat._readMessage( + Hat.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -127,8 +139,8 @@ export const Hat = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.inches) { writer.writeInt32(1, msg.inches); } @@ -144,7 +156,7 @@ export const Hat = { /** * @private */ - _readMessage: function (msg: Hat, reader: BinaryReader): Hat { + _readMessage: function (msg: Hat, reader: protoscript.BinaryReader): Hat { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -215,7 +227,7 @@ export const SizeJSON = { _readMessage: function (msg: Size, json: any): Size { const _inches_ = json["inches"]; if (_inches_) { - msg.inches = _inches_; + msg.inches = protoscript.parseNumber(_inches_); } return msg; }, @@ -270,7 +282,7 @@ export const HatJSON = { _readMessage: function (msg: Hat, json: any): Hat { const _inches_ = json["inches"]; if (_inches_) { - msg.inches = _inches_; + msg.inches = protoscript.parseNumber(_inches_); } const _color_ = json["color"]; if (_color_) { diff --git a/examples/javascript/src/haberdasher.pb.js b/examples/javascript/src/haberdasher.pb.js index 9765f4f..9eecc67 100644 --- a/examples/javascript/src/haberdasher.pb.js +++ b/examples/javascript/src/haberdasher.pb.js @@ -2,7 +2,7 @@ // Source: src/haberdasher.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from "protoscript"; +import * as protoscript from "protoscript"; //========================================// // Protobuf Encode / Decode // @@ -13,14 +13,20 @@ export const Size = { * Serializes Size to protobuf. */ encode: function (msg) { - return Size._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Size._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Size from protobuf. */ decode: function (bytes) { - return Size._readMessage(Size.initialize(), new BinaryReader(bytes)); + return Size._readMessage( + Size.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -68,14 +74,20 @@ export const Hat = { * Serializes Hat to protobuf. */ encode: function (msg) { - return Hat._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Hat._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Hat from protobuf. */ decode: function (bytes) { - return Hat._readMessage(Hat.initialize(), new BinaryReader(bytes)); + return Hat._readMessage( + Hat.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -179,7 +191,7 @@ export const SizeJSON = { _readMessage: function (msg, json) { const _inches_ = json["inches"]; if (_inches_) { - msg.inches = _inches_; + msg.inches = protoscript.parseNumber(_inches_); } return msg; }, @@ -234,7 +246,7 @@ export const HatJSON = { _readMessage: function (msg, json) { const _inches_ = json["inches"]; if (_inches_) { - msg.inches = _inches_; + msg.inches = protoscript.parseNumber(_inches_); } const _color_ = json["color"]; if (_color_) { diff --git a/examples/protoc/src/haberdasher.pb.js b/examples/protoc/src/haberdasher.pb.js index 9765f4f..9eecc67 100644 --- a/examples/protoc/src/haberdasher.pb.js +++ b/examples/protoc/src/haberdasher.pb.js @@ -2,7 +2,7 @@ // Source: src/haberdasher.proto /* eslint-disable */ -import { BinaryReader, BinaryWriter } from "protoscript"; +import * as protoscript from "protoscript"; //========================================// // Protobuf Encode / Decode // @@ -13,14 +13,20 @@ export const Size = { * Serializes Size to protobuf. */ encode: function (msg) { - return Size._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Size._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Size from protobuf. */ decode: function (bytes) { - return Size._readMessage(Size.initialize(), new BinaryReader(bytes)); + return Size._readMessage( + Size.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -68,14 +74,20 @@ export const Hat = { * Serializes Hat to protobuf. */ encode: function (msg) { - return Hat._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Hat._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Hat from protobuf. */ decode: function (bytes) { - return Hat._readMessage(Hat.initialize(), new BinaryReader(bytes)); + return Hat._readMessage( + Hat.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -179,7 +191,7 @@ export const SizeJSON = { _readMessage: function (msg, json) { const _inches_ = json["inches"]; if (_inches_) { - msg.inches = _inches_; + msg.inches = protoscript.parseNumber(_inches_); } return msg; }, @@ -234,7 +246,7 @@ export const HatJSON = { _readMessage: function (msg, json) { const _inches_ = json["inches"]; if (_inches_) { - msg.inches = _inches_; + msg.inches = protoscript.parseNumber(_inches_); } const _color_ = json["color"]; if (_color_) { diff --git a/examples/typescript/src/haberdasher.pb.ts b/examples/typescript/src/haberdasher.pb.ts index b3017b8..0a8b61e 100644 --- a/examples/typescript/src/haberdasher.pb.ts +++ b/examples/typescript/src/haberdasher.pb.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { BinaryReader, BinaryWriter } from "protoscript"; +import * as protoscript from "protoscript"; import * as srcSize from "./size.pb"; @@ -35,14 +35,20 @@ export const Hat = { * Serializes Hat to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Hat._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Hat._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Hat from protobuf. */ decode: function (bytes: ByteSource): Hat { - return Hat._readMessage(Hat.initialize(), new BinaryReader(bytes)); + return Hat._readMessage( + Hat.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -61,8 +67,8 @@ export const Hat = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.size) { writer.writeMessage(1, msg.size, srcSize.Size._writeMessage); } @@ -78,7 +84,7 @@ export const Hat = { /** * @private */ - _readMessage: function (msg: Hat, reader: BinaryReader): Hat { + _readMessage: function (msg: Hat, reader: protoscript.BinaryReader): Hat { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { diff --git a/examples/typescript/src/size.pb.ts b/examples/typescript/src/size.pb.ts index 3156f8c..7c6b3fc 100644 --- a/examples/typescript/src/size.pb.ts +++ b/examples/typescript/src/size.pb.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { BinaryReader, BinaryWriter } from "protoscript"; +import * as protoscript from "protoscript"; //========================================// // Types // @@ -28,14 +28,20 @@ export const Size = { * Serializes Size to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Size._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Size._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Size from protobuf. */ decode: function (bytes: ByteSource): Size { - return Size._readMessage(Size.initialize(), new BinaryReader(bytes)); + return Size._readMessage( + Size.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -52,8 +58,8 @@ export const Size = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.inches) { writer.writeInt32(1, msg.inches); } @@ -63,7 +69,7 @@ export const Size = { /** * @private */ - _readMessage: function (msg: Size, reader: BinaryReader): Size { + _readMessage: function (msg: Size, reader: protoscript.BinaryReader): Size { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -126,7 +132,7 @@ export const SizeJSON = { _readMessage: function (msg: Size, json: any): Size { const _inches_ = json["inches"]; if (_inches_) { - msg.inches = _inches_; + msg.inches = protoscript.parseNumber(_inches_); } return msg; }, diff --git a/examples/typescript/src/user.pb.ts b/examples/typescript/src/user.pb.ts index 92bcb32..3a7d1fe 100644 --- a/examples/typescript/src/user.pb.ts +++ b/examples/typescript/src/user.pb.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { BinaryReader, BinaryWriter } from "protoscript"; +import * as protoscript from "protoscript"; //========================================// // Types // @@ -34,14 +34,20 @@ export const User = { * Serializes User to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return User._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return User._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes User from protobuf. */ decode: function (bytes: ByteSource): User { - return User._readMessage(User.initialize(), new BinaryReader(bytes)); + return User._readMessage( + User.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -63,8 +69,8 @@ export const User = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.firstName) { writer.writeString(1, msg.firstName); } @@ -96,7 +102,7 @@ export const User = { /** * @private */ - _readMessage: function (msg: User, reader: BinaryReader): User { + _readMessage: function (msg: User, reader: protoscript.BinaryReader): User { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -142,8 +148,8 @@ export const User = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeString(1, msg.key); } @@ -158,7 +164,7 @@ export const User = { */ _readMessage: function ( msg: User.Projects, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): User.Projects { while (reader.nextField()) { const field = reader.getFieldNumber(); diff --git a/packages/protoscript/src/codegen/autogenerate/index.ts b/packages/protoscript/src/codegen/autogenerate/index.ts index 863be24..74b9443 100644 --- a/packages/protoscript/src/codegen/autogenerate/index.ts +++ b/packages/protoscript/src/codegen/autogenerate/index.ts @@ -10,11 +10,9 @@ import { uniqueBy, } from "../utils.js"; -const DEFAULT_IMPORT_TRACKER = { - hasBytes: false, -}; - -let IMPORT_TRACKER: typeof DEFAULT_IMPORT_TRACKER; +const TIMESTAMP = "protoscript.Timestamp"; +const DURATION = "protoscript.Duration"; +const WELL_KNOWN_TYPES = [TIMESTAMP, DURATION]; function writeTypes(types: ProtoTypes[], parents: string[]): string { let result = ""; @@ -119,7 +117,7 @@ function writeProtobufSerializers( )})${printIfTypescript(`: Uint8Array`)} { return ${ node.content.namespacedName - }._writeMessage(msg, new BinaryWriter()).getResultBuffer();`; + }._writeMessage(msg, new protoscript.BinaryWriter()).getResultBuffer();`; } result += "},\n\n"; @@ -140,7 +138,7 @@ function writeProtobufSerializers( )})${printIfTypescript(`: ${node.content.namespacedName}`)} { return ${node.content.namespacedName}._readMessage(${ node.content.namespacedName - }.initialize(), new BinaryReader(bytes));`; + }.initialize(), new protoscript.BinaryReader(bytes));`; } result += "},\n\n"; @@ -189,9 +187,9 @@ function writeProtobufSerializers( */ _writeMessage: function(${printIf(isEmpty, "_")}msg${printIfTypescript( `: ${`PartialDeep<${node.content.namespacedName}>`}`, - )}, writer${printIfTypescript(`: BinaryWriter`)})${printIfTypescript( - `: BinaryWriter`, - )} { + )}, writer${printIfTypescript( + `: protoscript.BinaryWriter`, + )})${printIfTypescript(`: protoscript.BinaryWriter`)} { ${node.content.fields .map((field) => { let res = ""; @@ -256,16 +254,16 @@ function writeProtobufSerializers( if (isEmpty) { result += `_readMessage: function(_msg${printIfTypescript( `: ${`${node.content.namespacedName}`}`, - )}, _reader${printIfTypescript(`: BinaryReader`)})${printIfTypescript( - `: ${`${node.content.namespacedName}`}`, - )}{ + )}, _reader${printIfTypescript( + `: protoscript.BinaryReader`, + )})${printIfTypescript(`: ${`${node.content.namespacedName}`}`)}{ return _msg;`; } else { result += `_readMessage: function(msg${printIfTypescript( `: ${`${node.content.namespacedName}`}`, - )}, reader${printIfTypescript(`: BinaryReader`)})${printIfTypescript( - `: ${`${node.content.namespacedName}`}`, - )}{ + )}, reader${printIfTypescript( + `: protoscript.BinaryReader`, + )})${printIfTypescript(`: ${`${node.content.namespacedName}`}`)}{ while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -586,11 +584,10 @@ function writeJSONSerializers(types: ProtoTypes[], parents: string[]): string { res += `${setField} = msg.${field.name}.toString();`; } } else if (field.read === "readBytes") { - IMPORT_TRACKER.hasBytes = true; if (field.repeated) { - res += `${setField} = msg.${field.name}.map(encodeBase64Bytes);`; + res += `${setField} = msg.${field.name}.map(protoscript.encodeBase64Bytes);`; } else { - res += `${setField} = encodeBase64Bytes(msg.${field.name});`; + res += `${setField} = protoscript.encodeBase64Bytes(msg.${field.name});`; } } else { res += `${setField} = msg.${field.name};`; @@ -631,7 +628,11 @@ function writeJSONSerializers(types: ProtoTypes[], parents: string[]): string { res += `const ${name} = ${getField};`; res += `if (${name}) {`; - if (field.read === "readMessage") { + + if ( + field.read === "readMessage" && + !WELL_KNOWN_TYPES.includes(field.tsType) + ) { if (field.map) { res += `msg.${field.name} = ${fromMapMessage( `${toMapMessage(name)}.map(${ @@ -653,20 +654,70 @@ function writeJSONSerializers(types: ProtoTypes[], parents: string[]): string { } res += `${field.tsTypeJSON}._readMessage(msg.${field.name}, ${name});`; } - } else if (field.tsType === "bigint") { - if (field.repeated) { - res += `msg.${field.name} = ${name}.map(BigInt);`; - } else { - res += `msg.${field.name} = BigInt(${name});`; + } else { + let parser: string; + switch (field.read) { + case "readEnum": { + parser = `${field.tsType}._fromInt`; + break; + } + case "readBool": + case "readString": { + parser = "identity"; + break; + } + case "readBytes": { + parser = "protoscript.parseBytes"; + break; + } + case "readInt32": + case "readFixed32": + case "readUint32": { + parser = "protoscript.parseNumber"; + break; + } + case "readInt64String": + case "readFixed64String": + case "readUint64String": { + parser = "BigInt"; + break; + } + case "readFloat": + case "readDouble": { + parser = "protoscript.parseDouble"; + break; + } + case "readMessage": { + switch (field.tsType) { + case TIMESTAMP: { + parser = "protoscript.parseTimestamp"; + break; + } + case DURATION: { + parser = "protoscript.parseDuration"; + break; + } + default: { + parser = "identity"; + break; + } + } + break; + } + default: { + parser = "identity"; + break; + } } - } else if (field.read === "readBytes") { - if (field.repeated) { - res += `msg.${field.name} = ${name}.map(decodeBase64Bytes);`; + if (parser === "identity") { + res += `msg.${field.name} = ${name};`; } else { - res += `msg.${field.name} = decodeBase64Bytes(${name});`; + if (field.repeated) { + res += `msg.${field.name} = ${name}.map(${parser});`; + } else { + res += `msg.${field.name} = ${parser}(${name});`; + } } - } else { - res += `msg.${field.name} = ${name};`; } res += "}"; return res; @@ -813,8 +864,6 @@ export function generate( typescript: options.typescript as any, }; - IMPORT_TRACKER = { ...DEFAULT_IMPORT_TRACKER }; - const ast = processTypes(fileDescriptorProto, identifierTable, config.isTS); const { imports, types } = ast; const sourceFile = fileDescriptorProto.getName(); @@ -848,20 +897,12 @@ export function generate( ${printIf( config.isTS && hasSerializer, - `import type { ByteSource, PartialDeep } from 'protoscript';`, -)} -${printIf( - hasSerializer, - `import { - ${printIf(hasSerializer, "BinaryReader,\nBinaryWriter,\n")} - ${printIf(IMPORT_TRACKER.hasBytes, "encodeBase64Bytes,\n")} - ${printIf( - IMPORT_TRACKER.hasBytes, - "decodeBase64Bytes,\n", - )}} from 'protoscript';`, + `import type { ByteSource, PartialDeep } from "protoscript";`, )} +${printIf(hasSerializer, `import * as protoscript from "protoscript";`)} ${printIf(pluginImports.length > 0, pluginImports.join("\n"))} ${imports + .filter(({ moduleName }) => moduleName !== "protoscript") .map(({ moduleName, path }) => { return `import * as ${moduleName} from '${path}';`; }) diff --git a/packages/protoscript/src/runtime/index.ts b/packages/protoscript/src/runtime/index.ts index 187ca7f..8227ab3 100644 --- a/packages/protoscript/src/runtime/index.ts +++ b/packages/protoscript/src/runtime/index.ts @@ -1,6 +1,6 @@ export { BinaryReader } from "./reader.js"; export { BinaryWriter } from "./writer.js"; -export { decodeBase64Bytes, encodeBase64Bytes } from "./json.js"; +export * from "./json.js"; export type ByteSource = ArrayBuffer | Uint8Array | number[] | string; export type PartialDeep = { /* eslint-disable @typescript-eslint/no-explicit-any */ diff --git a/packages/protoscript/src/runtime/json.ts b/packages/protoscript/src/runtime/json.ts index 0f9c8c4..62dcb95 100644 --- a/packages/protoscript/src/runtime/json.ts +++ b/packages/protoscript/src/runtime/json.ts @@ -1,9 +1,68 @@ -import { byteArrayToString, stringToUint8Array } from "./goog/crypt.js"; +interface Duration { + seconds: bigint; + nanos: number; +} + +type Timestamp = Duration; export function encodeBase64Bytes(bytes: Uint8Array): string { - return btoa(byteArrayToString(bytes)); + let binary = ""; + for (let i = 0; i < bytes.length; i++) { + binary += String.fromCharCode(bytes[i]); + } + return btoa(binary); +} + +export function parseBytes(x: string): Uint8Array { + // Convert URL-safe Base64 to standard Base64 + let str = x.replace(/-/g, "+").replace(/_/g, "/"); + + // Add padding if it's missing + while (str.length % 4) { + str += "="; + } + + // decode Base64 + const binary = atob(str); + + // create Uint8Array + const bytes = new Uint8Array(binary.length); + for (let i = 0; i < binary.length; i++) { + bytes[i] = binary.charCodeAt(i); + } + return bytes; +} + +export function parseNumber(x: string | number): number { + if (typeof x === "string") { + return parseInt(x, 10); + } + return x; +} + +export function parseDouble(x: string | number): number { + if (typeof x === "string") { + return parseFloat(x); + } + return x; +} + +// Given '.3' => 300_000_000 +function parseNanos(x: string | undefined): number { + return parseInt((x ?? "").padEnd(9, "0"), 10); +} + +export function parseTimestamp(x: string): Timestamp { + const seconds = BigInt(Math.floor(new Date(x).getTime() / 1000)); + // Given an RFC 3339 formated date such as 2023-10-18T04:02:27.123Z + // spliting on '.' will yeild 123Z + // parseInt will ignore the letter (or any other offset) + const nanos = parseNanos(x.match(/\.(\d+)/)?.[1]); + return { seconds, nanos }; } -export function decodeBase64Bytes(bytes: string): Uint8Array { - return stringToUint8Array(atob(bytes)); +export function parseDuration(x: string): Duration { + // Given "1.000340012s" or "1s" + const [seconds, nanos] = x.replace("s", "").split("."); + return { seconds: BigInt(seconds), nanos: parseNanos(nanos) }; } diff --git a/packages/protoscript/src/runtime/well-known-types/any.pb.ts b/packages/protoscript/src/runtime/well-known-types/any.pb.ts index 5c64ec0..808dbe3 100644 --- a/packages/protoscript/src/runtime/well-known-types/any.pb.ts +++ b/packages/protoscript/src/runtime/well-known-types/any.pb.ts @@ -3,12 +3,7 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { - BinaryReader, - BinaryWriter, - encodeBase64Bytes, - decodeBase64Bytes, -} from "protoscript"; +import * as protoscript from "protoscript"; //========================================// // Types // @@ -127,7 +122,8 @@ export interface Any { * * Note: this functionality is not currently available in the official * protobuf release, and it is not used for type URLs beginning with - * type.googleapis.com. + * type.googleapis.com. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. * * Schemes other than `http`, `https` (or the empty scheme) might be * used with implementation specific semantics. @@ -149,14 +145,20 @@ export const Any = { * Serializes Any to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Any._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Any._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Any from protobuf. */ decode: function (bytes: ByteSource): Any { - return Any._readMessage(Any.initialize(), new BinaryReader(bytes)); + return Any._readMessage( + Any.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -174,8 +176,8 @@ export const Any = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.typeUrl) { writer.writeString(1, msg.typeUrl); } @@ -188,7 +190,7 @@ export const Any = { /** * @private */ - _readMessage: function (msg: Any, reader: BinaryReader): Any { + _readMessage: function (msg: Any, reader: protoscript.BinaryReader): Any { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -248,7 +250,7 @@ export const AnyJSON = { json["typeUrl"] = msg.typeUrl; } if (msg.value?.length) { - json["value"] = encodeBase64Bytes(msg.value); + json["value"] = protoscript.encodeBase64Bytes(msg.value); } return json; }, @@ -263,7 +265,7 @@ export const AnyJSON = { } const _value_ = json["value"]; if (_value_) { - msg.value = decodeBase64Bytes(_value_); + msg.value = protoscript.parseBytes(_value_); } return msg; }, diff --git a/packages/protoscript/src/runtime/well-known-types/api.pb.ts b/packages/protoscript/src/runtime/well-known-types/api.pb.ts index 72a55b0..a1dec96 100644 --- a/packages/protoscript/src/runtime/well-known-types/api.pb.ts +++ b/packages/protoscript/src/runtime/well-known-types/api.pb.ts @@ -3,8 +3,6 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { BinaryReader, BinaryWriter } from "protoscript"; - import * as protoscript from "protoscript"; //========================================// @@ -209,14 +207,20 @@ export const Api = { * Serializes Api to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Api._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Api._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Api from protobuf. */ decode: function (bytes: ByteSource): Api { - return Api._readMessage(Api.initialize(), new BinaryReader(bytes)); + return Api._readMessage( + Api.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -239,8 +243,8 @@ export const Api = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.name) { writer.writeString(1, msg.name); } @@ -276,7 +280,7 @@ export const Api = { /** * @private */ - _readMessage: function (msg: Api, reader: BinaryReader): Api { + _readMessage: function (msg: Api, reader: protoscript.BinaryReader): Api { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -332,14 +336,20 @@ export const Method = { * Serializes Method to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Method._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Method._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Method from protobuf. */ decode: function (bytes: ByteSource): Method { - return Method._readMessage(Method.initialize(), new BinaryReader(bytes)); + return Method._readMessage( + Method.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -362,8 +372,8 @@ export const Method = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.name) { writer.writeString(1, msg.name); } @@ -395,7 +405,10 @@ export const Method = { /** * @private */ - _readMessage: function (msg: Method, reader: BinaryReader): Method { + _readMessage: function ( + msg: Method, + reader: protoscript.BinaryReader, + ): Method { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -444,14 +457,20 @@ export const Mixin = { * Serializes Mixin to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Mixin._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Mixin._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Mixin from protobuf. */ decode: function (bytes: ByteSource): Mixin { - return Mixin._readMessage(Mixin.initialize(), new BinaryReader(bytes)); + return Mixin._readMessage( + Mixin.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -469,8 +488,8 @@ export const Mixin = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.name) { writer.writeString(1, msg.name); } @@ -483,7 +502,7 @@ export const Mixin = { /** * @private */ - _readMessage: function (msg: Mixin, reader: BinaryReader): Mixin { + _readMessage: function (msg: Mixin, reader: protoscript.BinaryReader): Mixin { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -618,7 +637,7 @@ export const ApiJSON = { } const _syntax_ = json["syntax"]; if (_syntax_) { - msg.syntax = _syntax_; + msg.syntax = protoscript.Syntax._fromInt(_syntax_); } return msg; }, @@ -720,7 +739,7 @@ export const MethodJSON = { } const _syntax_ = json["syntax"]; if (_syntax_) { - msg.syntax = _syntax_; + msg.syntax = protoscript.Syntax._fromInt(_syntax_); } return msg; }, diff --git a/packages/protoscript/src/runtime/well-known-types/duration.pb.ts b/packages/protoscript/src/runtime/well-known-types/duration.pb.ts index 8098047..0436a65 100644 --- a/packages/protoscript/src/runtime/well-known-types/duration.pb.ts +++ b/packages/protoscript/src/runtime/well-known-types/duration.pb.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { BinaryReader, BinaryWriter } from "protoscript"; +import * as protoscript from "protoscript"; //========================================// // Types // @@ -97,7 +97,10 @@ export const Duration = { * Serializes Duration to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Duration._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Duration._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** @@ -106,7 +109,7 @@ export const Duration = { decode: function (bytes: ByteSource): Duration { return Duration._readMessage( Duration.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -125,8 +128,8 @@ export const Duration = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.seconds) { writer.writeInt64String(1, msg.seconds.toString() as any); } @@ -139,7 +142,10 @@ export const Duration = { /** * @private */ - _readMessage: function (msg: Duration, reader: BinaryReader): Duration { + _readMessage: function ( + msg: Duration, + reader: protoscript.BinaryReader, + ): Duration { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -219,7 +225,7 @@ export const DurationJSON = { } const _nanos_ = json["nanos"]; if (_nanos_) { - msg.nanos = _nanos_; + msg.nanos = protoscript.parseNumber(_nanos_); } return msg; }, diff --git a/packages/protoscript/src/runtime/well-known-types/empty.pb.ts b/packages/protoscript/src/runtime/well-known-types/empty.pb.ts index a213f73..989040c 100644 --- a/packages/protoscript/src/runtime/well-known-types/empty.pb.ts +++ b/packages/protoscript/src/runtime/well-known-types/empty.pb.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { BinaryReader, BinaryWriter } from "protoscript"; +import * as protoscript from "protoscript"; //========================================// // Types // @@ -52,15 +52,18 @@ export const Empty = { */ _writeMessage: function ( _msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { return writer; }, /** * @private */ - _readMessage: function (_msg: Empty, _reader: BinaryReader): Empty { + _readMessage: function ( + _msg: Empty, + _reader: protoscript.BinaryReader, + ): Empty { return _msg; }, }; diff --git a/packages/protoscript/src/runtime/well-known-types/field_mask.pb.ts b/packages/protoscript/src/runtime/well-known-types/field_mask.pb.ts index 2bdd0f8..4abe5cf 100644 --- a/packages/protoscript/src/runtime/well-known-types/field_mask.pb.ts +++ b/packages/protoscript/src/runtime/well-known-types/field_mask.pb.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { BinaryReader, BinaryWriter } from "protoscript"; +import * as protoscript from "protoscript"; //========================================// // Types // @@ -226,7 +226,10 @@ export const FieldMask = { * Serializes FieldMask to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return FieldMask._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return FieldMask._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** @@ -235,7 +238,7 @@ export const FieldMask = { decode: function (bytes: ByteSource): FieldMask { return FieldMask._readMessage( FieldMask.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -253,8 +256,8 @@ export const FieldMask = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.paths?.length) { writer.writeRepeatedString(1, msg.paths); } @@ -264,7 +267,10 @@ export const FieldMask = { /** * @private */ - _readMessage: function (msg: FieldMask, reader: BinaryReader): FieldMask { + _readMessage: function ( + msg: FieldMask, + reader: protoscript.BinaryReader, + ): FieldMask { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { diff --git a/packages/protoscript/src/runtime/well-known-types/source_context.pb.ts b/packages/protoscript/src/runtime/well-known-types/source_context.pb.ts index 2e1956b..a05dca1 100644 --- a/packages/protoscript/src/runtime/well-known-types/source_context.pb.ts +++ b/packages/protoscript/src/runtime/well-known-types/source_context.pb.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { BinaryReader, BinaryWriter } from "protoscript"; +import * as protoscript from "protoscript"; //========================================// // Types // @@ -32,7 +32,7 @@ export const SourceContext = { encode: function (msg: PartialDeep): Uint8Array { return SourceContext._writeMessage( msg, - new BinaryWriter(), + new protoscript.BinaryWriter(), ).getResultBuffer(); }, @@ -42,7 +42,7 @@ export const SourceContext = { decode: function (bytes: ByteSource): SourceContext { return SourceContext._readMessage( SourceContext.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -60,8 +60,8 @@ export const SourceContext = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.fileName) { writer.writeString(1, msg.fileName); } @@ -73,7 +73,7 @@ export const SourceContext = { */ _readMessage: function ( msg: SourceContext, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): SourceContext { while (reader.nextField()) { const field = reader.getFieldNumber(); diff --git a/packages/protoscript/src/runtime/well-known-types/struct.pb.ts b/packages/protoscript/src/runtime/well-known-types/struct.pb.ts index 0d232fe..d5386bf 100644 --- a/packages/protoscript/src/runtime/well-known-types/struct.pb.ts +++ b/packages/protoscript/src/runtime/well-known-types/struct.pb.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { BinaryReader, BinaryWriter } from "protoscript"; +import * as protoscript from "protoscript"; //========================================// // Types // @@ -132,14 +132,20 @@ export const Struct = { * Serializes Struct to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Struct._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Struct._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Struct from protobuf. */ decode: function (bytes: ByteSource): Struct { - return Struct._readMessage(Struct.initialize(), new BinaryReader(bytes)); + return Struct._readMessage( + Struct.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -156,8 +162,8 @@ export const Struct = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.fields) { writer.writeRepeatedMessage( 1, @@ -174,7 +180,10 @@ export const Struct = { /** * @private */ - _readMessage: function (msg: Struct, reader: BinaryReader): Struct { + _readMessage: function ( + msg: Struct, + reader: protoscript.BinaryReader, + ): Struct { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -199,8 +208,8 @@ export const Struct = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.key) { writer.writeString(1, msg.key); } @@ -215,7 +224,7 @@ export const Struct = { */ _readMessage: function ( msg: Struct.Fields, - reader: BinaryReader, + reader: protoscript.BinaryReader, ): Struct.Fields { while (reader.nextField()) { const field = reader.getFieldNumber(); @@ -245,14 +254,20 @@ export const Value = { * Serializes Value to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Value._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Value._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Value from protobuf. */ decode: function (bytes: ByteSource): Value { - return Value._readMessage(Value.initialize(), new BinaryReader(bytes)); + return Value._readMessage( + Value.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -274,8 +289,8 @@ export const Value = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.nullValue != undefined) { writer.writeEnum(1, NullValue._toInt(msg.nullValue)); } @@ -300,7 +315,7 @@ export const Value = { /** * @private */ - _readMessage: function (msg: Value, reader: BinaryReader): Value { + _readMessage: function (msg: Value, reader: protoscript.BinaryReader): Value { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -345,7 +360,10 @@ export const ListValue = { * Serializes ListValue to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return ListValue._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return ListValue._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** @@ -354,7 +372,7 @@ export const ListValue = { decode: function (bytes: ByteSource): ListValue { return ListValue._readMessage( ListValue.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -372,8 +390,8 @@ export const ListValue = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.values?.length) { writer.writeRepeatedMessage(1, msg.values as any, Value._writeMessage); } @@ -383,7 +401,10 @@ export const ListValue = { /** * @private */ - _readMessage: function (msg: ListValue, reader: BinaryReader): ListValue { + _readMessage: function ( + msg: ListValue, + reader: protoscript.BinaryReader, + ): ListValue { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -601,11 +622,11 @@ export const ValueJSON = { _readMessage: function (msg: Value, json: any): Value { const _nullValue_ = json["nullValue"] ?? json["null_value"]; if (_nullValue_) { - msg.nullValue = _nullValue_; + msg.nullValue = NullValue._fromInt(_nullValue_); } const _numberValue_ = json["numberValue"] ?? json["number_value"]; if (_numberValue_) { - msg.numberValue = _numberValue_; + msg.numberValue = protoscript.parseDouble(_numberValue_); } const _stringValue_ = json["stringValue"] ?? json["string_value"]; if (_stringValue_) { diff --git a/packages/protoscript/src/runtime/well-known-types/timestamp.pb.ts b/packages/protoscript/src/runtime/well-known-types/timestamp.pb.ts index 00fd644..e3bd10c 100644 --- a/packages/protoscript/src/runtime/well-known-types/timestamp.pb.ts +++ b/packages/protoscript/src/runtime/well-known-types/timestamp.pb.ts @@ -3,7 +3,7 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { BinaryReader, BinaryWriter } from "protoscript"; +import * as protoscript from "protoscript"; //========================================// // Types // @@ -126,7 +126,10 @@ export const Timestamp = { * Serializes Timestamp to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Timestamp._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Timestamp._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** @@ -135,7 +138,7 @@ export const Timestamp = { decode: function (bytes: ByteSource): Timestamp { return Timestamp._readMessage( Timestamp.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -154,8 +157,8 @@ export const Timestamp = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.seconds) { writer.writeInt64String(1, msg.seconds.toString() as any); } @@ -168,7 +171,10 @@ export const Timestamp = { /** * @private */ - _readMessage: function (msg: Timestamp, reader: BinaryReader): Timestamp { + _readMessage: function ( + msg: Timestamp, + reader: protoscript.BinaryReader, + ): Timestamp { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -248,7 +254,7 @@ export const TimestampJSON = { } const _nanos_ = json["nanos"]; if (_nanos_) { - msg.nanos = _nanos_; + msg.nanos = protoscript.parseNumber(_nanos_); } return msg; }, diff --git a/packages/protoscript/src/runtime/well-known-types/type.pb.ts b/packages/protoscript/src/runtime/well-known-types/type.pb.ts index 64b30ec..61cb7cb 100644 --- a/packages/protoscript/src/runtime/well-known-types/type.pb.ts +++ b/packages/protoscript/src/runtime/well-known-types/type.pb.ts @@ -3,8 +3,6 @@ /* eslint-disable */ import type { ByteSource, PartialDeep } from "protoscript"; -import { BinaryReader, BinaryWriter } from "protoscript"; - import * as protoscript from "protoscript"; //========================================// @@ -266,14 +264,20 @@ export const Type = { * Serializes Type to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Type._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Type._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Type from protobuf. */ decode: function (bytes: ByteSource): Type { - return Type._readMessage(Type.initialize(), new BinaryReader(bytes)); + return Type._readMessage( + Type.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -296,8 +300,8 @@ export const Type = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.name) { writer.writeString(1, msg.name); } @@ -329,7 +333,7 @@ export const Type = { /** * @private */ - _readMessage: function (msg: Type, reader: BinaryReader): Type { + _readMessage: function (msg: Type, reader: protoscript.BinaryReader): Type { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -383,14 +387,20 @@ export const Field = { * Serializes Field to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Field._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Field._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Field from protobuf. */ decode: function (bytes: ByteSource): Field { - return Field._readMessage(Field.initialize(), new BinaryReader(bytes)); + return Field._readMessage( + Field.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -416,8 +426,8 @@ export const Field = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.kind && Field.Kind._toInt(msg.kind)) { writer.writeEnum(1, Field.Kind._toInt(msg.kind)); } @@ -454,7 +464,7 @@ export const Field = { /** * @private */ - _readMessage: function (msg: Field, reader: BinaryReader): Field { + _readMessage: function (msg: Field, reader: protoscript.BinaryReader): Field { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -795,14 +805,20 @@ export const Enum = { * Serializes Enum to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return Enum._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return Enum._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** * Deserializes Enum from protobuf. */ decode: function (bytes: ByteSource): Enum { - return Enum._readMessage(Enum.initialize(), new BinaryReader(bytes)); + return Enum._readMessage( + Enum.initialize(), + new protoscript.BinaryReader(bytes), + ); }, /** @@ -824,8 +840,8 @@ export const Enum = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.name) { writer.writeString(1, msg.name); } @@ -858,7 +874,7 @@ export const Enum = { /** * @private */ - _readMessage: function (msg: Enum, reader: BinaryReader): Enum { + _readMessage: function (msg: Enum, reader: protoscript.BinaryReader): Enum { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -908,7 +924,10 @@ export const EnumValue = { * Serializes EnumValue to protobuf. */ encode: function (msg: PartialDeep): Uint8Array { - return EnumValue._writeMessage(msg, new BinaryWriter()).getResultBuffer(); + return EnumValue._writeMessage( + msg, + new protoscript.BinaryWriter(), + ).getResultBuffer(); }, /** @@ -917,7 +936,7 @@ export const EnumValue = { decode: function (bytes: ByteSource): EnumValue { return EnumValue._readMessage( EnumValue.initialize(), - new BinaryReader(bytes), + new protoscript.BinaryReader(bytes), ); }, @@ -937,8 +956,8 @@ export const EnumValue = { */ _writeMessage: function ( msg: PartialDeep, - writer: BinaryWriter, - ): BinaryWriter { + writer: protoscript.BinaryWriter, + ): protoscript.BinaryWriter { if (msg.name) { writer.writeString(1, msg.name); } @@ -954,7 +973,10 @@ export const EnumValue = { /** * @private */ - _readMessage: function (msg: EnumValue, reader: BinaryReader): EnumValue { + _readMessage: function ( + msg: EnumValue, + reader: protoscript.BinaryReader, + ): EnumValue { while (reader.nextField()) { const field = reader.getFieldNumber(); switch (field) { @@ -987,14 +1009,20 @@ export const Option = { * Serializes Option to protobuf. */ encode: function (msg: PartialDeep