Skip to content

Commit 5c56379

Browse files
Merge pull request #1729 from microsoft/mk/update-packages
Update packages
2 parents 4afdd15 + a9075aa commit 5c56379

36 files changed

+431
-400
lines changed

.azure-pipelines/ci-build.yml

Lines changed: 286 additions & 336 deletions
Large diffs are not rendered by default.

.github/workflows/auto-merge-dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- name: Dependabot metadata
2121
id: metadata
22-
uses: dependabot/fetch-metadata@v2.0.0
22+
uses: dependabot/fetch-metadata@v2.2.0
2323
with:
2424
github-token: "${{ secrets.GITHUB_TOKEN }}"
2525

.github/workflows/docker.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Check out the repo
1818
uses: actions/checkout@v4
1919
- name: Login to GitHub package feed
20-
uses: docker/login-action@v3.1.0
20+
uses: docker/login-action@v3.2.0
2121
with:
2222
username: ${{ secrets.ACR_USERNAME }}
2323
password: ${{ secrets.ACR_PASSWORD }}
@@ -30,13 +30,13 @@ jobs:
3030
id: getversion
3131
- name: Push to GitHub Packages - Nightly
3232
if: ${{ github.ref == 'refs/heads/vnext' }}
33-
uses: docker/build-push-action@v5.3.0
33+
uses: docker/build-push-action@v6.3.0
3434
with:
3535
push: true
3636
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly
3737
- name: Push to GitHub Packages - Release
3838
if: ${{ github.ref == 'refs/heads/master' }}
39-
uses: docker/build-push-action@v5.3.0
39+
uses: docker/build-push-action@v6.3.0
4040
with:
4141
push: true
4242
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.getversion.outputs.version }}

.github/workflows/sonarcloud.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,28 +52,17 @@ jobs:
5252
path: ~/.sonar/cache
5353
key: ${{ runner.os }}-sonar
5454
restore-keys: ${{ runner.os }}-sonar
55-
- name: Cache SonarCloud scanner
56-
id: cache-sonar-scanner
57-
uses: actions/cache@v4
58-
with:
59-
path: ./.sonar/scanner
60-
key: ${{ runner.os }}-sonar-scanner
61-
restore-keys: ${{ runner.os }}-sonar-scanner
6255
- name: Install SonarCloud scanner
63-
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
64-
shell: pwsh
65-
run: |
66-
New-Item -Path ./.sonar/scanner -ItemType Directory
67-
dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner
56+
run: dotnet tool install dotnet-sonarscanner --create-manifest-if-needed
6857
- name: Build and analyze
6958
env:
7059
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
7160
CollectCoverage: true
7261
CoverletOutputFormat: 'opencover' # https://github.com/microsoft/vstest/issues/4014#issuecomment-1307913682
7362
shell: pwsh
7463
run: |
75-
./.sonar/scanner/dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET" /o:"microsoft" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="test/**/coverage.opencover.xml"
64+
dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="test/**/coverage.opencover.xml"
7665
dotnet workload restore
7766
dotnet build
7867
dotnet test Microsoft.OpenApi.sln --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
79-
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
68+
dotnet tool run dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// If you have changed target frameworks, make sure to update the program path.
1313
"program": "${workspaceFolder}/src/Microsoft.OpenApi.Hidi/bin/Debug/net8.0/Microsoft.OpenApi.Hidi.dll",
1414
"args": ["plugin",
15-
"-m","C:\\Users\\darrmi\\src\\github\\microsoft\\openapi.net\\test\\Microsoft.OpenApi.Hidi.Tests\\UtilityFiles\\exampleapimanifest.json",
15+
"-m","${workspaceFolder}/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/exampleapimanifest.json",
1616
"--of","./output"],
1717
"cwd": "${workspaceFolder}/src/Microsoft.OpenApi.Hidi",
1818
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console

CODE_OF_CONDUCT.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Microsoft Open Source Code of Conduct
2+
3+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
4+
5+
Resources:
6+
7+
- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
8+
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
9+
- Contact [[email protected]](mailto:[email protected]) with questions or concerns
10+
- Employees can reach out at [aka.ms/opensource/moderation-support](https://aka.ms/opensource/moderation-support)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,4 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
133133
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
134134
contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
135135

136-
To provide feedback and ask questions you can use Stack Overflow with the [OpenAPI.NET](https://stackoverflow.com/questions/tagged/openapi.net) tag or use the OpenAPI.NET Slack channel which you can join by registering for the HTTP APIs team at http://slack.httpapis.com.
136+
To provide feedback and ask questions you can use Stack Overflow with the [OpenAPI.NET](https://stackoverflow.com/questions/tagged/openapi.net) tag.

src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public async Task<int> InvokeAsync(InvocationContext context)
3333
try
3434
{
3535
if (hidiOptions.OpenApi is null) throw new InvalidOperationException("OpenApi file is required");
36-
await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false);
37-
return 0;
36+
var isValid = await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false);
37+
return isValid is not false ? 0 : -1;
3838
}
3939
#if RELEASE
4040
#pragma warning disable CA1031 // Do not catch general exception types

src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<Nullable>enable</Nullable>
1010
<ToolCommandName>hidi</ToolCommandName>
1111
<PackageOutputPath>./../../artifacts</PackageOutputPath>
12-
<Version>1.4.1</Version>
12+
<Version>1.4.6</Version>
1313
<Description>OpenAPI.NET CLI tool for slicing OpenAPI documents</Description>
1414
<SignAssembly>true</SignAssembly>
1515
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->
@@ -34,8 +34,8 @@
3434
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
3535
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
3636
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
37-
<PackageReference Include="Microsoft.OData.Edm" Version="7.20.0" />
38-
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.6.1" />
37+
<PackageReference Include="Microsoft.OData.Edm" Version="7.21.3" />
38+
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.6.7" />
3939
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.0-preview" />
4040
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
4141
</ItemGroup>

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe
335335
/// <summary>
336336
/// Implementation of the validate command
337337
/// </summary>
338-
public static async Task ValidateOpenApiDocument(
338+
/// <returns><see langword="true"/> when valid, <see langword="false"/> when invalid and <see langword="null"/> when cancelled</returns>
339+
public static async Task<bool?> ValidateOpenApiDocument(
339340
string openApi,
340341
ILogger logger,
341342
CancellationToken cancellationToken = default)
@@ -345,11 +346,13 @@ public static async Task ValidateOpenApiDocument(
345346
throw new ArgumentNullException(nameof(openApi));
346347
}
347348

349+
ReadResult? result = null;
350+
348351
try
349352
{
350353
using var stream = await GetStream(openApi, logger, cancellationToken).ConfigureAwait(false);
351354

352-
var result = await ParseOpenApi(openApi, false, logger, stream, cancellationToken).ConfigureAwait(false);
355+
result = await ParseOpenApi(openApi, false, logger, stream, cancellationToken).ConfigureAwait(false);
353356

354357
using (logger.BeginScope("Calculating statistics"))
355358
{
@@ -371,6 +374,10 @@ public static async Task ValidateOpenApiDocument(
371374
{
372375
throw new InvalidOperationException($"Could not validate the document, reason: {ex.Message}", ex);
373376
}
377+
378+
if (result is null) return null;
379+
380+
return result.OpenApiDiagnostic.Errors.Count == 0;
374381
}
375382

376383
private static async Task<ReadResult> ParseOpenApi(string openApiFile, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken = default)

0 commit comments

Comments
 (0)