-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat: Add proto annotations for Amino JSON #13501
Conversation
I'm putting automerge on, thanks for everyone's reviews here! @ValarDragon would you mind taking another look or lifting your block, for automerge to merge this PR? |
option (cosmos.msg.v1.legacy_amino_name) = "tendermint/PubKeyEd25519"; | ||
// The Amino encoding is simply the inner bytes field, and not the Amino | ||
// encoding of the whole PubKey struct. | ||
// | ||
// Example (JSON): | ||
// s := PubKey{Key: []byte{0x01}} | ||
// out := AminoJSONEncoder(s) | ||
// | ||
// Then we have: | ||
// out == `"MQ=="` | ||
// out != `{"key":"MQ=="}` | ||
option (cosmos.msg.v1.legacy_amino_encoding) = "bytes field"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any ideas what to put instead of bytes field here?
bytes_field
sounds strange. I would use bytes
, base64
, etc...
talked with dev about dismissing this review. Got support
agree, I like |
It's |
I understand the motivation, I don't think
|
Description
Closes: #13407
Goal of this PR
gogoproto.*
annotations at all. They will be removed.Note for reviewers
This is a big PR in terms of line diff, but you only need to review
*.proto
files (~38 files). I also added some comments for (hopefully) easier navigation.There are 4 new annotations, which can be found in
legacy_amino/amino.proto
(jump to file):Addition 1:
legacy_amino.name
e.g. bank MsgSend =>
cosmos.msg.v1.legacy_amino_name = "cosmos-sdk/MsgSend"
Addition 2:
legacy_amino.field_name
anddont_omitempty
(jump to example)These 2 new annotations are used to replace
gogoproto.jsontag
, which is used to:Example: if we have:
Then the algorithm is, when jsontag is the only annotation:
<Y>
legacy_amino.field_name
valuelegacy_amino.dont_omitempty
valueAddition 3:
legacy_amino.encoding
(field option) andmessage_encoding
(message option)For use cases where a field or a whole struct has a custom encoding. (jump to example)
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change