diff --git a/.github/workflows/metadata-parser-validation.yml b/.github/workflows/metadata-parser-validation.yml index 4159dd4e9..dbcbeac2f 100644 --- a/.github/workflows/metadata-parser-validation.yml +++ b/.github/workflows/metadata-parser-validation.yml @@ -33,7 +33,10 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4.3.1 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 }}" diff --git a/.github/workflows/openapi-parser-validation.yml b/.github/workflows/openapi-parser-validation.yml index f8d3de810..be20ff8b7 100644 --- a/.github/workflows/openapi-parser-validation.yml +++ b/.github/workflows/openapi-parser-validation.yml @@ -33,7 +33,11 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@v4.3.1 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 diff --git a/scripts/run-metadata-validation.ps1 b/scripts/run-metadata-validation.ps1 index 0268636c9..df73eedc9 100644 --- a/scripts/run-metadata-validation.ps1 +++ b/scripts/run-metadata-validation.ps1 @@ -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" @@ -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 { diff --git a/scripts/run-openapi-validation.ps1 b/scripts/run-openapi-validation.ps1 index a50fd1084..d1f89aa15 100644 --- a/scripts/run-openapi-validation.ps1 +++ b/scripts/run-openapi-validation.ps1 @@ -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