Injective API documentation page for all endpoints included in the Python and Go SDKs
Before creating a PR you can test the documentation locally by running ./slate.sh serve.
If you want to make sure all the example scripts are updated when running the local server with the documentation, please make sure you execute the script to update all code example snippets.
The code examples are included in the documentation using markdown-autodocs.
To refresh all example snippets you can run make refresh-examples
For the refresh process to run successfully please make sure to install markdown-autodocs in the local environment:
npm i -g markdown-autodocs
The deploy process associated to the push events to the main branch will automatically run the process to update code example snippets before deploying the documentation site (check the deploy workflow configuration in .github/workflows/deploy.yml)
Important Do not modify manually any code snippet between markdown-autodocs markers. Those examples will be modified automatically by the tool. The markers look like this:
The API documentation is generated using Slate
Every chain release requires a set of manual steps before opening a PR. The steps below cover what changed between releases: regenerating protobuf-derived JSON tables, regenerating error-code tables, refreshing SDK code snippets, and recording the release in the changelog.
Make sure the following tools are available in your local environment before running any of the commands below:
| Tool | Purpose |
|---|---|
git |
Cloning source repositories |
go |
Running the error-code generation script inside injective-core |
jq |
Parsing .pb.go files in scripts/generate_proto_json_files.sh |
node + markdown-autodocs (npm i -g markdown-autodocs) |
Refreshing SDK code snippets |
ruby + bundler + middleman |
Building and serving the docs locally |
Open Makefile and update the version variables at the top of the file. Two groups of variables exist:
Chain-side repositories (drive proto JSON table generation and error-code generation):
| Variable | Repository |
|---|---|
COSMOS_SDK_VERSION |
InjectiveLabs/cosmos-sdk |
INJECTIVE_CORE_VERSION |
InjectiveLabs/injective-core |
INDEXER_VERSION |
InjectiveLabs/injective-indexer |
IBC_GO_VERSION |
InjectiveLabs/ibc-go |
COMETBFT_VERSION |
InjectiveLabs/cometbft |
WASMD_VERSION |
InjectiveLabs/wasmd |
SDK repositories (drive SDK code snippet refresh via make refresh-examples):
| Variable | Repository |
|---|---|
PYTHON_SDK_VERSION |
InjectiveLabs/sdk-python |
GO_SDK_VERSION |
InjectiveLabs/sdk-go |
Set each variable to the exact Git tag published in the corresponding repository for the new release.
Run the single command that rebuilds both the protobuf-derived JSON tables and the error-code documentation:
make update-all-proto-related-files
This target clones all six chain-side repositories at the versions pinned in step 1, runs the two generators, then removes the cloned directories. It produces:
source/json_tables/{injective,cosmos,indexer,ibc,cometbft,wasmd}/**/*.json— one JSON file per protobuf message type, consumed byJSON_TO_HTML_TABLEmarkdown-autodocs markers insidesource/includes/*.md.source/json_tables/errors/*.json— one JSON file per module, generated byinjective-core/scripts/docs/document_error_codes_script.go.source/includes/_errors.md— fully regenerated byscripts/generate_errors_md.sh. Do not edit this file manually; every run overwrites it entirely.
If you only need a partial regeneration, use the narrower targets make update-proto-json (proto tables only) or make update-errors-documentation (error codes only).
make refresh-examples
This clones sdk-python and sdk-go at the versions pinned in step 1 into tmp-python-sdk/ and tmp-go-sdk/, then runs markdown-autodocs over all source/includes/*.md files to update every code block enclosed in MARKDOWN-AUTO-DOCS markers.
Important: the deploy workflow (.github/workflows/deploy.yml) automatically re-runs markdown-autodocs on every push to main, but it does not regenerate the proto JSON tables or _errors.md. Those files must be committed as part of the PR.
Add a new dated entry at the top of source/includes/_changelog.md, following the existing pattern:
## YYYY-MM-DD
- Updated all messages to reflect the changes included in the chain version vX.Y.Z, and the Indexer for that chain version
- Python SDK vA.B.C
- Go SDK vD.E.FInclude any additional bullet points for notable additions specific to this release (new modules documented, new query types, etc.).
Build and serve the docs to confirm everything renders correctly before opening a PR:
./slate.sh serve
Navigate through the affected module pages and spot-check that parameter tables (rendered from the updated JSON files) and code snippets (rendered from the updated SDK examples) look correct.
Two less frequent actions may be required:
- New top-level page: add an entry to the
includes:list insource/index.html.mdand create the correspondingsource/includes/_<name>.mdfile. The deploy order in that list controls the navigation order in the rendered site. - New proto directory layout in a repository: if a repository restructures where it keeps
.pb.goor.protofiles, update the processing logic inscripts/generate_proto_json_files.shto match the new layout. This happened, for example, when namespace-directory support was added to handle modules that do not follow the standardtypes/sub-folder convention.
Use this as a checklist before pushing:
Makefile— version bumpssource/json_tables/**— regenerated proto JSON tablessource/includes/_errors.md— regenerated error-code pagesource/includes/*.md— refreshed SDK code snippets and updated parameter tablessource/includes/_changelog.md— new dated release entrysource/index.html.md— only if a new top-level page was addedscripts/generate_proto_json_files.sh— only if the proto directory layout changed in one of the source repositories