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

Add support for --bytes-as-base64 #611

Merged
merged 2 commits into from
Feb 5, 2023
Merged

Conversation

flokli
Copy link
Contributor

@flokli flokli commented Nov 26, 2022

This allows entering bytes as a base64-encoded string, using the standard encoding.

Suggested in #610

@flokli
Copy link
Contributor Author

flokli commented Nov 26, 2022

I tried extending fill/proto/interactive_filler_test.go with an additional field, but I don't understand the test harness enough to understand how to test the filler with other filler opts just for one field. It must work somehow, because we fill bytes passed in there, and read from ./proto.go file.

@ktr0731, @BenSlabbert, any thoughts?

@flokli
Copy link
Contributor Author

flokli commented Nov 26, 2022

Hmmh, we output bytes as base64, like grpcurl does. It would feel much more natural if this was the default TBH.

This allows entering bytes as a base64-encoded string, using the standard
encoding.
@flokli
Copy link
Contributor Author

flokli commented Feb 1, 2023

poke @ktr0731 . WDYT?

Happy to rework this patch to accept bytes as base64 by default, if you prefer that.

@codecov
Copy link

codecov bot commented Feb 5, 2023

Codecov Report

Merging #611 (c84378e) into master (f75862c) will decrease coverage by 0.16%.
The diff coverage is 55.55%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #611      +/-   ##
==========================================
- Coverage   80.17%   80.01%   -0.16%     
==========================================
  Files          57       57              
  Lines        3848     3858      +10     
==========================================
+ Hits         3085     3087       +2     
- Misses        536      542       +6     
- Partials      227      229       +2     

Copy link
Owner

@ktr0731 ktr0731 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay. The content is very informative, LGTM, thank you!

@ktr0731 ktr0731 merged commit 2856945 into ktr0731:master Feb 5, 2023
@flokli
Copy link
Contributor Author

flokli commented Feb 5, 2023

Thanks for the merge! What's your opinion on making base64 input for bytes the default, to be symmetrical with the output? (As in #611 (comment) )

@flokli flokli deleted the bytes-as-base64 branch February 5, 2023 16:35
@ktr0731
Copy link
Owner

ktr0731 commented Feb 6, 2023

Oh, I missed that 🙏
Sounds good. I was worried about backward compatibility, but we can still use the input as is (just like the change in this PR does). Can you give this a shot?

@ktr0731
Copy link
Owner

ktr0731 commented Feb 6, 2023

You can revert your merged changes since I haven't released a new version yet.

@flokli
Copy link
Contributor Author

flokli commented Feb 6, 2023

I'm not sure I understand the task exactly.

I honestly doubt someone is using byte literals or unicode literals to enter bytes (especially considering we output base64).

My proposal would be to accept base64 by default, (keep --bytes-from-file), and introduce a (--bytes-literal) argument bringing back the old behaviour.

flokli added a commit to flokli/evans that referenced this pull request Feb 6, 2023
As per ktr0731#611 (comment),
this keeps thing symmetrical with the output, and how grpcurl handles it
as well.

The old quoted literal behaviour is still accessible via
`--bytes-as-quoted-literals`.
@flokli
Copy link
Contributor Author

flokli commented Feb 6, 2023

This is implemented in #631, PTAL.

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

Successfully merging this pull request may close these issues.

2 participants