Skip to content

Commit

Permalink
feat: ADR-011: Remove custom jsontags from proto files (#655)
Browse files Browse the repository at this point in the history
## Description

This PR implements ADR 011.

---

### 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...

- [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://docs.cosmos.network/v0.44/building-modules/intro.html)
- [ ] included the necessary unit and integration [tests](https://github.com/desmos-labs/desmos/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### 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...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
  • Loading branch information
leobragaz authored Oct 19, 2021
1 parent 10cb3ac commit 6ffb714
Show file tree
Hide file tree
Showing 27 changed files with 567 additions and 617 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: feat
module: none
pull_request: 649
description: removed custom json tags from proto files
backward_compatible: true
date: 2021-10-19T11:12:18.310967Z
22 changes: 5 additions & 17 deletions proto/desmos/posts/v1beta1/msgs.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,12 @@ message MsgCreatePost {

string parent_id = 1 [
(gogoproto.customname) = "ParentID",
(gogoproto.moretags) = "yaml:\"parent_id\"",
(gogoproto.jsontag) = "parent_id"
(gogoproto.moretags) = "yaml:\"parent_id\""
];

string message = 2 [ (gogoproto.moretags) = "yaml:\"message\"" ];

CommentsState comments_state = 3 [
(gogoproto.jsontag) = "comments_state",
(gogoproto.moretags) = "yaml:\"comments_state\""
];

Expand All @@ -70,7 +68,6 @@ message MsgCreatePost {
];

desmos.posts.v1beta1.Poll poll = 8 [
(gogoproto.jsontag) = "poll,omitempty",
(gogoproto.moretags) = "yaml:\"poll,omitempty\""
];
}
Expand All @@ -87,14 +84,12 @@ message MsgEditPost {

string post_id = 1 [
(gogoproto.customname) = "PostID",
(gogoproto.moretags) = "yaml:\"post_id\"",
(gogoproto.jsontag) = "post_id"
(gogoproto.moretags) = "yaml:\"post_id\""
];

string message = 2 [ (gogoproto.moretags) = "yaml:\"message\"" ];

CommentsState comments_state = 3 [
(gogoproto.jsontag) = "comments_state",
(gogoproto.moretags) = "yaml:\"comments_state\""
];

Expand All @@ -105,7 +100,6 @@ message MsgEditPost {
];

desmos.posts.v1beta1.Poll poll = 5 [
(gogoproto.jsontag) = "poll,omitempty",
(gogoproto.moretags) = "yaml:\"poll,omitempty\""
];

Expand All @@ -125,8 +119,7 @@ message MsgAddPostReaction {

string post_id = 1 [
(gogoproto.customname) = "PostID",
(gogoproto.moretags) = "yaml:\"post_id\"",
(gogoproto.jsontag) = "post_id"
(gogoproto.moretags) = "yaml:\"post_id\""
];

string reaction = 2 [ (gogoproto.moretags) = "yaml:\"reaction\"" ];
Expand All @@ -147,8 +140,7 @@ message MsgRemovePostReaction {

string post_id = 1 [
(gogoproto.customname) = "PostID",
(gogoproto.moretags) = "yaml:\"post_id\"",
(gogoproto.jsontag) = "post_id"
(gogoproto.moretags) = "yaml:\"post_id\""
];

string reaction = 2 [ (gogoproto.moretags) = "yaml:\"reaction\"" ];
Expand All @@ -169,12 +161,10 @@ message MsgAnswerPoll {

string post_id = 1 [
(gogoproto.customname) = "PostID",
(gogoproto.moretags) = "yaml:\"post_id\"",
(gogoproto.jsontag) = "post_id"
(gogoproto.moretags) = "yaml:\"post_id\""
];

repeated string answers = 2 [
(gogoproto.jsontag) = "answers",
(gogoproto.moretags) = "yaml:\"answers\""
];

Expand All @@ -193,7 +183,6 @@ message MsgRegisterReaction {
option (gogoproto.goproto_getters) = false;

string short_code = 1 [
(gogoproto.jsontag) = "short_code",
(gogoproto.moretags) = "yaml:\"short_code\""
];

Expand All @@ -216,7 +205,6 @@ message MsgReportPost {

string post_id = 1 [
(gogoproto.customname) = "PostID",
(gogoproto.jsontag) = "post_id",
(gogoproto.moretags) = "yaml:\"post_id\""
];

Expand Down
9 changes: 3 additions & 6 deletions proto/desmos/posts/v1beta1/polls.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ message ProvidedAnswer {

string id = 1 [
(gogoproto.customname) = "ID",
(gogoproto.jsontag) = "id",
(gogoproto.moretags) = "yaml:\"id\""
];

string text = 2
[ (gogoproto.jsontag) = "text", (gogoproto.moretags) = "yaml:\"text\"" ];
string text = 2 [
(gogoproto.moretags) = "yaml:\"text\""
];
}

// ___________________________________________________________________________________________________________________
Expand All @@ -40,17 +40,14 @@ message Poll {
google.protobuf.Timestamp end_date = 3 [
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true,
(gogoproto.jsontag) = "end_date",
(gogoproto.moretags) = "yaml:\"end_date\""
];

bool allows_multiple_answers = 4 [
(gogoproto.jsontag) = "allows_multiple_answers",
(gogoproto.moretags) = "yaml:\"allows_multiple_answers\""
];

bool allows_answer_edits = 5 [
(gogoproto.jsontag) = "allows_answer_edits",
(gogoproto.moretags) = "yaml:\"allows_answer_edits\""
];
}
Expand Down
8 changes: 2 additions & 6 deletions proto/desmos/posts/v1beta1/posts.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@ message Post {

string post_id = 1 [
(gogoproto.customname) = "PostID",
(gogoproto.jsontag) = "post_id",
(gogoproto.moretags) = "yaml:\"id\""
];

string parent_id = 2 [
(gogoproto.customname) = "ParentID",
(gogoproto.jsontag) = "parent_id",
(gogoproto.moretags) = "yaml:\"parent_id\""
];

Expand All @@ -39,8 +37,7 @@ message Post {
];

CommentsState comments_state = 6 [
(gogoproto.moretags) = "yaml:\"comments_state\"",
(gogoproto.jsontag) = "comments_state"
(gogoproto.moretags) = "yaml:\"comments_state\""
];

string subspace = 7 [ (gogoproto.moretags) = "yaml:\"subspace\"" ];
Expand All @@ -56,6 +53,7 @@ message Post {
repeated Attachment attachments = 10 [
(gogoproto.castrepeated) = "Attachments",
(gogoproto.nullable) = false,
(gogoproto.jsontag) = "attachments,omitempty",
(gogoproto.moretags) = "yaml:\"attachments,omitempty\""
];

Expand Down Expand Up @@ -93,13 +91,11 @@ message Attachment {

string uri = 1 [
(gogoproto.customname) = "URI",
(gogoproto.jsontag) = "uri",
(gogoproto.moretags) = "yaml:\"uri\""
];

string mime_type = 2 [
(gogoproto.customname) = "MimeType",
(gogoproto.jsontag) = "mime_type",
(gogoproto.moretags) = "yaml:\"mime_type\""
];

Expand Down
7 changes: 3 additions & 4 deletions proto/desmos/posts/v1beta1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ message QueryPostRequest {
option (gogoproto.equal) = false;
option (gogoproto.goproto_getters) = false;

string post_id = 1
[ (gogoproto.jsontag) = "post_id", (gogoproto.moretags) = "yaml:\"id\"" ];
string post_id = 1 [
(gogoproto.moretags) = "yaml:\"id\""
];
}

// QueryPostResponse is the response type for the Query/Post RPC method
Expand All @@ -106,7 +107,6 @@ message QueryUserAnswersRequest {
option (gogoproto.goproto_getters) = false;

string post_id = 1 [
(gogoproto.jsontag) = "post_id",
(gogoproto.moretags) = "yaml:\"post_id\""
];

Expand Down Expand Up @@ -181,7 +181,6 @@ message QueryReportsResponse {
// method.
message QueryPostReactionsRequest {
string post_id = 1 [
(gogoproto.jsontag) = "post_id",
(gogoproto.moretags) = "yaml:\"post_id\""
];

Expand Down
7 changes: 2 additions & 5 deletions proto/desmos/posts/v1beta1/reactions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ message RegisteredReaction {
option (gogoproto.goproto_stringer) = true;

string short_code = 1 [
(gogoproto.moretags) = "yaml:\"short_code\"",
(gogoproto.jsontag) = "short_code"
(gogoproto.moretags) = "yaml:\"short_code\""
];

string value = 2 [ (gogoproto.moretags) = "yaml:\"value\"" ];
Expand All @@ -32,13 +31,11 @@ message PostReaction {

string post_id = 1 [
(gogoproto.customname) = "PostID",
(gogoproto.jsontag) = "post_id",
(gogoproto.moretags) = "yaml:\"post_id\""
];

string short_code = 2 [
(gogoproto.moretags) = "yaml:\"short_code\"",
(gogoproto.jsontag) = "short_code"
(gogoproto.moretags) = "yaml:\"short_code\""
];

string value = 3 [ (gogoproto.moretags) = "yaml:\"value\"" ];
Expand Down
12 changes: 6 additions & 6 deletions proto/desmos/posts/v1beta1/report.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ message Report {
// ID of the post for which the report has been created
string post_id = 1 [
(gogoproto.customname) = "PostID",
(gogoproto.jsontag) = "post_id",
(gogoproto.moretags) = "yaml:\"post_id\""
];

// Identifies the type of the reports
string type = 2
[ (gogoproto.jsontag) = "type", (gogoproto.moretags) = "yaml:\"type\"" ];
string type = 2 [
(gogoproto.moretags) = "yaml:\"type\""
];

// User message
string message = 3 [
(gogoproto.jsontag) = "message",
(gogoproto.moretags) = "yaml:\"message\""
];

// Identifies the reporting user
string user = 4
[ (gogoproto.jsontag) = "user", (gogoproto.moretags) = "yaml:\"user\"" ];
string user = 4 [
(gogoproto.moretags) = "yaml:\"user\""
];
}

// Reports wraps a list of Report objects
Expand Down
1 change: 0 additions & 1 deletion proto/desmos/profiles/v1beta1/models_profile.proto
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ message Profile {
google.protobuf.Timestamp creation_date = 6 [
(gogoproto.stdtime) = true,
(gogoproto.moretags) = "yaml:\"creation_date\"",
(gogoproto.jsontag) = "creation_date",
(gogoproto.nullable) = false
];
}
Expand Down
1 change: 0 additions & 1 deletion proto/desmos/profiles/v1beta1/msgs_dtag_requests.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ message MsgAcceptDTagTransferRequest {
// NewDTag represents the DTag that the request receiver will obtain if they
// accept the request
string new_dtag = 1 [
(gogoproto.jsontag) = "new_dtag",
(gogoproto.moretags) = "yaml:\"new_dtag\"",
(gogoproto.customname) = "NewDTag"
];
Expand Down
2 changes: 0 additions & 2 deletions proto/desmos/profiles/v1beta1/msgs_profile.proto
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ message MsgSaveProfile {
string bio = 3 [ (gogoproto.moretags) = "yaml:\"bio\"" ];

string profile_picture = 4 [
(gogoproto.jsontag) = "profile_picture",
(gogoproto.moretags) = "yaml:\"profile_picture\""
];

string cover_picture = 5 [
(gogoproto.jsontag) = "cover_picture",
(gogoproto.moretags) = "yaml:\"cover_picture\""
];

Expand Down
20 changes: 5 additions & 15 deletions proto/desmos/subspaces/v1beta1/msgs.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,13 @@ message MsgCreateSubspace {

string id = 1 [
(gogoproto.customname) = "SubspaceID",
(gogoproto.jsontag) = "subspace_id",
(gogoproto.moretags) = "yaml:\"subspace_id\""
];

string name = 2 [ (gogoproto.moretags) = "yaml:\"name\"" ];

SubspaceType subspace_type = 3 [
(gogoproto.moretags) = "yaml:\"subspace_type\"",
(gogoproto.jsontag) = "type"
(gogoproto.moretags) = "yaml:\"subspace_type\""
];

string creator = 4 [ (gogoproto.moretags) = "yaml:\"creator\"" ];
Expand All @@ -70,21 +68,19 @@ message MsgEditSubspace {

string id = 1 [
(gogoproto.customname) = "ID",
(gogoproto.jsontag) = "subspace_id",
(gogoproto.moretags) = "yaml:\"subspace_id\""
];

string owner = 2 [
(gogoproto.jsontag) = "owner",
(gogoproto.moretags) = "yaml:\"owner\""
];

string name = 3
[ (gogoproto.jsontag) = "name", (gogoproto.moretags) = "yaml:\"name\"" ];
string name = 3 [
(gogoproto.moretags) = "yaml:\"name\""
];

SubspaceType subspace_type = 4 [
(gogoproto.moretags) = "yaml:\"subspace_type\"",
(gogoproto.jsontag) = "type"
(gogoproto.moretags) = "yaml:\"subspace_type\""
];

string editor = 5 [ (gogoproto.moretags) = "yaml:\"editor\"" ];
Expand All @@ -103,7 +99,6 @@ message MsgAddAdmin {

string subspace_id = 1 [
(gogoproto.customname) = "SubspaceID",
(gogoproto.jsontag) = "subspace_id",
(gogoproto.moretags) = "yaml:\"subspace_id\""
];

Expand All @@ -124,7 +119,6 @@ message MsgRemoveAdmin {

string subspace_id = 1 [
(gogoproto.customname) = "SubspaceID",
(gogoproto.jsontag) = "subspace_id",
(gogoproto.moretags) = "yaml:\"subspace_id\""
];

Expand All @@ -145,7 +139,6 @@ message MsgRegisterUser {

string subspace_id = 1 [
(gogoproto.customname) = "SubspaceID",
(gogoproto.jsontag) = "subspace_id",
(gogoproto.moretags) = "yaml:\"subspace_id\""
];
string user = 2 [ (gogoproto.moretags) = "yaml:\"user\"" ];
Expand All @@ -165,7 +158,6 @@ message MsgUnregisterUser {

string subspace_id = 1 [
(gogoproto.customname) = "SubspaceID",
(gogoproto.jsontag) = "subspace_id",
(gogoproto.moretags) = "yaml:\"subspace_id\""
];
string user = 2 [ (gogoproto.moretags) = "yaml:\"user\"" ];
Expand All @@ -185,7 +177,6 @@ message MsgBanUser {

string subspace_id = 1 [
(gogoproto.customname) = "SubspaceID",
(gogoproto.jsontag) = "subspace_id",
(gogoproto.moretags) = "yaml:\"subspace_id\""
];
string user = 2 [ (gogoproto.moretags) = "yaml:\"user\"" ];
Expand All @@ -205,7 +196,6 @@ message MsgUnbanUser {

string subspace_id = 1 [
(gogoproto.customname) = "SubspaceID",
(gogoproto.jsontag) = "subspace_id",
(gogoproto.moretags) = "yaml:\"subspace_id\""
];
string user = 2 [ (gogoproto.moretags) = "yaml:\"user\"" ];
Expand Down
Loading

0 comments on commit 6ffb714

Please sign in to comment.