2026-01-15 11:57:16 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
#
|
|
|
|
|
# Build documentation from OpenAPI and AsyncAPI specifications
|
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
|
cd "$SCRIPT_DIR"
|
|
|
|
|
|
|
|
|
|
echo "Building TrustGraph API Documentation..."
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
|
|
# Create output directory
|
|
|
|
|
mkdir -p ../docs
|
|
|
|
|
|
|
|
|
|
# Build REST API documentation
|
|
|
|
|
echo "Building REST API documentation (OpenAPI)..."
|
|
|
|
|
cd api
|
|
|
|
|
npx --yes @redocly/cli build-docs openapi.yaml -o ../../docs/api.html
|
|
|
|
|
echo "✓ REST API docs generated: docs/api.html"
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
|
|
# Build WebSocket API documentation
|
|
|
|
|
echo "Building WebSocket API documentation (AsyncAPI)..."
|
|
|
|
|
cd ../websocket
|
2026-03-17 20:36:31 +00:00
|
|
|
npx --yes -p @asyncapi/cli asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template -o /tmp/asyncapi-build -p singleFile=true --force-write
|
2026-01-15 11:57:16 +00:00
|
|
|
mv /tmp/asyncapi-build/index.html ../../docs/websocket.html
|
|
|
|
|
rm -rf /tmp/asyncapi-build
|
|
|
|
|
echo "✓ WebSocket API docs generated: docs/websocket.html"
|
|
|
|
|
echo
|
|
|
|
|
|
|
|
|
|
cd "$SCRIPT_DIR"
|
|
|
|
|
echo "Documentation build complete!"
|
|
|
|
|
echo
|
|
|
|
|
echo "View documentation:"
|
|
|
|
|
echo " REST API: file://$(realpath ../docs/api.html)"
|
|
|
|
|
echo " WebSocket API: file://$(realpath ../docs/websocket.html)"
|