tss-rocks/backend/scripts/bundle-openapi.sh
CDN 05ddc1f783
Some checks failed
Build Backend / Build Docker Image (push) Successful in 3m33s
Test Backend / test (push) Failing after 31s
[feature] migrate to monorepo
2025-02-21 00:49:20 +08:00

22 lines
635 B
Bash

#!/bin/bash
set -e
# Get the directory where the script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
# Change to project root
cd "$PROJECT_ROOT"
# Create dist directory if it doesn't exist
mkdir -p api/dist
# Bundle the OpenAPI files
echo "Bundling OpenAPI schema to YAML..."
swagger-cli bundle api/schemas/openapi.yaml --outfile api/dist/openapi.yaml --type yaml
# Create JSON version
echo "Creating JSON version..."
swagger-cli bundle api/schemas/openapi.yaml --outfile api/dist/openapi.json --type json
echo "OpenAPI schema bundling complete!"