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: update protoc-gen-swagger to protoc-gen-openapiv2 #20448

Merged
merged 2 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
23,136 changes: 9,886 additions & 13,250 deletions client/docs/swagger-ui/swagger.yaml

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions contrib/devtools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@ RUN adduser -u $UID -s /bin/sh $UNAME -D
USER $UNAME

ENV GOLANG_PROTOBUF_VERSION=1.28.1 \
GRPC_GATEWAY_VERSION=1.16.0
GRPC_GATEWAY_VERSION=1.16.0 \
GRPC_GATEWAY_PROTOC_GEN_OPENAPIV2_VERSION=2.20.0

RUN go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest && \
go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION} && \
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION} && \
go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} && \
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@v${GRPC_GATEWAY_PROTOC_GEN_OPENAPIV2_VERSION} && \
go install cosmossdk.io/orm/cmd/protoc-gen-go-cosmos-orm@v1.0.0-beta.3 && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

Expand Down
4 changes: 2 additions & 2 deletions proto/buf.gen.swagger.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: v1
plugins:
- name: swagger
- name: openapiv2
out: ../tmp-swagger-gen
opt: logtostderr=true,fqn_for_swagger_name=true,simple_operation_ids=true
opt: logtostderr=true,fqn_for_openapi_name=true,simple_operation_ids=true,json_names_for_fields=false
2 changes: 2 additions & 0 deletions proto/cosmos/app/v1alpha1/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import "google/protobuf/any.proto";

option go_package = "cosmossdk.io/api/app/v1alpha1";

Check failure on line 7 in proto/cosmos/app/v1alpha1/config.proto

View workflow job for this annotation

GitHub Actions / break-check

File option "go_package" changed from "" to "cosmossdk.io/api/app/v1alpha1".
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added this option since grpc-ecosystem/grpc-gateway#2127


// Config represents the configuration for a Cosmos SDK ABCI app.
// It is intended that all state machine logic including the version of
// baseapp and tx handlers (and possibly even Tendermint) that an app needs
Expand Down
2 changes: 2 additions & 0 deletions proto/cosmos/app/v1alpha1/module.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import "google/protobuf/descriptor.proto";

option go_package = "cosmossdk.io/api/app/v1alpha1";

Check failure on line 7 in proto/cosmos/app/v1alpha1/module.proto

View workflow job for this annotation

GitHub Actions / break-check

File option "go_package" changed from "" to "cosmossdk.io/api/app/v1alpha1".

extend google.protobuf.MessageOptions {
// module indicates that this proto type is a config object for an app module
// and optionally provides other descriptive information about the module.
Expand Down
2 changes: 2 additions & 0 deletions proto/cosmos/app/v1alpha1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

import "cosmos/app/v1alpha1/config.proto";

option go_package = "cosmossdk.io/api/app/v1alpha1";

Check failure on line 7 in proto/cosmos/app/v1alpha1/query.proto

View workflow job for this annotation

GitHub Actions / break-check

File option "go_package" changed from "" to "cosmossdk.io/api/app/v1alpha1".

// Query is the app module query service.
service Query {

Expand Down
2 changes: 2 additions & 0 deletions proto/cosmos/orm/query/v1alpha1/query.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import "google/protobuf/any.proto";
import "cosmos/base/query/v1beta1/pagination.proto";

option go_package = "cosmossdk.io/api/app/cosmos/orm/query/v1alpha1";

Check failure on line 10 in proto/cosmos/orm/query/v1alpha1/query.proto

View workflow job for this annotation

GitHub Actions / break-check

File option "go_package" changed from "" to "cosmossdk.io/api/app/cosmos/orm/query/v1alpha1".

// Query is a generic gRPC service for querying ORM data.
service Query {

Expand Down
2 changes: 1 addition & 1 deletion scripts/protoc-swagger-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -eo pipefail

mkdir -p ./tmp-swagger-gen
cd proto
proto_dirs=$(find ./cosmos -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
proto_dirs=$(find ./cosmos ../x -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
for dir in $proto_dirs; do
# generate swagger files (filter query files)
query_file=$(find "${dir}" -maxdepth 1 \( -name 'query.proto' -o -name 'service.proto' \))
Expand Down
Loading