Skip to content

Commit cd311c2

Browse files
Copilotbaywet
andauthored
Merge remote-tracking branch 'refs/remotes/origin/main' into gavinbarron-xunit-mtp-main-squash-port
# Conflicts: # .github/workflows/sonarcloud.yml # test/Microsoft.OpenAPI.OData.Reader.Tests/Microsoft.OpenAPI.OData.Reader.Tests.csproj Co-authored-by: baywet <[email protected]>
2 parents 5938ffd + 2124246 commit cd311c2

35 files changed

Lines changed: 355 additions & 354 deletions

‎.azure-pipelines/ci-build.yml‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,6 @@ extends:
6767
Write-Host "##vso[task.setvariable variable=ODataVersion]$version"
6868
displayName: 'Validate OData component tag and project version'
6969
70-
- task: UseDotNet@2
71-
displayName: 'Use .NET 6' # needed for ESRP signing
72-
inputs:
73-
version: 6.x
74-
75-
- task: UseDotNet@2
76-
displayName: 'Use .NET 8'
77-
inputs:
78-
version: 8.x
79-
8070
- task: UseDotNet@2
8171
displayName: 'Use .NET 10'
8272
inputs:

‎.azure-pipelines/hidi-release.yml‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,6 @@ extends:
5959
}
6060
Write-Host "##vso[task.setvariable variable=HidiVersion]$version"
6161
displayName: Validate Hidi component tag and project version
62-
- task: UseDotNet@2
63-
displayName: Use .NET 6 for ESRP
64-
inputs:
65-
version: 6.x
66-
- task: UseDotNet@2
67-
displayName: Use .NET 8
68-
inputs:
69-
version: 8.x
7062
- task: UseDotNet@2
7163
displayName: Use .NET 10
7264
inputs:
@@ -155,7 +147,7 @@ extends:
155147
& .\artifacts\hidi\win-x64\Microsoft.OpenApi.Hidi.exe --help
156148
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
157149
New-Item -ItemType Directory -Force artifacts\hidi\signing | Out-Null
158-
Copy-Item src\Microsoft.OpenApi.Hidi\bin\$(buildConfiguration)\net8.0\Microsoft.OpenApi.Hidi.dll artifacts\hidi\signing
150+
Copy-Item src\Microsoft.OpenApi.Hidi\bin\$(buildConfiguration)\net10.0\Microsoft.OpenApi.Hidi.dll artifacts\hidi\signing
159151
Copy-Item artifacts\hidi\win-x64\Microsoft.OpenApi.Hidi.exe artifacts\hidi\signing
160152
displayName: Stage hidi binaries
161153
- task: EsrpCodeSigning@6

‎.github/workflows/ci-cd.yml‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ jobs:
1919
- name: Setup .NET
2020
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
2121
with:
22-
dotnet-version: |
23-
8.0.x
24-
10.0.x
22+
dotnet-version: 10.0.x
2523

2624
- name: Data gatherer
2725
id: data_gatherer
@@ -168,9 +166,7 @@ jobs:
168166
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
169167
- uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
170168
with:
171-
dotnet-version: |
172-
8.0.x
173-
10.0.x
169+
dotnet-version: 10.0.x
174170
- name: Publish and smoke-test Windows executable
175171
shell: pwsh
176172
run: |

‎.github/workflows/codeql-analysis.yml‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ jobs:
4444
- name: Setup .NET
4545
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
4646
with:
47-
dotnet-version: |
48-
8.0.x
49-
10.0.x
47+
dotnet-version: 10.0.x
5048

5149
# Initializes the CodeQL tools for scanning.
5250
- name: Initialize CodeQL

