Feat: TrustGraph i18n & Documentation Translation Updates (#781)
Native CLI i18n: The TrustGraph CLI has built-in translation support
that dynamically loads language strings. You can test and use
different languages by simply passing the --lang flag (e.g., --lang
es for Spanish, --lang ru for Russian) or by configuring your
environment's LANG variable.
Automated Docs Translations: This PR introduces autonomously
translated Markdown documentation into several target languages,
including Spanish, Swahili, Portuguese, Turkish, Hindi, Hebrew,
Arabic, Simplified Chinese, and Russian.
2026-04-14 07:07:58 -04:00
|
|
|
---
|
|
|
|
|
layout: default
|
|
|
|
|
title: "Auto-generating docs"
|
|
|
|
|
nav_order: 2
|
|
|
|
|
---
|
2026-01-15 15:12:32 +00:00
|
|
|
|
|
|
|
|
# Auto-generating docs
|
|
|
|
|
|
|
|
|
|
## REST and WebSocket API Documentation
|
|
|
|
|
|
|
|
|
|
- `specs/build-docs.sh` - Builds the REST and websocket documentation from the
|
|
|
|
|
OpenAPI and AsyncAPI specs.
|
|
|
|
|
|
|
|
|
|
## Python API Documentation
|
|
|
|
|
|
|
|
|
|
The Python API documentation is generated from docstrings using a custom Python script that introspects the `trustgraph.api` package.
|
|
|
|
|
|
|
|
|
|
### Prerequisites
|
|
|
|
|
|
|
|
|
|
The trustgraph package must be importable. If you're working in a development environment:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cd trustgraph-base
|
|
|
|
|
pip install -e .
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Generating Documentation
|
|
|
|
|
|
|
|
|
|
From the docs directory:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
cd docs
|
|
|
|
|
python3 generate-api-docs.py > python-api.md
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
This generates a single markdown file with complete API documentation showing:
|
|
|
|
|
- Installation and quick start guide
|
|
|
|
|
- Import statements for each class/type
|
|
|
|
|
- Full docstrings with examples
|
|
|
|
|
- Table of contents organized by category
|
|
|
|
|
|
|
|
|
|
### Documentation Style
|
|
|
|
|
|
|
|
|
|
All docstrings follow Google-style format:
|
|
|
|
|
- Brief one-line summary
|
|
|
|
|
- Detailed description
|
|
|
|
|
- Args section with parameter descriptions
|
|
|
|
|
- Returns section
|
|
|
|
|
- Raises section (when applicable)
|
|
|
|
|
- Example code blocks with proper syntax highlighting
|
|
|
|
|
|
|
|
|
|
The generated documentation shows the public API exactly as users import it from `trustgraph.api`, without exposing internal module structure.
|