-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Add swagger for gRPC REST #7075
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
3913bd2
swagger gen command added
atheeshp 2bbfd2e
proto file changed
atheeshp a13bffa
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
atheeshp 1bcdd34
Add filter for swagger files
anilcse 355fb1c
Remove loop
anilcse 60de7ac
Add go-swagger installation
anilcse e7ee599
Add swagger mixer command
anilcse 4108303
add swagger options
anilcse c1ce287
remove files
anilcse 4932f48
Fix swagger-combine
anilcse 7babacc
Fix description
anilcse 73a3078
remove unnecessary config option
anilcse 148bce9
remove go-swagger dependency
anilcse 0491866
refactor
anilcse eeeca44
Add proto-gen-swagger installation tool
anilcse a9b42cb
Merge branch 'master' of github.com:cosmos/cosmos-sdk into atheesh/59…
anilcse 40d1eee
fix tool
anilcse 3fe9a20
refactor
anilcse 747e615
don't push individual swagger files to repo
anilcse 7ced203
refactor
anilcse e1fcaaa
Fix doc
anilcse e951e6d
move proto-swagger-gen to a separate target
anilcse 92d925a
Merge branch 'master' into atheesh/5921-swagger-gen
anilcse 81e6289
Fix permissions
anilcse b219a4c
Merge branch 'master' into atheesh/5921-swagger-gen
anilcse e5f8ab9
Add ibc swagger gen
anilcse 4518e3b
Merge branch 'atheesh/5921-swagger-gen' of github.com:cosmos/cosmos-s…
anilcse 3f1b6d1
Update swagger generation doc
anilcse 9461dd3
cleanup
anilcse 05512e2
gofmt
anilcse 41d8baf
refactor
anilcse 1b77732
Merge branch 'master' into atheesh/5921-swagger-gen
anilcse 6c63a04
Merge branch 'master' into atheesh/5921-swagger-gen
anilcse c26067d
update Makefile
fedekunze File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
{ | ||
"swagger": "2.0", | ||
"info": { | ||
"title": "Cosmos SDK - GRPC Gateway", | ||
"version": "1.0.0" | ||
}, | ||
"apis": [ | ||
{ | ||
"url": "./cosmos/auth/v1beta1/query.swagger.json", | ||
"operationIds": { | ||
"rename": { | ||
"Params": "AuthParams" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "./cosmos/bank/v1beta1/query.swagger.json", | ||
"operationIds": { | ||
"rename": { | ||
"Params": "BankParams" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "./cosmos/distribution/v1beta1/query.swagger.json", | ||
"operationIds": { | ||
"rename": { | ||
"Params": "DistributionParams" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "./cosmos/evidence/v1beta1/query.swagger.json", | ||
"operationIds": { | ||
"rename": { | ||
"Params": "EvidenceParams" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "./cosmos/gov/v1beta1/query.swagger.json", | ||
"operationIds": { | ||
"rename": { | ||
"Params": "GovParams" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "./cosmos/mint/v1beta1/query.swagger.json", | ||
"operationIds": { | ||
"rename": { | ||
"Params": "MintParams" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "./cosmos/params/v1beta1/query.swagger.json", | ||
"operationIds": { | ||
"rename": { | ||
"Params": "Params" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "./cosmos/slashing/v1beta1/query.swagger.json", | ||
"operationIds": { | ||
"rename": { | ||
"Params": "SlashingParams" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "./cosmos/staking/v1beta1/query.swagger.json", | ||
"operationIds": { | ||
"rename": { | ||
"Params": "StakingParams", | ||
"DelegatorValidators": "StakingDelegatorValidators" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "./cosmos/upgrade/v1beta1/query.swagger.json", | ||
anilcse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"operationIds": { | ||
"rename": { | ||
"Params": "UpgradeParams" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "./ibc/channel/query.swagger.json", | ||
"operationIds": { | ||
"rename": { | ||
"Params": "IBCChannelParams" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "./ibc/client/query.swagger.json", | ||
"operationIds": { | ||
"rename": { | ||
"Params": "IBCClientParams" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "./ibc/connection/query.swagger.json", | ||
"operationIds": { | ||
"rename": { | ||
"Params": "IBCConnectionParams" | ||
} | ||
} | ||
}, | ||
{ | ||
"url": "./ibc/transfer/query.swagger.json", | ||
"operationIds": { | ||
"rename": { | ||
"Params": "IBCTransferParams" | ||
} | ||
} | ||
} | ||
] | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
anilcse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
set -eo pipefail | ||
|
||
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') | ||
if [[ ! -z "$query_file" ]]; then | ||
protoc \ | ||
-I "proto" \ | ||
-I "third_party/proto" \ | ||
"$query_file" \ | ||
--swagger_out=logtostderr=true,stderrthreshold=1000,fqn_for_swagger_name=true,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/grpc-gateway/config.json -o ./client/grpc-gateway/swagger.json --continueOnConflictingPaths true --includeDefinitions true | ||
anilcse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# clean swagger files | ||
find ./ -name 'query.swagger.json' -exec rm {} \; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i'm not mistaken, there's a new version 3, rebranded to OpenAPI. Why don't we use v3 instead? Maybe the merging issue will not even be relevant anymore.
Edit: that's why grpc-ecosystem/grpc-gateway#441. Keeping this comment for an FYI.