googleapis / gax-ruby

Google API Extensions for Ruby
https://rubygems.org/gems/google-gax
BSD 3-Clause "New" or "Revised" License
20 stars 22 forks source link

Use descriptor pool for deserialization #136

Closed jbolinger closed 5 years ago

jbolinger commented 5 years ago

This library attempts to automatically unpack the error messages details field (an Any proto) when an RPC fails. This was originally implemented by reconstructing the expected Ruby class name from the type_name property of the Any object.

This change replaces that by unpack ing the object using the generated descriptor pool instead. A ruby_namespace option was added to protobuf around version 3.6, which makes the original implementation unreliable when used.

codecov-io commented 5 years ago

Codecov Report

Merging #136 into master will decrease coverage by 0.14%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #136      +/-   ##
==========================================
- Coverage   99.36%   99.22%   -0.15%     
==========================================
  Files          19       19              
  Lines        2058     2058              
==========================================
- Hits         2045     2042       -3     
- Misses         13       16       +3
Impacted Files Coverage Δ
spec/google/gax/grpc_spec.rb 100% <ø> (ø) :arrow_up:
lib/google/gax/grpc.rb 93.47% <100%> (-6.53%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update da57030...95a4ce6. Read the comment docs.

jbolinger commented 5 years ago

@blowmage @dazuma have any of the cloud libraries been released using the ruby_namespace option?

blowmage commented 5 years ago

I am not aware of any libraries making use of the ruby_namespace feature.

jbolinger commented 5 years ago

@blowmage thanks for confirming.

I imagine you'll start using ruby_namespace soon (i.e. you'll need it to resolve this: https://github.com/googleapis/google-cloud-ruby/issues/1762) so we should probably make sure this gets released first.