Skip to content

Commit

Permalink
Use Docker to generate swagger files (#9064)
Browse files Browse the repository at this point in the history
* use docker for proto-swagger-gen

fixes #7933

* fix deprecated commands and flags

see https://docs.buf.build/faq/ for detail

* run proto-gen and proto-swagger-gen

* add changelog entry
  • Loading branch information
hallazzang committed Apr 7, 2021
1 parent 29ff333 commit 9b41ba7
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 79 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (types) [\#8962](https://github.com/cosmos/cosmos-sdk/issues/8962) Add `Abs()` method to `sdk.Int`.
* (x/bank) [\#8950](https://github.com/cosmos/cosmos-sdk/pull/8950) Improve efficiency on supply updates.
* (store) [\#8012](https://github.com/cosmos/cosmos-sdk/pull/8012) Implementation of ADR-038 WriteListener and listen.KVStore
* (makefile) [\#7933](https://github.com/cosmos/cosmos-sdk/issues/7933) Use Docker to generate swagger files.

### Bug Fixes

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,13 @@ proto-gen-any:
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protocgen-any.sh

proto-swagger-gen:
@./scripts/protoc-swagger-gen.sh
$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace tendermintdev/sdk-proto-gen sh ./scripts/protoc-swagger-gen.sh

proto-lint:
@$(DOCKER_BUF) check lint --error-format=json
@$(DOCKER_BUF) lint --error-format=json

proto-check-breaking:
@$(DOCKER_BUF) check breaking --against-input $(HTTPS_GIT)#branch=master
@$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=master

TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.34.0-rc6/proto/tendermint
GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos
Expand Down
92 changes: 92 additions & 0 deletions client/docs/swagger-ui/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6265,6 +6265,24 @@ paths:

signatures required by gogoproto.
title: supply is the supply of the coins
pagination:
description: pagination defines the pagination in the response.
type: object
properties:
next_key:
type: string
format: byte
title: |-
next_key is the key to be passed to PageRequest.key to
query the next page most efficiently
total:
type: string
format: uint64
title: >-
total is total number of results available if
PageRequest.count_total

was set, its value is undefined otherwise
title: >-
QueryTotalSupplyResponse is the response type for the
Query/TotalSupply RPC
Expand Down Expand Up @@ -6292,6 +6310,62 @@ paths:
value:
type: string
format: byte
parameters:
- name: pagination.key
description: |-
key is a value returned in PageResponse.next_key to begin
querying the next page most efficiently. Only one of offset or key
should be set.
in: query
required: false
type: string
format: byte
- name: pagination.offset
description: >-
offset is a numeric offset that can be used when key is unavailable.

It is less efficient than using key. Only one of offset or key
should

be set.
in: query
required: false
type: string
format: uint64
- name: pagination.limit
description: >-
limit is the total number of results to be returned in the result
page.

If left empty it will default to a value to be set by each app.
in: query
required: false
type: string
format: uint64
- name: pagination.count_total
description: >-
count_total is set to true to indicate that the result set should
include

a count of the total number of items available for pagination in
UIs.

count_total is only respected when offset is used. It is ignored
when key

is set.
in: query
required: false
type: boolean
format: boolean
- name: pagination.reverse
description: >-
reverse is set to true indicates that, results to be returned in the
descending order.
in: query
required: false
type: boolean
format: boolean
tags:
- Query
'/cosmos/bank/v1beta1/supply/{denom}':
Expand Down Expand Up @@ -24029,6 +24103,24 @@ definitions:
NOTE: The amount field is an Int which implements the custom method
signatures required by gogoproto.
title: supply is the supply of the coins
pagination:
description: pagination defines the pagination in the response.
type: object
properties:
next_key:
type: string
format: byte
title: |-
next_key is the key to be passed to PageRequest.key to
query the next page most efficiently
total:
type: string
format: uint64
title: >-
total is total number of results available if
PageRequest.count_total

was set, its value is undefined otherwise
title: >-
QueryTotalSupplyResponse is the response type for the Query/TotalSupply
RPC
Expand Down
6 changes: 6 additions & 0 deletions contrib/devtools/dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,10 @@ RUN GO111MODULE=on go get \

RUN GO111MODULE=on go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc

RUN apk add --no-cache \
nodejs \
npm

RUN npm install -g swagger-combine

COPY --from=BUILDER /usr/local/bin /usr/local/bin
6 changes: 6 additions & 0 deletions docs/core/proto-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1871,6 +1871,11 @@ QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC
method.


| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | pagination defines an optional pagination for the request. |





Expand All @@ -1885,6 +1890,7 @@ method
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
| `supply` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | supply is the supply of the coins |
| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | pagination defines the pagination in the response. |



Expand Down
Loading

0 comments on commit 9b41ba7

Please sign in to comment.