tss-rocks/backend/scripts/bundle-openapi.ps1
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

29 lines
776 B
PowerShell

# Bundle OpenAPI schema files into a single file
$ErrorActionPreference = "Stop"
# Ensure we're in the project root
$projectRoot = Split-Path -Parent $PSScriptRoot
Set-Location $projectRoot
# Create dist directory if it doesn't exist
if (-not (Test-Path "api\dist")) {
New-Item -ItemType Directory -Force -Path "api\dist"
}
# Bundle the OpenAPI files
swagger-cli bundle api/schemas/openapi.yaml --outfile api/dist/openapi.yaml --type yaml
# Check if bundling was successful
if ($LASTEXITCODE -eq 0) {
} else {
Write-Error "Failed to bundle OpenAPI schema"
exit 1
}
# Also create a JSON version for tools that prefer JSON
swagger-cli bundle api/schemas/openapi.yaml --outfile api/dist/openapi.json --type json
if ($LASTEXITCODE -eq 0) {
} else {
exit 1
}