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

[Feature]: Ability to format consumed proto bytes as a hex string #18

Open
MahlerFive opened this issue Jul 13, 2020 · 1 comment
Open

Comments

@MahlerFive
Copy link

Is your feature request related to a problem? Please describe.
When using trubka consume proto if you have a protobuf with a field of type bytes, the field will be formatted as base64, but I would like to look at them in hex string format. There is an option to format your entire message as hex using -F hex but not just bytes fields.

Describe the solution you'd like
An option to output in -F json-indent format, but with individual fields of type bytes as hex strings.
For example adding a flag --bytes-format [base64|hex].
You could take this concept even further and have custom formatting for any type with some kind of configuration file. For example you may want timestamps in a different format as well.

@MahlerFive
Copy link
Author

Related: in the producer it would be good to have support for providing hex strings for bytes fields in the json template created by trubka produce schema -g. For example, if I want a mac address as bytes (6 bytes without delimiters) then I would like to have a 12-long hex string like Hex(????????????). But right now I have to think about how many base64 bytes and do B64(????????). This will also only work if the number of bytes is divisible by 3, otherwise there's no way to accurate generate what I need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant