Skip to content

Commit

Permalink
Add Swagger documentation for multi-staking module (#133)
Browse files Browse the repository at this point in the history
* add swagger gen for multi-staking module

* update swagger

---------

Co-authored-by: Trinity <[email protected]>
  • Loading branch information
MasterPi-2124 and trinitys7 authored Mar 21, 2024
1 parent c2610c3 commit 9dc08f3
Show file tree
Hide file tree
Showing 5 changed files with 1,888 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

DOCKER := $(shell which docker)
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf:1.0.0-rc8
PROJECT_NAME = $(shell git remote get-url origin | xargs basename -s .git)

###############################################################################
### Protobuf ###
Expand All @@ -10,13 +11,19 @@ DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bu
protoVer=v0.7
protoImageName=tendermintdev/sdk-proto-gen:$(protoVer)
protoImage=$(DOCKER) run --network host --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)
protoGenSwagger=$(PROJECT_NAME)-proto-gen-swagger-$(protoVer)

proto-all: proto-format proto-lint proto-gen

proto-gen:
@echo "Generating Protobuf files"
@$(protoImage) sh ./scripts/protocgen.sh

proto-swagger-gen:
@echo "Generating Protobuf Swagger"
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${protoGenSwagger}$$"; then docker start -a $(protoGenSwagger); else docker run --name $(protoGenSwagger) -v $(CURDIR):/workspaces/multi-staking --workdir /workspaces/multi-staking $(protoImageName) \
sh ./scripts/protoc-swagger-gen.sh; fi

proto-format:
@$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \;

Expand Down
18 changes: 18 additions & 0 deletions docs/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"swagger": "2.0",
"info": {
"title": "Cosmos SDK - gRPC Gateway docs",
"description": "A REST interface for state queries",
"version": "1.0.0"
},
"apis": [
{
"url": "./tmp-swagger-gen/multistaking/v1/query.swagger.json",
"operationIds": {
"rename": {
"Params": "MultiStakingParams"
}
}
}
]
}
Loading

0 comments on commit 9dc08f3

Please sign in to comment.