Files
jiapuapp/tests/g03-bootstrap-openapi-contract.ps1
T
2026-07-24 07:56:33 +08:00

33 lines
1.3 KiB
PowerShell

$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$snapshotPath = Join-Path $root 'APP.openapi.json'
$issues = New-Object System.Collections.Generic.List[string]
if (-not (Test-Path -LiteralPath $snapshotPath -PathType Leaf)) {
$issues.Add('missing protected OpenAPI snapshot')
} else {
$snapshot = Get-Content -Raw -Encoding UTF8 -LiteralPath $snapshotPath | ConvertFrom-Json
$paths = $snapshot.paths.PSObject.Properties.Name
if ('/genealogy/region/search' -notin $paths) {
$issues.Add('protected snapshot does not contain the Apifox APP directory owner GET /genealogy/region/search')
}
foreach ($unsupportedPath in @(
'/genealogy/app/region/search',
'/genealogy/app/genealogy-bootstrap-operations/{operationKey}'
)) {
if ($unsupportedPath -in $paths) {
$issues.Add("protected snapshot retains an unsupported G03 owner: $unsupportedPath")
}
}
}
if ($issues.Count -gt 0) {
Write-Output 'G03-BOOTSTRAP-OPENAPI-CONTRACT BLOCKED'
foreach ($issue in $issues) { Write-Output "- $issue" }
Write-Output '- Apifox is the current business owner; the protected snapshot is supplementary only and cannot authorize an atomic bootstrap or result-query implementation.'
exit 1
}
Write-Output 'G03-BOOTSTRAP-OPENAPI-CONTRACT PASS'