mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 08:15:19 +00:00
5110fea008
* Update third party protos for tendermint, cosmos updates * fix proto gen scripts for go 1.18 * update ibc go swagger for v3.3.0 * update generated files * update swagger * update grpc and protobuf deps
28 lines
989 B
Bash
Executable File
28 lines
989 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -eo pipefail
|
|
|
|
mkdir -p ./tmp-swagger-gen
|
|
proto_dirs=$(find ./proto -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' \))
|
|
if [[ ! -z "$query_file" ]]; then
|
|
buf alpha protoc \
|
|
-I "proto" \
|
|
-I "third_party/proto" \
|
|
"$query_file" \
|
|
--swagger_out=./tmp-swagger-gen \
|
|
--swagger_opt=logtostderr=true --swagger_opt=fqn_for_swagger_name=true --swagger_opt=simple_operation_ids=true
|
|
fi
|
|
done
|
|
|
|
# combine swagger files
|
|
# uses nodejs package `swagger-combine`.
|
|
# all the individual swagger files need to be configured in `config.json` for merging
|
|
swagger-combine ./client/docs/config.json -o ./client/docs/swagger-ui/swagger.yaml -f yaml --continueOnConflictingPaths true --includeDefinitions true
|
|
|
|
# clean swagger files
|
|
rm -rf ./tmp-swagger-gen
|