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

Conversion functions for google.type.*? #706

Closed
shouichi opened this issue Jan 13, 2022 · 5 comments
Closed

Conversion functions for google.type.*? #706

shouichi opened this issue Jan 13, 2022 · 5 comments
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@shouichi
Copy link

Hello, I'm not really sure where to report but here I go.

There are helper functions that convert ruby objects and proto messages e.g., Gapic::Protobuf.timestamp_to_time. Are there equivalent functions for google.type.*. For example, I need a conversion function that convers Google::Type::Date to Date and vice versa.

Thank you.

@shouichi shouichi added priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Jan 13, 2022
@dazuma
Copy link
Member

dazuma commented Nov 30, 2022

Hi, sorry we haven't gotten to this.

For general conversion utility methods, I wonder if it makes more sense for them to go into the google-protobuf gem itself. Perhaps here: https://github.com/protocolbuffers/protobuf/blob/main/ruby/lib/google/protobuf/well_known_types.rb. That way it would be available to any user of protobuf.

The gapic-common gem in this repository is kind of specific to Google API client libraries, and generally has utility methods that are used internally by the code generator or the generated clients, or that are present for backward compatibility with earlier clients. Adding things here might not reach a wide audience, as the gem isn't meant to be used directly by end users.

@shouichi
Copy link
Author

shouichi commented Dec 1, 2022

@shouichi shouichi closed this as completed Dec 1, 2022
@shouichi shouichi reopened this Dec 1, 2022
@shouichi
Copy link
Author

shouichi commented Dec 1, 2022

@dazuma I realized that I personally need utility functions for google.type.Date which is not part of the standard protobuf messages. Thus it is strange to add them to https://github.com/protocolbuffers/protobuf. What do you think?

@dazuma
Copy link
Member

dazuma commented Dec 29, 2022

Oh, I see. Timestamp is under google.protobuf which is built-in, but Date is under google.type which is a standard type but not built-in. So you're right, it probably doesn't make sense to add those to the protobuf gem itself. However, as mentioned earlier, gapic-common is not really the right location either since it's not intended to be used directly other than by generated google-specific clients. I think we might consider adding utility methods like that to this gem which provides definitions for those protos. Right now it's generated, but we could add a simple mechanism to append handwritten code to it.

@shouichi
Copy link
Author

shouichi commented Jan 3, 2023

Superseded by googleapis/common-protos-ruby#114.

@shouichi shouichi closed this as completed Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants