Skip to content

Commit

Permalink
fix(docs): generate docs with module subfolder on proto
Browse files Browse the repository at this point in the history
  • Loading branch information
bdeneux committed Jun 4, 2024
1 parent c018447 commit fde166c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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}" ; \
Expand Down
8 changes: 4 additions & 4 deletions docs/proto/vesting.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |

<a name="vesting.v1beta1.ContinuousVestingAccount"></a>

Expand Down Expand Up @@ -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 | |

<a name="vesting.v1beta1.PeriodicVestingAccount"></a>
Expand Down Expand Up @@ -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. |

<a name="vesting.v1beta1.MsgCreateCliffVestingAccountResponse"></a>

Expand Down Expand Up @@ -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) | | |

<a name="vesting.v1beta1.MsgCreateVestingAccountResponse"></a>
Expand Down
2 changes: 1 addition & 1 deletion proto/buf.gen.doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/*
5 changes: 3 additions & 2 deletions scripts/protocgen-doc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit fde166c

Please sign in to comment.