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

chore: add proto annotation #1185

Merged
merged 11 commits into from
Jul 3, 2023
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 ];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cosmos-SDK adds amino annotation inside genesis files as well.
https://github.com/cosmos/cosmos-sdk/blob/ab77fe20d3c00ef4cb73dfd0c803c4593a3c8233/proto/cosmos/bank/v1beta1/genesis.proto#L15

But, I think genesis is not needed to support Amino. What do you think? @RiccardoM

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree it should not be added to the genesis file. However, we can keep it for now as it's only metadata that does not truly affect anything to be honest.


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
Loading