‎.github/workflows/sonarcloud.yml‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ jobs:
4343
- name: Setup .NET
4444
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
4545
with:
46-
dotnet-version: |
47-
8.0.x
48-
10.0.x
46+
dotnet-version: 10.0.x
4947
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
5048
with:
5149
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
@@ -124,7 +122,7 @@ jobs:
124122
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
125123
shell: pwsh
126124
run: |
127-
dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET.OData" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="artifacts/test-results/*opencover*.xml" /d:sonar.coverageReportPaths="artifacts/hidi/powershell-coverage/sonar-coverage.xml"
125+
dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET.OData" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="artifacts/test-results/*opencover*.xml,test/**/coverage.opencover.xml,artifacts/hidi/coverage/*opencover*.xml" /d:sonar.coverageReportPaths="artifacts/hidi/powershell-coverage/sonar-coverage.xml"
128126
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
129127
dotnet workload restore
130128
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

‎Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ WORKDIR /app/hidi
1414
RUN --mount=type=secret,id=nuget_config,target=/app/hidi/NuGet.Config \
1515
dotnet publish ./src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -c Release -o /app/publish -p:GeneratePackageOnBuild=false -p:HidiPublicSignBuild=true
1616

17-
FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy-chiseled AS runtime
17+
FROM mcr.microsoft.com/dotnet/runtime:10.0-noble-chiseled AS runtime
1818
WORKDIR /app
1919

2020
COPY --from=build-env /app/publish ./

‎README.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,16 @@ The `GetEdmModel()` method can load a model in 3 ways:
8686

8787
The OpenAPI.OData.reader nuget package is at: [https://www.nuget.org/packages/Microsoft.OpenApi.OData/](https://www.nuget.org/packages/Microsoft.OpenApi.OData)
8888
89+
The package targets .NET 10 and depends on Microsoft.OData.Edm 9.x.
90+
8991
## Hidi command line tool
9092

9193
[Hidi](src/Microsoft.OpenApi.Hidi/readme.md) validates, transforms and slices
9294
OpenAPI documents, converts OData CSDL, and generates API diagrams.
9395
The NuGet package remains `Microsoft.OpenApi.Hidi` and the command remains `hidi`.
9496
Hidi 3.x is maintained on `main`; Hidi 2.x is maintained on `support/v2`.
95-
Both tracks use independent versions and require the .NET 8 runtime.
97+
Both tracks use independent versions. Hidi 3.x requires the .NET 10 runtime;
98+
Hidi 2.x requires the .NET 8 runtime.
9699
Building this repository, including the Hidi tests, requires the .NET 10 SDK.
97100
The main Hidi pipeline sets `hidiPublishingEnabled: 'true'` for stable
98101
`hidi-v3.*` tag releases; `hidiPreviewPublishingEnabled: 'false'` keeps main

‎install-tool.ps1‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
1919

2020
$installedDlls = @(Get-ChildItem $toolDirectory -Force -Recurse -Filter Microsoft.OpenApi.Hidi.dll)
2121
if ($installedDlls.Count -ne 1) { throw 'Expected exactly one installed hidi DLL.' }
22-
$builtDll = Join-Path $PSScriptRoot 'src\Microsoft.OpenApi.Hidi\bin\Release\net8.0\Microsoft.OpenApi.Hidi.dll'
22+
$builtDll = Join-Path $PSScriptRoot 'src\Microsoft.OpenApi.Hidi\bin\Release\net10.0\Microsoft.OpenApi.Hidi.dll'
2323
if ((Get-FileHash $installedDlls[0].FullName).Hash -ne (Get-FileHash $builtDll).Hash) {
2424
throw 'Installed hidi does not match the locally built package.'
2525
}

‎scripts/verify-hidi-package-assembly.ps1‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ $archive = $null
3131
try {
3232
$archive = [IO.Compression.ZipFile]::OpenRead((Resolve-Path -LiteralPath $PackagePath).Path)
3333
$assemblies = @($archive.Entries | Where-Object { $_.Name -ieq 'Microsoft.OpenApi.Hidi.dll' })
34-
if ($assemblies.Count -ne 1 -or $assemblies[0].FullName -cne 'tools/net8.0/any/Microsoft.OpenApi.Hidi.dll') {
35-
throw 'Expected exactly one Hidi DLL at tools/net8.0/any/Microsoft.OpenApi.Hidi.dll.'
34+
if ($assemblies.Count -ne 1 -or $assemblies[0].FullName -cne 'tools/net10.0/any/Microsoft.OpenApi.Hidi.dll') {
35+
throw 'Expected exactly one Hidi DLL at tools/net10.0/any/Microsoft.OpenApi.Hidi.dll.'
3636
}
3737
[IO.Compression.ZipFileExtensions]::ExtractToFile($assemblies[0], $packagedAssembly)
3838

‎src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public override void Visit(OpenApiOperation operation)
6767

6868
var operationId = operation.OperationId;
6969
var operationTypeExtension = operation.Extensions?.GetExtension("x-ms-docs-operation-type");
70-
if (operationTypeExtension.IsEquals("function") && operation.Parameters is { Count :> 0})
70+
if (operationTypeExtension.IsEquals("function") && operation.Parameters is { Count: > 0 })
7171
ResolveFunctionParameters(operation.Parameters);
7272

7373
// Order matters. Resolve operationId.
@@ -106,7 +106,7 @@ private static string ResolveByRefOperationId(string operationId)
106106
// Update $ref path operationId name
107107
// Ref key word is enclosed between lower-cased and upper-cased letters
108108
// Ex.: applications_GetRefCreatedOnBehalfOf to applications_GetCreatedOnBehalfOfByRef
109-
return s_oDataRefRegex.Match(operationId).Success ? $"{s_oDataRefRegex.Replace(operationId, string.Empty)}ByRef" : operationId;
109+
return s_oDataRefRegex.IsMatch(operationId) ? $"{s_oDataRefRegex.Replace(operationId, string.Empty)}ByRef" : operationId;
110110
}
111111

112112
private static string ResolveODataCastOperationId(string operationId)
@@ -175,8 +175,8 @@ private static void ResolveFunctionParameters(IList<IOpenApiParameter> parameter
175175

176176
private void AddAdditionalPropertiesToSchema(IOpenApiSchema schema)
177177
{
178-
if (schema is OpenApiSchema openApiSchema
179-
&& !_schemaLoop.Contains(schema)
178+
if (schema is OpenApiSchema openApiSchema
179+
&& !_schemaLoop.Contains(schema)
180180
&& schema.Type.Equals(JsonSchemaType.Object))
181181
{
182182
openApiSchema.AdditionalProperties = new OpenApiSchema() { Type = JsonSchemaType.Object };

0 commit comments

Comments
 (0)