Skip to content

InjectiveLabs/api-exchange-docs

Repository files navigation

Injective API documentation

Injective API documentation page for all endpoints included in the Python and Go SDKs

Before creating a PR

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

Updating the docs for a new Injective chain version

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.

Prerequisites

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

Step 1 — Bump repository versions in the Makefile

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.

Step 2 — Regenerate proto JSON tables and error codes

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 by JSON_TO_HTML_TABLE markdown-autodocs markers inside source/includes/*.md.
  • source/json_tables/errors/*.json — one JSON file per module, generated by injective-core/scripts/docs/document_error_codes_script.go.
  • source/includes/_errors.md — fully regenerated by scripts/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).

Step 3 — Refresh SDK code snippets

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.

Step 4 — Update the changelog

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.F

Include any additional bullet points for notable additions specific to this release (new modules documented, new query types, etc.).

Step 5 — Verify locally

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.

When the upgrade adds new pages or modules

Two less frequent actions may be required:

  • New top-level page: add an entry to the includes: list in source/index.html.md and create the corresponding source/includes/_<name>.md file. 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.go or .proto files, update the processing logic in scripts/generate_proto_json_files.sh to match the new layout. This happened, for example, when namespace-directory support was added to handle modules that do not follow the standard types/ sub-folder convention.

Files expected to change in the PR

Use this as a checklist before pushing:

  • Makefile — version bumps
  • source/json_tables/** — regenerated proto JSON tables
  • source/includes/_errors.md — regenerated error-code page
  • source/includes/*.md — refreshed SDK code snippets and updated parameter tables
  • source/includes/_changelog.md — new dated release entry
  • source/index.html.md — only if a new top-level page was added
  • scripts/generate_proto_json_files.sh — only if the proto directory layout changed in one of the source repositories

About

Injective Protocol Documentation

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Generated from slatedocs/slate