mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 16:36:21 +02:00
* AsyncAPI for websocket docs * Delete old docs * Update docs/README.md to point to docs site * Add generated API docs
38 lines
1.1 KiB
Bash
Executable file
38 lines
1.1 KiB
Bash
Executable file
#!/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
|
|
npx --yes -p @asyncapi/cli asyncapi generate fromTemplate asyncapi.yaml @asyncapi/html-template@3.0.0 --use-new-generator -o /tmp/asyncapi-build -p singleFile=true --force-write
|
|
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)"
|