From fde166cda8dec105b958a4f2ba4b5f1a15284b34 Mon Sep 17 00:00:00 2001 From: Benjamin DENEUX Date: Fri, 17 May 2024 10:10:48 +0200 Subject: [PATCH] fix(docs): generate docs with module subfolder on proto --- Makefile | 2 +- docs/proto/vesting.md | 8 ++++---- proto/buf.gen.doc.yml | 2 +- scripts/protocgen-doc.sh | 5 +++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 2a732d6d..5ae635bf 100644 --- a/Makefile +++ b/Makefile @@ -319,7 +319,7 @@ doc: doc-proto doc-command doc-predicate ## Generate all the documentation doc-proto: proto-gen ## Generate the documentation from the Protobuf files @echo "${COLOR_CYAN} 📝 Generating doc from Protobuf files${COLOR_RESET}" @$(DOCKER_PROTO_RUN) sh ./scripts/protocgen-doc.sh - @for MODULE in $(shell find proto -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq | xargs dirname) ; do \ + @for MODULE in $(shell find proto -name '*.proto' -maxdepth 3 -print0 | xargs -0 -n1 dirname | sort | uniq | xargs dirname) ; do \ echo "${COLOR_CYAN} 📖 Generate documentation for $${MODULE} module${COLOR_RESET}" ; \ DEFAULT_DATASOURCE="./docs/proto/templates/default.yaml" ; \ MODULE_DATASOURCE="merge:./$${MODULE}/docs.yaml|$${DEFAULT_DATASOURCE}" ; \ diff --git a/docs/proto/vesting.md b/docs/proto/vesting.md index d428f2b7..ed1c14fd 100644 --- a/docs/proto/vesting.md +++ b/docs/proto/vesting.md @@ -60,7 +60,7 @@ continuously vests by unlocking coins after a cliff period linearly with respect | ----- | ---- | ----- | ----------- | | `base_vesting_account` | [BaseVestingAccount](#vesting.v1beta1.BaseVestingAccount) | | base_vesting_account implements the VestingAccount interface. It contains all the necessary fields needed for any vesting account implementation | | `start_time` | [int64](#int64) | | start_time defines the time at which the vesting period begins | -| `cliff_time` | [int64](#int64) | | | +| `cliff_time` | [int64](#int64) | | cliff_time defines the time at which the first portion of the vesting is unlocked | @@ -94,7 +94,7 @@ Period defines a length of time and amount of coins that will vest. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | -| `length` | [int64](#int64) | | | +| `length` | [int64](#int64) | | Period duration in seconds. | | `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | @@ -150,7 +150,7 @@ account. | `to_address` | [string](#string) | | | | `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | | `end_time` | [int64](#int64) | | | -| `cliff_time` | [int64](#int64) | | | +| `cliff_time` | [int64](#int64) | | cliff time as unix time (in seconds) is the time at which the first portion of the vesting is unlocked. | @@ -218,7 +218,7 @@ account. | `from_address` | [string](#string) | | | | `to_address` | [string](#string) | | | | `amount` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | -| `end_time` | [int64](#int64) | | | +| `end_time` | [int64](#int64) | | end of vesting as unix time (in seconds). | | `delayed` | [bool](#bool) | | | diff --git a/proto/buf.gen.doc.yml b/proto/buf.gen.doc.yml index ec865c62..9dee9f81 100644 --- a/proto/buf.gen.doc.yml +++ b/proto/buf.gen.doc.yml @@ -4,4 +4,4 @@ plugins: - name: doc out: ../docs/proto opt: - - ../docs/proto/templates/protodoc-markdown.tmpl,docs.md + - ../docs/proto/templates/protodoc-markdown.tmpl,docs.md:module/* diff --git a/scripts/protocgen-doc.sh b/scripts/protocgen-doc.sh index 0c254e6b..820b8e67 100755 --- a/scripts/protocgen-doc.sh +++ b/scripts/protocgen-doc.sh @@ -11,7 +11,8 @@ protoc_install_proto_gen_doc echo "Generating proto docs" cd proto -for MODULE in $(find . -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq | xargs -n1 dirname); do +for MODULE in $(find . -name '*.proto' -maxdepth 3 -print0 | xargs -0 -n1 dirname | sort | uniq | xargs -n1 dirname); do + echo "Generating docs for ${MODULE}" buf generate --path "${MODULE}" --template buf.gen.doc.yml -v - mv ../docs/proto/docs.md ../docs/proto/"${MODULE}".md + mv -f ../docs/proto/docs.md ../docs/proto/"${MODULE}".md done