google-api-ruby-client icon indicating copy to clipboard operation
google-api-ruby-client copied to clipboard

Add finer support for map entries in the `fetch_all` method

Open saicheems opened this issue 9 years ago • 2 comments

fetch_all is able to collect the items resource of page streaming functions. For arrays, it conveniently joins all items into a single collection:

https://github.com/google/google-api-ruby-client/blob/c645e7d2f893dc5165ce6354b07f147387bce109/lib/google/apis/core/base_service.rb#L66

It would be nice to have the same behavior for maps. Right now, maps have to be iterated over like this:

https://github.com/saicheems/toolkit/blob/5d7ac67c5192e9b0bee704151a5f4f7860e15541/src/test/java/com/google/api/codegen/testdata/discoveries/ruby/ruby_compute.v1.json.baseline#L32

An improvement would theoretically be as easy as checking in fetch_all whether items is a map, and doing roughly the same thing that is done for arrays currently.

saicheems avatar May 31 '17 05:05 saicheems

This seems like a major inconsistency that will surprise users notwithstanding sample code. Can we elevate this to P1?

tcoffee-google avatar May 31 '17 18:05 tcoffee-google

On the other hand, this could be a breaking change.

tcoffee-google avatar May 31 '17 18:05 tcoffee-google