chore: update protoc-gen-swagger to protoc-gen-openapiv2 (#20448)

This commit is contained in:
Paul Chen 2024-05-31 17:58:58 +08:00 committed by GitHub
parent 8364791eb3
commit 6967fbd11e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 6693 additions and 10048 deletions

File diff suppressed because it is too large Load Diff

View File

@ -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

View File

@ -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

View File

@ -4,6 +4,8 @@ package cosmos.app.v1alpha1;
import "google/protobuf/any.proto";
option go_package = "cosmossdk.io/api/app/v1alpha1";
// 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

View File

@ -4,6 +4,8 @@ package cosmos.app.v1alpha1;
import "google/protobuf/descriptor.proto";
option go_package = "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.

View File

@ -4,6 +4,8 @@ package cosmos.app.v1alpha1;
import "cosmos/app/v1alpha1/config.proto";
option go_package = "cosmossdk.io/api/app/v1alpha1";
// Query is the app module query service.
service Query {

View File

@ -7,6 +7,8 @@ import "google/protobuf/duration.proto";
import "google/protobuf/any.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
option go_package = "cosmossdk.io/api/app/cosmos/orm/query/v1alpha1";
// Query is a generic gRPC service for querying ORM data.
service Query {

View File

@ -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' \))