Skip to content

Commit

Permalink
Fix sawgger gen output dir (cosmos#7374)
Browse files Browse the repository at this point in the history
* Fix sawgger gen output dir

* Fix lint

* Update make clean

Co-authored-by: Alessio Treglia <[email protected]>
  • Loading branch information
anilcse and Alessio Treglia authored Sep 23, 2020
1 parent 59c43cd commit a722933
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ distclean: clean
clean:
rm -rf \
$(BUILDDIR)/ \
artifacts/
artifacts/ \
tmp-swagger-gen/

.PHONY: distclean clean

Expand Down
28 changes: 14 additions & 14 deletions client/docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,71 +13,71 @@
}
},
{
"url": "./cosmos/auth/v1beta1/query.swagger.json",
"url": "./tmp-swagger-gen/cosmos/auth/v1beta1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "AuthParams"
}
}
},
{
"url": "./cosmos/bank/v1beta1/query.swagger.json",
"url": "./tmp-swagger-gen/cosmos/bank/v1beta1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "BankParams"
}
}
},
{
"url": "./cosmos/distribution/v1beta1/query.swagger.json",
"url": "./tmp-swagger-gen/cosmos/distribution/v1beta1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "DistributionParams"
}
}
},
{
"url": "./cosmos/evidence/v1beta1/query.swagger.json",
"url": "./tmp-swagger-gen/cosmos/evidence/v1beta1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "EvidenceParams"
}
}
},
{
"url": "./cosmos/gov/v1beta1/query.swagger.json",
"url": "./tmp-swagger-gen/cosmos/gov/v1beta1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "GovParams"
}
}
},
{
"url": "./cosmos/mint/v1beta1/query.swagger.json",
"url": "./tmp-swagger-gen/cosmos/mint/v1beta1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "MintParams"
}
}
},
{
"url": "./cosmos/params/v1beta1/query.swagger.json",
"url": "./tmp-swagger-gen/cosmos/params/v1beta1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "Params"
}
}
},
{
"url": "./cosmos/slashing/v1beta1/query.swagger.json",
"url": "./tmp-swagger-gen/cosmos/slashing/v1beta1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "SlashingParams"
}
}
},
{
"url": "./cosmos/staking/v1beta1/query.swagger.json",
"url": "./tmp-swagger-gen/cosmos/staking/v1beta1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "StakingParams",
Expand All @@ -86,39 +86,39 @@
}
},
{
"url": "./cosmos/upgrade/v1beta1/query.swagger.json",
"url": "./tmp-swagger-gen/cosmos/upgrade/v1beta1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "UpgradeParams"
}
}
},
{
"url": "./ibc/channel/query.swagger.json",
"url": "./tmp-swagger-gen/ibc/channel/query.swagger.json",
"operationIds": {
"rename": {
"Params": "IBCChannelParams"
}
}
},
{
"url": "./ibc/client/query.swagger.json",
"url": "./tmp-swagger-gen/ibc/client/query.swagger.json",
"operationIds": {
"rename": {
"Params": "IBCClientParams"
}
}
},
{
"url": "./ibc/connection/query.swagger.json",
"url": "./tmp-swagger-gen/ibc/connection/query.swagger.json",
"operationIds": {
"rename": {
"Params": "IBCConnectionParams"
}
}
},
{
"url": "./ibc/transfer/query.swagger.json",
"url": "./tmp-swagger-gen/ibc/transfer/query.swagger.json",
"operationIds": {
"rename": {
"Params": "IBCTransferParams"
Expand Down
7 changes: 4 additions & 3 deletions scripts/protoc-swagger-gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

Expand All @@ -12,7 +13,8 @@ for dir in $proto_dirs; do
-I "proto" \
-I "third_party/proto" \
"$query_file" \
--swagger_out=logtostderr=true,stderrthreshold=1000,fqn_for_swagger_name=true,simple_operation_ids=true:.
--swagger_out ./tmp-swagger-gen \
--swagger_opt logtostderr=true --swagger_opt fqn_for_swagger_name=true --swagger_opt simple_operation_ids=true
fi
done

Expand All @@ -22,5 +24,4 @@ done
swagger-combine ./client/docs/config.json -o ./client/docs/swagger-ui/swagger.yaml -f yaml --continueOnConflictingPaths true --includeDefinitions true

# clean swagger files
rm -rf cosmos
rm -rf ibc
rm -rf ./tmp-swagger-gen

0 comments on commit a722933

Please sign in to comment.