待测试

This commit is contained in:
2026-07-28 07:58:26 +08:00
parent 1e9e25fe67
commit 6fbcf21024
22 changed files with 1294 additions and 264 deletions
@@ -0,0 +1,57 @@
$ErrorActionPreference = 'Stop'
$root = Split-Path -Parent $PSScriptRoot
$documents = @(Get-ChildItem -LiteralPath $root -File -Filter '*.openapi.json')
if ($documents.Count -ne 1) { throw 'Exactly one current OpenAPI JSON export is required at the repository root' }
$document = Get-Content -Raw -Encoding UTF8 -LiteralPath $documents[0].FullName | ConvertFrom-Json
$operations = @(
foreach ($pathProperty in $document.paths.PSObject.Properties) {
foreach ($methodProperty in $pathProperty.Value.PSObject.Properties) {
if ($methodProperty.Name -in @('get', 'post', 'put', 'delete', 'patch')) {
[PSCustomObject]@{ Path = $pathProperty.Name; Method = $methodProperty.Name }
}
}
}
)
if ($operations.Count -ne 149) { throw "Current OpenAPI operation count drifted: $($operations.Count)" }
function Get-Operation {
param([string]$Path, [string]$Method)
$pathProperty = $document.paths.PSObject.Properties[$Path]
if (-not $pathProperty) { throw "Missing path: $Path" }
$operation = $pathProperty.Value.PSObject.Properties[$Method]
if (-not $operation) { throw "Missing operation: $Method $Path" }
return $operation.Value
}
$videoList = Get-Operation -Path '/genealogy/app/genealogies/{genealogyId}/videos' -Method 'post'
if ($videoList.requestBody.content.'application/json'.schema.'$ref' -ne '#/components/schemas/VideoBody') {
throw 'Video create must consume VideoBody'
}
$videoBody = $document.components.schemas.VideoBody
if ((@($videoBody.required) -join ',') -ne 'videoTitle,videoOssId') {
throw 'VideoBody required fields drifted'
}
if ($videoList.responses.'200'.content.'application/json'.schema) {
throw 'Video create unexpectedly gained a response DTO; review F10 integration'
}
$videoPage = Get-Content -Raw -Encoding UTF8 -LiteralPath (Join-Path $root 'pages/family/f10-video-list.vue')
foreach ($token in @('pickAndUploadVideo', 'appApi.createVideo', 'videoTitle', 'videoOssId: receipt.value.ossId')) {
if (-not $videoPage.Contains($token)) { throw "F10 video publish contract missing: $token" }
}
foreach ($forbidden in @('v-model="form.videoOssId"', 'v-model="form.status"', 'v-model="form.durationSeconds"')) {
if ($videoPage.Contains($forbidden)) { throw "F10 must not expose auto or management field: $forbidden" }
}
foreach ($path in @('/genealogy/app/site/articles', '/genealogy/app/site/pages/{pageKey}')) {
$operation = Get-Operation -Path $path -Method 'get'
if ($operation.responses.'200'.content.'application/json'.schema) {
throw "Site content response DTO changed for $path; review M10 integration"
}
}
$auditDocs = @(Get-ChildItem -LiteralPath (Join-Path $root 'docs') -File -Filter '*149*.md')
if ($auditDocs.Count -lt 1) { throw 'Current 149 operation audit document is missing' }
Write-Output 'CURRENT-OPENAPI-INVENTORY-CONTRACT PASS'