ruby-protobuf / protobuf

A pure ruby implementation of Google's Protocol Buffers
https://github.com/ruby-protobuf
MIT License
462 stars 101 forks source link

to_json broken as of 0.9.1 since 0.8.0 #401

Closed taf2 closed 4 years ago

taf2 commented 5 years ago

When upgrading google-protobuf ruby library this morning we observed it caused a regression when using google speech to text service. Objects are now serialized as {} instead of {alternatives: [ {word: 'hello', ... }, {world: 'world', ... }, ... ]

To replicate install google-cloud-speech

transcribe using an operation

get the operation and when it's finished

puts operation.response.results.to_json.inspect
"[{},{},{}]"

when using 0.9.1

but when using 0.8.0 gem

[{"alternatives"=>[{"transcript"=>"Hello. Hello. Yes, I would like to learn more about Friday.", "confidence"=>0.8977590203285217, "words"=>[{"start_time"=>{"seconds"=>11, "nanos"=>300000000},

Seems like a regression in 0.9.1 when converting a protobuf into JSON...

film42 commented 4 years ago

@taf2 I think you might be looking for https://github.com/protocolbuffers/protobuf/tree/master/ruby ?

taf2 commented 4 years ago

@film42 maybe? are you indicating that it's resolved in master?

film42 commented 4 years ago

This is the “protobuf” library, not “google-protobuf”. Are you using this one or the official google protobuf ruby lib?

On Wed, Oct 9, 2019 at 9:31 PM Todd notifications@github.com wrote:

@film42 https://github.com/film42 maybe? are you indicating that it's resolved in master?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ruby-protobuf/protobuf/issues/401?email_source=notifications&email_token=AAH63RBUCZGIWE4K54MYSD3QN2AXRA5CNFSM4ILKOGB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEA2BGXY#issuecomment-540283743, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH63RACX256FUCTSYEUQUDQN2AXRANCNFSM4ILKOGBQ .

taf2 commented 4 years ago

@film42 ah ok very sorry! i saw ruby-protobuf and must have mis-read as google-protobuf thank you!

film42 commented 4 years ago

No problem! Sorry I didn’t get back to you sooner!

On Wed, Oct 9, 2019 at 11:47 PM Todd notifications@github.com wrote:

@film42 https://github.com/film42 ah ok very sorry! i saw ruby-protobuf and must have mis-read as google-protobuf thank you!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ruby-protobuf/protobuf/issues/401?email_source=notifications&email_token=AAH63RDL76AMLGZJYS6LK7TQN2QUTA5CNFSM4ILKOGB2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEA2NJRI#issuecomment-540333253, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH63RAMNYPEJ4JAEPPW7CDQN2QUTANCNFSM4ILKOGBQ .