Skip to content
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
72b29f3
Update swagger_validation.yml
taylor-hazlett Dec 28, 2021
ae80b4f
Create apiProperties_validator.yml
taylor-hazlett Dec 29, 2021
32fbd57
Update swagger_validation.yml
taylor-hazlett Dec 29, 2021
53e6f2b
Update apiProperties_validator.yml
taylor-hazlett Jan 5, 2022
4134e59
Update apiProperties_validator.yml
taylor-hazlett Jan 5, 2022
b670d2a
Update apiProperties_validator.yml
taylor-hazlett Jan 7, 2022
ecda779
Update apiProperties_validator.yml
taylor-hazlett Feb 8, 2022
d21efa6
Update apiProperties_validator.yml
taylor-hazlett Feb 8, 2022
56b180f
Update apiProperties_validator.yml
taylor-hazlett Feb 11, 2022
1a664fc
Update apiProperties_validator.yml
taylor-hazlett Feb 11, 2022
39c1d6c
Update apiProperties_validator.yml
taylor-hazlett Feb 11, 2022
f70e733
Update apiProperties_validator.yml
taylor-hazlett Feb 11, 2022
57dcbc4
Update apiProperties_validator.yml
taylor-hazlett Feb 11, 2022
884d5f9
Update apiProperties_validator.yml
taylor-hazlett Feb 11, 2022
8bd0a2b
Update apiProperties_validator.yml
taylor-hazlett Feb 11, 2022
496fe93
Update apiProperties_validator.yml
taylor-hazlett Feb 11, 2022
0b4b3b3
Update apiProperties_validator.yml
taylor-hazlett Feb 11, 2022
30e8579
Update apiProperties_validator.yml
taylor-hazlett Feb 11, 2022
3a01ad9
Update apiProperties_validator.yml
taylor-hazlett Feb 11, 2022
94c84cc
Update apiProperties_validator.yml
taylor-hazlett Feb 11, 2022
b1d91e9
Update apiProperties_validator.yml
taylor-hazlett Feb 11, 2022
3f1b198
Update apiProperties_validator.yml
taylor-hazlett Feb 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .pipelines/apiProperties_validator.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@

pool:
vmImage: "ubuntu-latest"

steps:
- pwsh:
$errorsTotal = 0
$warningsTotal = 0

# Get the list of files for the given PR
$currentLocation = Get-Location
$files = git diff HEAD~1 --name-only
$apiPropertiesFiles = $files | where {$_ -match '.+?apiProperties.json$'}

$Headers = @{
Authorization = $env:token
}

$suppressWarnings = false

foreach ($file in $apiPropertiesFiles) {

$newFileContent = Get-Content $file -Raw

# Validate apiProperties json
$apiPropertiesValidatorUri = "$($env:apiPropertiesValidator)&suppressWarnings=$suppressWarnings"
$results = Invoke-RestMethod -Uri $apiPropertiesValidatorUri -Headers $Headers -Method Post -ContentType "application/json; charset=utf-8" -Body @($newFileContent)

$errors = $results | Where-Object { $_.level -EQ "Critical" -OR $_.Level -EQ "Error" }
$warnings = $results | Where-Object { $_.level -EQ "Warning" }

if ($errors) {
$errorsTotal += $errors.Count
$errors | foreach { Write-Host "##vso[task.logissue type=error;]$_" }
} # If Api Properties Error

if ($warnings -AND -NOT $suppressWarnings) {
$warningsTotal += $warnings.Count
$warnings | foreach { Write-Host "##vso[task.logissue type=warning;sourcepath=$file;]$_" }
} # If Api Properties Warnings

} # For each file

if ($errorsTotal -gt 0) {
Write-Host "##vso[task.complete result=Failed;]Errors encountered."
}
elseif ($warningsTotal -gt 0) {
Write-Host "##vso[task.complete result=SucceededWithIssues;]Warnings encountered."
}
else {
Write-Host "##vso[task.complete result=Succeeded;]No error or warnings encountered."
}
env:
apiPropertiesValidator: "$(apiPropertiesValidatorUrl)"
token: $(token)