-
Notifications
You must be signed in to change notification settings - Fork 15.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ruby: Allow for the instantiation of nested message fields with ruby-hashes #3120
Comments
CC @haberman |
@acozzette We have limited bandwidth for the remainder of the quarter, but this is an important usability problem for the Ruby Cloud client libraries. Could you send us some code links so we can get some sense what changes would be needed to the protobuf codebase to enable this? (If we're not able to make the fix in protobuf, we might work around by providing a utility method in the client that transforms hashes to protobuf messages. But if possible, I'd prefer to fix this here rather than in the client libraries.) |
@haberman -- could you advise here? |
@zanker @acozzette It looks like this was implemented in #3627, in which case this issue could be closed. But I'm having trouble getting the feature to work in protobuf
@zanker -- is this the intended usage of the feature you implemented in #3627? |
Hm, that's odd. That is the correct syntax, and the test for it https://github.com/google/protobuf/pull/3627/files#diff-bbb59c88129c0bf6537d0487634b282dR205 is the same as what you have, and it does look like the code made it into Silly question, but are you sure you're pulling |
Yep, it's 3.5.0:
|
@geigerj any luck with this? |
@antonioparisi I am not aware of any updates. Some of the others on this issue might be able to advise. |
@zanker ? |
Also experiencing this issue on 3.5.1.2. pry(main)> Gem.loaded_specs['google-protobuf'].version.version
=> "3.5.1.2"
pry(main)> Google::Protobuf::Struct.new(fields: { "a" => { number_value: 0 } })
TypeError: Invalid type Hash to assign to submessage field.
from (pry):29:in `initialize' |
any update on this? |
What
Currently instantiation of a protobuf message can be done using a ruby-hash but does not support instantiating the nested messages using nested hashes. Being able to support the instantiation of messages including nested messages using a single hash would be a big usability win for googleapis/toolkit.
Example
Current
Requested
The text was updated successfully, but these errors were encountered: