Skip to content

Commit

Permalink
chore: add proto annotation (#1185)
Browse files Browse the repository at this point in the history
## Description

This PR adds useful proto annotation for upcoming feature
cosmos/cosmos-sdk#13310, which supports the
auto command line tool generation.

- [x] cosmos.AddressString
- [x] cosmos.msg.v1.signer
- [x] amino.name 
- [x] cosmos.msg.v1.service
- [x] amino.dont_omit_empty
- [x] amino.encoding

<!-- Add a description of the changes that this PR introduces and the
files that
are the most critical to review. -->

---

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

- [x] 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
- [x] 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)

---------

Co-authored-by: dadamu <[email protected]>
  • Loading branch information
dadamu and dadamu authored Jul 3, 2023
1 parent 75c2d04 commit 9788688
Show file tree
Hide file tree
Showing 91 changed files with 3,060 additions and 2,135 deletions.
2 changes: 1 addition & 1 deletion client/docs/statik/statik.go

Large diffs are not rendered by default.

74 changes: 37 additions & 37 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4681,11 +4681,8 @@ paths:
treasury:
type: string
title: >-
Represents the account that is associated with the
subspace and

should be used to connect external applications to
verify this subspace
Represents the treasury account that is associated with
the subspace
owner:
type: string
title: Address of the user that owns the subspace
Expand Down Expand Up @@ -4716,7 +4713,9 @@ paths:
signatures required by gogoproto.
title: >-
List of fee token denoms with default minimum gas prices
allowed inside the subspace
allowed inside the

subspace
title: Subspace contains all the data of a Desmos subspace
pagination:
type: object
Expand Down Expand Up @@ -5029,11 +5028,8 @@ paths:
treasury:
type: string
title: >-
Represents the account that is associated with the
subspace and

should be used to connect external applications to verify
this subspace
Represents the treasury account that is associated with
the subspace
owner:
type: string
title: Address of the user that owns the subspace
Expand Down Expand Up @@ -5063,7 +5059,9 @@ paths:
signatures required by gogoproto.
title: >-
List of fee token denoms with default minimum gas prices
allowed inside the subspace
allowed inside the

subspace
title: Subspace contains all the data of a Desmos subspace
title: >-
QuerySubspaceResponse is the response type for the Query/Subspace
Expand Down Expand Up @@ -8585,11 +8583,9 @@ paths:
- Query
/desmos/posts/v3/subspaces/{subspace_id}/post-owner-transfer-requests:
get:
summary: >-
summary: |-
IncomingPostOwnerTransferRequests queries all the post owner transfers
requests that

have been made towards the receiver with the given address
requests that have been made towards the receiver with the given address
operationId: IncomingPostOwnerTransferRequests
responses:
'200':
Expand Down Expand Up @@ -8618,12 +8614,14 @@ paths:
title: Address of the receiver
title: >-
PostOwnerTransferRequest represents a request to transfer
the ownership of a post from the sender to the receiver
the ownership of a

post from the sender to the receiver
title: >-
Requests represent the list of all the post owner transfer
requests made towards
requests made

the receiver
towards the receiver
pagination:
title: Pagination defines the pagination response
type: object
Expand Down Expand Up @@ -19560,9 +19558,7 @@ definitions:
treasury:
type: string
title: >-
Represents the account that is associated with the subspace and

should be used to connect external applications to verify this
Represents the treasury account that is associated with the
subspace
owner:
type: string
Expand Down Expand Up @@ -19593,7 +19589,9 @@ definitions:
signatures required by gogoproto.
title: >-
List of fee token denoms with default minimum gas prices allowed
inside the subspace
inside the

subspace
title: Subspace contains all the data of a Desmos subspace
title: QuerySubspaceResponse is the response type for the Query/Subspace method
desmos.subspaces.v3.QuerySubspacesResponse:
Expand All @@ -19617,9 +19615,7 @@ definitions:
treasury:
type: string
title: >-
Represents the account that is associated with the subspace and

should be used to connect external applications to verify this
Represents the treasury account that is associated with the
subspace
owner:
type: string
Expand Down Expand Up @@ -19650,7 +19646,9 @@ definitions:
signatures required by gogoproto.
title: >-
List of fee token denoms with default minimum gas prices allowed
inside the subspace
inside the

subspace
title: Subspace contains all the data of a Desmos subspace
pagination:
type: object
Expand Down Expand Up @@ -20299,11 +20297,7 @@ definitions:
title: Optional description of this subspace
treasury:
type: string
title: >-
Represents the account that is associated with the subspace and

should be used to connect external applications to verify this
subspace
title: Represents the treasury account that is associated with the subspace
owner:
type: string
title: Address of the user that owns the subspace
Expand All @@ -20330,7 +20324,9 @@ definitions:
signatures required by gogoproto.
title: >-
List of fee token denoms with default minimum gas prices allowed
inside the subspace
inside the

subspace
title: Subspace contains all the data of a Desmos subspace
desmos.subspaces.v3.UserGroup:
type: object
Expand Down Expand Up @@ -20790,7 +20786,9 @@ definitions:
title: Address of the receiver
title: >-
PostOwnerTransferRequest represents a request to transfer the ownership of
a post from the sender to the receiver
a

post from the sender to the receiver
desmos.posts.v3.PostReference:
type: object
properties:
Expand Down Expand Up @@ -20859,12 +20857,14 @@ definitions:
title: Address of the receiver
title: >-
PostOwnerTransferRequest represents a request to transfer the
ownership of a post from the sender to the receiver
ownership of a

post from the sender to the receiver
title: >-
Requests represent the list of all the post owner transfer requests
made towards
made

the receiver
towards the receiver
pagination:
title: Pagination defines the pagination response
type: object
Expand Down
38 changes: 28 additions & 10 deletions proto/desmos/posts/v3/genesis.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";
package desmos.posts.v3;

import "amino/amino.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";

Expand All @@ -14,14 +15,28 @@ message GenesisState {
option (gogoproto.goproto_stringer) = true;

repeated SubspaceDataEntry subspaces_data = 1
[ (gogoproto.nullable) = false ];
repeated PostDataEntry posts_data = 2 [ (gogoproto.nullable) = false ];
repeated Post posts = 3 [ (gogoproto.nullable) = false ];
repeated Attachment attachments = 4 [ (gogoproto.nullable) = false ];
repeated ActivePollData active_polls = 5 [ (gogoproto.nullable) = false ];
repeated UserAnswer user_answers = 6 [ (gogoproto.nullable) = false ];
Params params = 7 [ (gogoproto.nullable) = false ];
repeated PostOwnerTransferRequest post_owner_transfer_requests = 8 [ (gogoproto.nullable) = false ];
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];

repeated PostDataEntry posts_data = 2
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];

repeated Post posts = 3
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];

repeated Attachment attachments = 4
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];

repeated ActivePollData active_polls = 5
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];

repeated UserAnswer user_answers = 6
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];

Params params = 7
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];

repeated PostOwnerTransferRequest post_owner_transfer_requests = 8
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// SubspaceDataEntry contains the data for a given subspace
Expand Down Expand Up @@ -52,6 +67,9 @@ message ActivePollData {
uint64 subspace_id = 1 [ (gogoproto.customname) = "SubspaceID" ];
uint64 post_id = 2 [ (gogoproto.customname) = "PostID" ];
uint32 poll_id = 3 [ (gogoproto.customname) = "PollID" ];
google.protobuf.Timestamp end_date = 4
[ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ];
google.protobuf.Timestamp end_date = 4 [
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true,
(amino.dont_omitempty) = true
];
}
50 changes: 34 additions & 16 deletions proto/desmos/posts/v3/models.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
syntax = "proto3";
package desmos.posts.v3;

