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

feat(cosmos_proto): add annotation to denote version #133

Merged
merged 5 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions buf.work.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: v1
directories:
- testpb
- proto
168 changes: 122 additions & 46 deletions cosmos.pb.go

Large diffs are not rendered by default.

17 changes: 16 additions & 1 deletion proto/cosmos_proto/cosmos.proto
Copy link
Member Author

@julienrbrt julienrbrt Feb 16, 2024

Choose a reason for hiding this comment

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

I'll be pushing this to https://buf.build/cosmos/cosmos-proto once this PR is merged and tag a new cosmos-proto

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ import "google/protobuf/descriptor.proto";

option go_package = "github.com/cosmos/cosmos-proto;cosmos_proto";

extend google.protobuf.MethodOptions {

// method_added_since is used to indicate the version at which a method was added.
string method_added_since = 93001;
}

extend google.protobuf.MessageOptions {

// implements_interface is used to indicate the type name of the interface
Expand All @@ -13,6 +19,9 @@ extend google.protobuf.MessageOptions {
// interfaces. Interfaces should be declared using a declare_interface
// file option.
repeated string implements_interface = 93001;

// message_added_since is used to indicate the version at which a message was added.
string message_added_since = 93002;
}

extend google.protobuf.FieldOptions {
Expand All @@ -27,6 +36,9 @@ extend google.protobuf.FieldOptions {
// generators may choose to use this information to map this field to a
// language-specific type representing the scalar.
string scalar = 93002;

// field_added_since is used to indicate the version at which a field was added.
string field_added_since = 93003;
}

extend google.protobuf.FileOptions {
Expand All @@ -46,6 +58,9 @@ extend google.protobuf.FileOptions {
// expected that the declaration will be found in a protobuf file named
// a/b/scalars.proto in the file descriptor set.
repeated ScalarDescriptor declare_scalar = 793022;

// file_added_since is used to indicate the version at which a file was added.
string file_added_since = 793023;
}

// InterfaceDescriptor describes an interface type to be used with
Expand Down Expand Up @@ -94,4 +109,4 @@ enum ScalarType {
SCALAR_TYPE_UNSPECIFIED = 0;
SCALAR_TYPE_STRING = 1;
SCALAR_TYPE_BYTES = 2;
}
}
julienrbrt marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion testpb/1.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
syntax="proto3";

import "testpb/2.proto";
import "2.proto";

option go_package = "github.com/cosmos/cosmos-proto/testpb";

Expand Down
199 changes: 100 additions & 99 deletions testpb/1.pulsar.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions testpb/2.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
syntax="proto3";

option go_package = "github.com/cosmos/cosmos-proto/testpb";

message ImportedMessage {
Expand Down
72 changes: 36 additions & 36 deletions testpb/2.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions testpb/3.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
syntax="proto3";

import "cosmos_proto/cosmos.proto";

option go_package = "github.com/cosmos/cosmos-proto/testpb";

// Query defines the gRPC querier service.
service Query {
// CounterQuery queries a counter.
rpc CounterQuery(QueryCounter) returns (CounterQueryResponse) {
option (cosmos_proto.method_added_since) = "v1.0.1";
}
}

// QueryCounter defines the request type used to query the counter.
message QueryCounter {}

// CounterQueryResponse defines the response type for querying the counter.
message CounterQueryResponse {
uint64 counter = 1 [(cosmos_proto.field_added_since) = "v1.0.1"];
}
Loading