proxy-pool/scripts/verify-openapi.ps1

22 lines
657 B
PowerShell

param(
[string]$Npx = ""
)
$ErrorActionPreference = "Stop"
$repositoryRoot = Split-Path -Parent $PSScriptRoot
if ([string]::IsNullOrWhiteSpace($Npx)) {
$Npx = (Get-Command npx -ErrorAction Stop).Source
}
$npxCommand = Get-Command $Npx -ErrorAction Stop
$configuration = Join-Path $repositoryRoot "api/openapi/redocly.yaml"
$documents = @(
(Join-Path $repositoryRoot "api/openapi/proxy-pool.yaml"),
(Join-Path $repositoryRoot "api/openapi/admin.yaml")
)
& $npxCommand.Source --yes "@redocly/cli@2.25.4" lint --config $configuration @documents
if ($LASTEXITCODE -ne 0) {
throw "OpenAPI validation failed with exit code $LASTEXITCODE"
}