import "amino/amino.proto";
import "gogoproto/gogo.proto";
import "google/protobuf/any.proto";
import "google/protobuf/timestamp.proto";
Expand Down Expand Up @@ -45,8 +46,8 @@ message Post {
repeated string tags = 7 [ (gogoproto.moretags) = "yaml:\"tags\"" ];

// Author of the post
string author = 8 [
(gogoproto.moretags) = "yaml:\"author\"",
string author = 8 [
(gogoproto.moretags) = "yaml:\"author\"",
(cosmos_proto.scalar) = "cosmos.AddressString"
];

Expand All @@ -59,7 +60,8 @@ message Post {
// A list this posts references (either as a reply, repost or quote)
repeated PostReference referenced_posts = 10 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"referenced_posts\""
(gogoproto.moretags) = "yaml:\"referenced_posts\"",
(amino.dont_omitempty) = true
];

// Reply settings of this post
Expand All @@ -70,7 +72,8 @@ message Post {
google.protobuf.Timestamp creation_date = 12 [
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true,
(gogoproto.moretags) = "yaml:\"creation_date\""
(gogoproto.moretags) = "yaml:\"creation_date\"",
(amino.dont_omitempty) = true
];

// (optional) Last edited time of the post
Expand Down Expand Up @@ -130,18 +133,23 @@ message Entities {
// Hashtags represent inside the post text
repeated TextTag hashtags = 1 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"hashtags\""
(gogoproto.moretags) = "yaml:\"hashtags\"",
(amino.dont_omitempty) = true
];

// Mentions present inside the post text
repeated TextTag mentions = 2 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"mentions\""
(gogoproto.moretags) = "yaml:\"mentions\"",
(amino.dont_omitempty) = true
];

// Links present inside the post text
repeated Url urls = 3
[ (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"urls\"" ];
repeated Url urls = 3 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"urls\"",
(amino.dont_omitempty) = true
];
}

// ReplySetting contains the possible reply settings that a post can have
Expand Down Expand Up @@ -250,14 +258,16 @@ message Poll {
// Answers the users can choose from
repeated ProvidedAnswer provided_answers = 2 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"provided_answers\""
(gogoproto.moretags) = "yaml:\"provided_answers\"",
(amino.dont_omitempty) = true
];

// Date at which the poll will close
google.protobuf.Timestamp end_date = 3 [
(gogoproto.nullable) = false,
(gogoproto.stdtime) = true,
(gogoproto.moretags) = "yaml:\"end_date\""
(gogoproto.moretags) = "yaml:\"end_date\"",
(amino.dont_omitempty) = true
];

// Whether the poll allows multiple choices from the same user or not
Expand Down Expand Up @@ -312,11 +322,16 @@ message UserAnswer {
];

// Indexes of the answers inside the ProvidedAnswers array
repeated uint32 answers_indexes = 4
[ (gogoproto.moretags) = "yaml:\"answers_indexes\"" ];
repeated uint32 answers_indexes = 4 [
(gogoproto.moretags) = "yaml:\"answers_indexes\"",
(amino.dont_omitempty) = true
];

// Address of the user answering the poll
string user = 5 [ (gogoproto.moretags) = "yaml:\"user\"" ];
string user = 5 [
(gogoproto.moretags) = "yaml:\"user\"",
(cosmos_proto.scalar) = "cosmos.AddressString"
];
}

// PollTallyResults contains the tally results for a poll
Expand All @@ -326,7 +341,8 @@ message PollTallyResults {

repeated AnswerResult results = 1 [
(gogoproto.nullable) = false,
(gogoproto.moretags) = "yaml:\"results\""
(gogoproto.moretags) = "yaml:\"results\"",
(amino.dont_omitempty) = true
];

// AnswerResult contains the result of a single poll provided answer
Expand All @@ -346,13 +362,15 @@ message PollTallyResults {
message Params {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = true;
option (amino.name) = "desmos/x/posts/Params";

// Maximum length of the post text
uint32 max_text_length = 1
[ (gogoproto.moretags) = "yaml:\"max_text_length\"" ];
}

// PostOwnerTransferRequest represents a request to transfer the ownership of a post from the sender to the receiver
// PostOwnerTransferRequest represents a request to transfer the ownership of a
// post from the sender to the receiver
message PostOwnerTransferRequest {
option (gogoproto.equal) = true;
option (gogoproto.goproto_stringer) = true;
Expand All @@ -362,7 +380,7 @@ message PostOwnerTransferRequest {
(gogoproto.customname) = "SubspaceID",
(gogoproto.moretags) = "yaml:\"subspace_id\""
];

// Id of the post which will be transferred
uint64 post_id = 2 [
(gogoproto.customname) = "PostID",
Expand Down
Loading

0 comments on commit 9788688

Please sign in to comment.