待测试
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$root = Split-Path -Parent $PSScriptRoot
|
||||
$json = Get-Content -Raw -Encoding UTF8 -LiteralPath (Join-Path $root 'APP.openapi.json') | ConvertFrom-Json
|
||||
$yaml = Get-Content -Raw -Encoding UTF8 -LiteralPath (Join-Path $root 'APP.openapi.yaml')
|
||||
$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' }
|
||||
$json = Get-Content -Raw -Encoding UTF8 -LiteralPath $documents[0].FullName | ConvertFrom-Json
|
||||
|
||||
$path = '/genealogy/app/feedback'
|
||||
$pathProperty = $json.paths.PSObject.Properties[$path]
|
||||
@@ -33,17 +34,8 @@ foreach ($field in $fields) {
|
||||
throw "FeedbackBody.$field must be a string"
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($yamlFact in @(
|
||||
' /genealogy/app/feedback:',
|
||||
"`$ref: '#/components/schemas/FeedbackBody'",
|
||||
' FeedbackBody:',
|
||||
' - feedbackContent',
|
||||
' feedbackType:',
|
||||
' feedbackContent:',
|
||||
' contactInfo:'
|
||||
)) {
|
||||
if (-not $yaml.Contains($yamlFact)) { throw "Feedback YAML fact is missing: $yamlFact" }
|
||||
if ((@($body.properties.feedbackType.enum) -join ',') -ne 'advice,bug,complaint,other') {
|
||||
throw 'FeedbackBody.feedbackType must use advice,bug,complaint,other'
|
||||
}
|
||||
|
||||
Write-Output 'FEEDBACK-OPENAPI-CONTRACT PASS'
|
||||
|
||||
Reference in New Issue
Block a user