Unverified Commit 37a0ab7d authored by Paul Yang's avatar Paul Yang Committed by GitHub

Fix Any json encoding/decoding for ruby. (#5592)

* Fix Any json encoding/decoding for ruby.

* Revert unnecessary changes
parent c4f2a92c
...@@ -5,6 +5,7 @@ Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput ...@@ -5,6 +5,7 @@ Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator
Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator
Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter
Recommended.Proto3.JsonInput.Int64FieldBeString.Validator Recommended.Proto3.JsonInput.Int64FieldBeString.Validator
Recommended.Proto3.JsonInput.MapFieldValueIsNull Recommended.Proto3.JsonInput.MapFieldValueIsNull
Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull
...@@ -18,26 +19,6 @@ Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator ...@@ -18,26 +19,6 @@ Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator
Recommended.Proto3.JsonInput.Uint64FieldBeString.Validator Recommended.Proto3.JsonInput.Uint64FieldBeString.Validator
Required.DurationProtoInputTooLarge.JsonOutput Required.DurationProtoInputTooLarge.JsonOutput
Required.DurationProtoInputTooSmall.JsonOutput Required.DurationProtoInputTooSmall.JsonOutput
Required.Proto3.JsonInput.Any.JsonOutput
Required.Proto3.JsonInput.Any.ProtobufOutput
Required.Proto3.JsonInput.AnyNested.JsonOutput
Required.Proto3.JsonInput.AnyNested.ProtobufOutput
Required.Proto3.JsonInput.AnyUnorderedTypeTag.JsonOutput
Required.Proto3.JsonInput.AnyUnorderedTypeTag.ProtobufOutput
Required.Proto3.JsonInput.AnyWithDuration.JsonOutput
Required.Proto3.JsonInput.AnyWithDuration.ProtobufOutput
Required.Proto3.JsonInput.AnyWithFieldMask.JsonOutput
Required.Proto3.JsonInput.AnyWithFieldMask.ProtobufOutput
Required.Proto3.JsonInput.AnyWithInt32ValueWrapper.JsonOutput
Required.Proto3.JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput
Required.Proto3.JsonInput.AnyWithStruct.JsonOutput
Required.Proto3.JsonInput.AnyWithStruct.ProtobufOutput
Required.Proto3.JsonInput.AnyWithTimestamp.JsonOutput
Required.Proto3.JsonInput.AnyWithTimestamp.ProtobufOutput
Required.Proto3.JsonInput.AnyWithValueForInteger.JsonOutput
Required.Proto3.JsonInput.AnyWithValueForInteger.ProtobufOutput
Required.Proto3.JsonInput.AnyWithValueForJsonObject.JsonOutput
Required.Proto3.JsonInput.AnyWithValueForJsonObject.ProtobufOutput
Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput
Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput
Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.JsonOutput Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.JsonOutput
...@@ -45,8 +26,6 @@ Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput ...@@ -45,8 +26,6 @@ Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput
Required.Proto3.JsonInput.DoubleFieldNan.JsonOutput Required.Proto3.JsonInput.DoubleFieldNan.JsonOutput
Required.Proto3.JsonInput.DurationMinValue.JsonOutput Required.Proto3.JsonInput.DurationMinValue.JsonOutput
Required.Proto3.JsonInput.DurationRepeatedValue.JsonOutput Required.Proto3.JsonInput.DurationRepeatedValue.JsonOutput
Required.Proto3.JsonInput.FieldMask.JsonOutput
Required.Proto3.JsonInput.FieldMask.ProtobufOutput
Required.Proto3.JsonInput.FloatFieldInfinity.JsonOutput Required.Proto3.JsonInput.FloatFieldInfinity.JsonOutput
Required.Proto3.JsonInput.FloatFieldNan.JsonOutput Required.Proto3.JsonInput.FloatFieldNan.JsonOutput
Required.Proto3.JsonInput.FloatFieldNegativeInfinity.JsonOutput Required.Proto3.JsonInput.FloatFieldNegativeInfinity.JsonOutput
......
This diff is collapsed.
...@@ -196,6 +196,8 @@ VALUE DescriptorPool_build(int argc, VALUE* argv, VALUE _self); ...@@ -196,6 +196,8 @@ VALUE DescriptorPool_build(int argc, VALUE* argv, VALUE _self);
VALUE DescriptorPool_lookup(VALUE _self, VALUE name); VALUE DescriptorPool_lookup(VALUE _self, VALUE name);
VALUE DescriptorPool_generated_pool(VALUE _self); VALUE DescriptorPool_generated_pool(VALUE _self);
extern VALUE generated_pool;
void Descriptor_mark(void* _self); void Descriptor_mark(void* _self);
void Descriptor_free(void* _self); void Descriptor_free(void* _self);
VALUE Descriptor_alloc(VALUE klass); VALUE Descriptor_alloc(VALUE klass);
......
This diff is collapsed.
This diff is collapsed.
...@@ -22,8 +22,8 @@ class EncodeDecodeTest < Test::Unit::TestCase ...@@ -22,8 +22,8 @@ class EncodeDecodeTest < Test::Unit::TestCase
# Test discard unknown for singular message field. # Test discard unknown for singular message field.
unknown_msg = A::B::C::TestUnknown.new( unknown_msg = A::B::C::TestUnknown.new(
:optional_unknown => :optional_unknown =>
A::B::C::TestUnknown.new(:unknown_field => 1)) A::B::C::TestUnknown.new(:unknown_field => 1))
from = A::B::C::TestUnknown.encode(unknown_msg) from = A::B::C::TestUnknown.encode(unknown_msg)
m = A::B::C::TestMessage.decode(from) m = A::B::C::TestMessage.decode(from)
Google::Protobuf.discard_unknown(m) Google::Protobuf.discard_unknown(m)
...@@ -32,8 +32,8 @@ class EncodeDecodeTest < Test::Unit::TestCase ...@@ -32,8 +32,8 @@ class EncodeDecodeTest < Test::Unit::TestCase
# Test discard unknown for repeated message field. # Test discard unknown for repeated message field.
unknown_msg = A::B::C::TestUnknown.new( unknown_msg = A::B::C::TestUnknown.new(
:repeated_unknown => :repeated_unknown =>
[A::B::C::TestUnknown.new(:unknown_field => 1)]) [A::B::C::TestUnknown.new(:unknown_field => 1)])
from = A::B::C::TestUnknown.encode(unknown_msg) from = A::B::C::TestUnknown.encode(unknown_msg)
m = A::B::C::TestMessage.decode(from) m = A::B::C::TestMessage.decode(from)
Google::Protobuf.discard_unknown(m) Google::Protobuf.discard_unknown(m)
...@@ -42,8 +42,8 @@ class EncodeDecodeTest < Test::Unit::TestCase ...@@ -42,8 +42,8 @@ class EncodeDecodeTest < Test::Unit::TestCase
# Test discard unknown for map value message field. # Test discard unknown for map value message field.
unknown_msg = A::B::C::TestUnknown.new( unknown_msg = A::B::C::TestUnknown.new(
:map_unknown => :map_unknown =>
{"" => A::B::C::TestUnknown.new(:unknown_field => 1)}) {"" => A::B::C::TestUnknown.new(:unknown_field => 1)})
from = A::B::C::TestUnknown.encode(unknown_msg) from = A::B::C::TestUnknown.encode(unknown_msg)
m = A::B::C::TestMessage.decode(from) m = A::B::C::TestMessage.decode(from)
Google::Protobuf.discard_unknown(m) Google::Protobuf.discard_unknown(m)
...@@ -52,8 +52,8 @@ class EncodeDecodeTest < Test::Unit::TestCase ...@@ -52,8 +52,8 @@ class EncodeDecodeTest < Test::Unit::TestCase
# Test discard unknown for oneof message field. # Test discard unknown for oneof message field.
unknown_msg = A::B::C::TestUnknown.new( unknown_msg = A::B::C::TestUnknown.new(
:oneof_unknown => :oneof_unknown =>
A::B::C::TestUnknown.new(:unknown_field => 1)) A::B::C::TestUnknown.new(:unknown_field => 1))
from = A::B::C::TestUnknown.encode(unknown_msg) from = A::B::C::TestUnknown.encode(unknown_msg)
m = A::B::C::TestMessage.decode(from) m = A::B::C::TestMessage.decode(from)
Google::Protobuf.discard_unknown(m) Google::Protobuf.discard_unknown(m)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment