Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion .github/workflows/metadata-parser-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ jobs:
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 9.x

- run: dotnet tool install --global Microsoft.OpenApi.Hidi
name: Install Hidi

- name: Validate latest XSLT rules
run: ./scripts/run-metadata-validation.ps1 -repoDirectory "${{ github.workspace }}" -version "${{ matrix.version }}" -platformName "${{ matrix.settings }}"
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/openapi-parser-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ jobs:
- name: Setup .NET
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
dotnet-version: 9.x

- run: dotnet tool install --global Microsoft.OpenApi.Hidi
name: Install Hidi

- name: Validate latest OpenAPI docs
run: ./scripts/run-openapi-validation.ps1 -repoDirectory "${{ github.workspace }}" -version "${{ matrix.version }}" -platformName "${{ matrix.settings }}"
shell: pwsh
Expand Down
9 changes: 6 additions & 3 deletions scripts/run-metadata-validation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ if([string]::IsNullOrWhiteSpace($platformName))
$platformName = "openapi"
}

$hidiResults = dotnet tool list microsoft.openapi.hidi -g --format json | ConvertFrom-json
if ($hidiResults.data.Length -lt 1) {
throw "Hidi tool is not installed. Please install it using the command: dotnet tool install --global Microsoft.OpenApi.Hidi"
}

$transformCsdlDirectory = Join-Path $repoDirectory "transforms/csdl"
$transformScript = Join-Path $transformCsdlDirectory "transform.ps1"
$xsltPath = Join-Path $transformCsdlDirectory "preprocess_csdl.xsl"
Expand All @@ -37,12 +42,10 @@ $transformed = Join-Path $repoDirectory "transformed_$($version)_metadata.xml"
$yamlFilePath = Join-Path $repoDirectory "transformed_$($version)_$($platformName)_metadata.yml"

try {
Write-Host "Tranforming $snapshot metadata using xslt with parameters used in the OpenAPI flow..." -ForegroundColor Green
Write-Host "Transforming $snapshot metadata using xslt with parameters used in the OpenAPI flow..." -ForegroundColor Green
& $transformScript -xslPath $xsltPath -inputPath $snapshot -outputPath $transformed -addInnerErrorDescription $true -removeCapabilityAnnotations $false -csdlVersion $version

Write-Host "Validating $transformed metadata after the transform..." -ForegroundColor Green
# pin the hidi version till odata to openApi conversion supports 2.0
& dotnet tool install --global Microsoft.OpenApi.Hidi
& hidi transform --cs $transformed -o $yamlFilePath --co -f Yaml --sp "$conversionSettingsDirectory/$platformName.json"

} catch {
Expand Down
7 changes: 5 additions & 2 deletions scripts/run-openapi-validation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ if([string]::IsNullOrWhiteSpace($platformName))
$platformName = "openapi"
}

$hidiResults = dotnet tool list microsoft.openapi.hidi -g --format json | ConvertFrom-json
if ($hidiResults.data.Length -lt 1) {
throw "Hidi tool is not installed. Please install it using the command: dotnet tool install --global Microsoft.OpenApi.Hidi"
}

$yaml = Join-Path $repoDirectory "openapi" $version "$platformName.yaml"

Write-Host "Validating $yaml OpenAPI doc..." -ForegroundColor Green

# pin the hidi version till odata to openApi conversion supports 2.0
& dotnet tool install --global Microsoft.OpenApi.Hidi
& hidi validate -d $yaml
Loading