Skip to content
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

Use google.protobuf.json_format for resource.dict_to_struct and resource.struct_to_dict #108

Open
negz opened this issue Nov 5, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@negz
Copy link
Member

negz commented Nov 5, 2024

What problem are you facing?

We have two helpers to convert between Python dictionaries and protobuf structs:

  • resource.struct_to_dict(some_struct)
  • resource.dict_to_struct(some_dict)

I believe these are equivalent to:

  • google.protobuf.json_format.MessageToDict(some_struct)
  • google.protobuf.json_format.ParseDict(some_dict, empty_struct)

How could this Function help solve your problem?

I think we should keep our helpers for discoverability/backward compatibility, but have them just use the json_format equivalents under the hood.

@negz negz added the enhancement New feature or request label Nov 5, 2024
@fernandezcuesta
Copy link
Contributor

Hi @negz apparently yes, see #102 which validates your statement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants