Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update packages #1729

Merged
merged 154 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
1b02c01
Merge pull request #1050 from microsoft/vnext
baywet Oct 25, 2022
656ac9a
Merge pull request #1084 from microsoft/vnext
MaggieKimani1 Nov 21, 2022
40d67ac
Merge pull request #1086 from microsoft/vnext
MaggieKimani1 Nov 21, 2022
0381437
Merge pull request #1100 from microsoft/vnext
baywet Dec 6, 2022
60c11ad
Merge pull request #1120 from microsoft/vnext
baywet Jan 17, 2023
572b303
Merge pull request #1148 from microsoft/vnext
MaggieKimani1 Jan 31, 2023
9c18762
Merge pull request #1153 from microsoft/vnext
baywet Feb 1, 2023
bf7b8cf
Merge pull request #1161 from microsoft/vnext
baywet Feb 13, 2023
e0b36a7
Merge pull request #1170 from microsoft/vnext
MaggieKimani1 Feb 21, 2023
2605650
Merge pull request #1175 from microsoft/vnext
baywet Feb 28, 2023
9155d11
Merge pull request #1181 from microsoft/vnext
MaggieKimani1 Mar 7, 2023
4da5e7a
Merge pull request #1199 from microsoft/vnext
MaggieKimani1 Mar 30, 2023
0975409
Merge pull request #1205 from microsoft/vnext
baywet Apr 5, 2023
14ec838
Merge pull request #1210 from microsoft/vnext
baywet Apr 11, 2023
92e5e07
Merge pull request #1216 from microsoft/vnext
baywet Apr 12, 2023
986917b
Merge pull request #1220 from microsoft/vnext
MaggieKimani1 Apr 17, 2023
d6962c3
Merge pull request #1240 from microsoft/vnext
andrueastman May 3, 2023
27215dd
Merge pull request #1243 from microsoft/vnext
andrueastman May 4, 2023
ffb9bd0
Merge pull request #1279 from microsoft/vnext
MaggieKimani1 Jun 19, 2023
137a456
Merge pull request #1296 from microsoft/vnext
MaggieKimani1 Jul 24, 2023
97c5364
Merge pull request #1324 from microsoft/vnext
baywet Aug 31, 2023
1a39857
Merge pull request #1329 from microsoft/vnext
andrueastman Sep 5, 2023
acd7652
Merge pull request #1335 from microsoft/vnext
baywet Sep 7, 2023
11cfc7d
Merge pull request #1361 from microsoft/vnext
MaggieKimani1 Sep 26, 2023
2ade929
Merge pull request #1393 from microsoft/vnext
andrueastman Oct 5, 2023
1bec222
Merge pull request #1445 from microsoft/vnext
irvinesunday Oct 30, 2023
eeb3013
Merge pull request #1453 from microsoft/vnext
irvinesunday Nov 6, 2023
742df9f
Merge pull request #1456 from microsoft/vnext
MaggieKimani1 Nov 7, 2023
aab3d82
Merge pull request #1461 from microsoft/vnext
irvinesunday Nov 14, 2023
7387007
Merge pull request #1482 from microsoft/vnext
MaggieKimani1 Nov 22, 2023
79f59bf
Merge pull request #1532 from microsoft/vnext
MaggieKimani1 Jan 16, 2024
8973a58
Merge pull request #1543 from microsoft/vnext
MaggieKimani1 Jan 29, 2024
581dc63
Merge pull request #1549 from microsoft/vnext
irvinesunday Feb 6, 2024
fbd2b4b
Merge pull request #1575 from microsoft/vnext
irvinesunday Mar 4, 2024
522f703
Merge pull request #1578 from microsoft/vnext
baywet Mar 5, 2024
ec6a1d4
Merge pull request #1585 from microsoft/vnext
baywet Mar 6, 2024
ebd8d9a
Merge pull request #1615 from microsoft/vnext
irvinesunday Apr 5, 2024
4dddbc3
Bump Microsoft.OData.Edm from 7.20.0 to 7.21.0
dependabot[bot] Apr 17, 2024
29b1a1a
Merge pull request #1634 from microsoft/dependabot/nuget/Microsoft.OD…
baywet Apr 18, 2024
546bd70
Update readme.md
njaci1 Apr 22, 2024
d3547b2
Bump Microsoft.OpenApi.OData from 1.6.1 to 1.6.2
dependabot[bot] Apr 26, 2024
9b9be6a
Merge pull request #1642 from microsoft/dependabot/nuget/Microsoft.Op…
baywet Apr 29, 2024
851946a
Bump xunit.runner.visualstudio from 2.5.8 to 2.8.0
dependabot[bot] Apr 29, 2024
c5e0da2
Bump Microsoft.OpenApi.OData from 1.6.2 to 1.6.3
dependabot[bot] Apr 29, 2024
fda52f9
Bump dependabot/fetch-metadata from 2.0.0 to 2.1.0
dependabot[bot] Apr 29, 2024
10ad236
Merge pull request #1646 from microsoft/dependabot/nuget/Microsoft.Op…
baywet Apr 30, 2024
b77778f
Merge pull request #1647 from microsoft/dependabot/github_actions/dep…
andrueastman Apr 30, 2024
3e6b105
Merge pull request #1645 from microsoft/dependabot/nuget/xunit.runner…
andrueastman Apr 30, 2024
fee1a6c
Bump xunit from 2.7.1 to 2.8.0
dependabot[bot] Apr 30, 2024
9a9bdee
Fixes "async void" calls
Apr 30, 2024
d766cd2
Merge pull request #1644 from microsoft/dependabot/nuget/xunit-2.8.0
andrueastman Apr 30, 2024
c98e089
Bump Hidi version (#1650)
millicentachieng May 2, 2024
38cb605
Merge pull request #1649 from microsoft/vnext
millicentachieng May 2, 2024
55fed51
Bump Microsoft.OData.Edm from 7.21.0 to 7.21.1
dependabot[bot] May 2, 2024
2c7d44e
Merge pull request #1651 from microsoft/dependabot/nuget/Microsoft.OD…
baywet May 3, 2024
761b982
- replaces sonar login by token
baywet May 6, 2024
5ee9df4
- removes unnecessary parameter
baywet May 6, 2024
51bb845
- removes caching due to invalidation problems
baywet May 6, 2024
f78f33a
Merge pull request #1656 from microsoft/feature/sonar-token
baywet May 7, 2024
3a2d5f3
Merge pull request #1637 from microsoft/njaci1-patch-1
darrelmiller May 7, 2024
725fbe2
Add logic to map primitives to simple types for types without format
MaggieKimani1 May 9, 2024
b466c37
Add test to validate
MaggieKimani1 May 9, 2024
c074339
Remove whitespace
MaggieKimani1 May 9, 2024
7fbe342
Bump Verify.Xunit from 24.1.0 to 24.2.0
dependabot[bot] May 9, 2024
a320630
Merge pull request #1662 from microsoft/dependabot/nuget/Verify.Xunit…
andrueastman May 13, 2024
0f77d61
Add nullable operator for nullable types
MaggieKimani1 May 13, 2024
3c36aee
- updates code of conduct to the latest standard
baywet May 14, 2024
64cda20
Merge pull request #1663 from microsoft/feature/code-of-conduct
baywet May 14, 2024
1865f32
Update README.md
MaggieKimani1 May 14, 2024
6a1ac5e
Merge pull request #1665 from microsoft/mk/update-readme
MaggieKimani1 May 14, 2024
e2e7556
Bump Microsoft.Windows.Compatibility from 8.0.4 to 8.0.5
dependabot[bot] May 14, 2024
70e42b3
Merge pull request #1666 from microsoft/dependabot/nuget/Microsoft.Wi…
baywet May 15, 2024
3be00e4
Merge pull request #1660 from microsoft/mk/handle-types-without-format
MaggieKimani1 May 16, 2024
4e392e1
Update pipeline to be 1ES compliant
MaggieKimani1 May 20, 2024
b42af09
Remove redundant tasks
MaggieKimani1 May 20, 2024
d8059a2
Remove task
MaggieKimani1 May 21, 2024
e1d5f4e
Merge pull request #1668 from microsoft/1esconversion
MaggieKimani1 May 21, 2024
899ff1f
---
dependabot[bot] May 21, 2024
020bf61
Merge pull request #1669 from microsoft/dependabot/nuget/Microsoft.Op…
baywet May 22, 2024
b36d694
Bump Hidi version (#1670)
millicentachieng May 22, 2024
569aa57
Merge pull request #1671 from microsoft/vnext
millicentachieng May 22, 2024
256b513
Bump Microsoft.NET.Test.Sdk from 17.9.0 to 17.10.0
dependabot[bot] May 22, 2024
8563292
Merge pull request #1672 from microsoft/dependabot/nuget/Microsoft.NE…
baywet May 23, 2024
fb9abaf
Bump Microsoft.OData.Edm from 7.21.1 to 7.21.2
dependabot[bot] May 23, 2024
a003888
Merge pull request #1673 from microsoft/dependabot/nuget/Microsoft.OD…
baywet May 24, 2024
bca8e18
Add a package parent path argument
MaggieKimani1 May 27, 2024
db284a2
Bump hidi version
MaggieKimani1 May 27, 2024
7f1f466
Bump Microsoft.OpenApi.OData from 1.6.4 to 1.6.5 (#1675)
millicentachieng May 27, 2024
fc751d0
Merge pull request #1676 from microsoft/mk/fix-build-pipeline
MaggieKimani1 May 27, 2024
7e6b8ea
Merge pull request #1677 from microsoft/vnext
millicentachieng May 27, 2024
6aa5e05
Bump xunit.runner.visualstudio from 2.8.0 to 2.8.1
dependabot[bot] May 27, 2024
973f4cd
Merge pull request #1678 from microsoft/dependabot/nuget/xunit.runner…
andrueastman May 28, 2024
5e4f6d8
Bump xunit from 2.8.0 to 2.8.1
dependabot[bot] May 28, 2024
6c9f35a
Merge pull request #1679 from microsoft/dependabot/nuget/xunit-2.8.1
andrueastman May 28, 2024
e418448
Fix nuget task
MaggieKimani1 May 28, 2024
d212f85
Merge pull request #1680 from microsoft/mk/fix-nuget-task
MaggieKimani1 May 28, 2024
a7283b0
Merge pull request #1681 from microsoft/vnext
MaggieKimani1 May 28, 2024
5fa4cf0
Bump Microsoft.Windows.Compatibility from 8.0.5 to 8.0.6
dependabot[bot] May 28, 2024
4c7a471
Merge pull request #1682 from microsoft/dependabot/nuget/Microsoft.Wi…
baywet May 29, 2024
1c4d227
Bump Microsoft.OData.Edm from 7.21.2 to 7.21.3
dependabot[bot] Jun 3, 2024
53a5621
Bump Verify.Xunit from 24.2.0 to 25.0.1 (#1685)
dependabot[bot] Jun 4, 2024
037dbf3
Merge pull request #1684 from microsoft/dependabot/nuget/Microsoft.OD…
baywet Jun 4, 2024
2049b73
Bump docker/login-action from 3.1.0 to 3.2.0 (#1683)
dependabot[bot] Jun 4, 2024
71beac4
Return -1 exit code when the document is not valid
KuraiAndras Jun 7, 2024
d2fe762
Change to relative path in `Launch Hidi` task
KuraiAndras Jun 7, 2024
d9fc82b
Merge pull request #1687 from KuraiAndras/fix-launch-args
MaggieKimani1 Jun 10, 2024
09bef6c
Merge pull request #1686 from KuraiAndras/return-non-0-exit-code-on-v…
MaggieKimani1 Jun 10, 2024
5a83840
Bump docker/build-push-action from 5.3.0 to 5.4.0
dependabot[bot] Jun 10, 2024
05a5f4d
Merge pull request #1688 from microsoft/dependabot/github_actions/doc…
andrueastman Jun 11, 2024
bbc31f5
Update conversion lib. version (#1689)
irvinesunday Jun 11, 2024
f8ba576
Bump lib versions
MaggieKimani1 Jun 11, 2024
d49167e
Merge pull request #1691 from microsoft/mk/bump-lib-versions
MaggieKimani1 Jun 11, 2024
a1aa6ee
Bump Verify.Xunit from 25.0.1 to 25.0.2
dependabot[bot] Jun 11, 2024
080095e
Release Hidi and libs (#1690)
irvinesunday Jun 12, 2024
c70b9a2
Merge pull request #1692 from microsoft/dependabot/nuget/Verify.Xunit…
andrueastman Jun 13, 2024
5261400
Bump Verify.Xunit from 25.0.2 to 25.0.3
dependabot[bot] Jun 14, 2024
5f5fa02
Bump docker/build-push-action from 5.4.0 to 6.0.0
dependabot[bot] Jun 17, 2024
62ec21b
Merge pull request #1694 from microsoft/dependabot/nuget/Verify.Xunit…
andrueastman Jun 18, 2024
80a02a2
Merge pull request #1696 from microsoft/dependabot/github_actions/doc…
andrueastman Jun 18, 2024
b26bd6e
Update the error message to insert the value of the referenceType
MaggieKimani1 Jun 20, 2024
71de0e0
Add a check to ascertain that the referenceType and the referencedObj…
MaggieKimani1 Jun 20, 2024
f9fc4db
Add test to validate
MaggieKimani1 Jun 20, 2024
2bb1203
Update logic to guard against null exceptions
MaggieKimani1 Jun 24, 2024
d758803
Update extensions to return null instead of throwing
MaggieKimani1 Jun 24, 2024
858e85d
Bump docker/build-push-action from 6.0.0 to 6.1.0
dependabot[bot] Jun 24, 2024
b3ddc2a
Bump Verify.Xunit from 25.0.3 to 25.0.4
dependabot[bot] Jun 24, 2024
d983c80
Merge pull request #1700 from microsoft/dependabot/github_actions/doc…
andrueastman Jun 25, 2024
bb9e5b5
Merge pull request #1701 from microsoft/dependabot/nuget/Verify.Xunit…
andrueastman Jun 25, 2024
8485685
Merge pull request #1697 from microsoft/mk/fix-ref-bug
MaggieKimani1 Jun 26, 2024
84e7680
Add test to validate
MaggieKimani1 Jun 26, 2024
ae79040
Merge pull request #1698 from microsoft/mk/fix-null-extension
MaggieKimani1 Jun 26, 2024
4fe5826
Update conversion library version (#1702)
irvinesunday Jun 26, 2024
e339757
Release Hidi and libs (#1690) (#1704)
irvinesunday Jun 27, 2024
f9bb190
merge
Jun 27, 2024
b3d2b32
Merge pull request #1708 from microsoft/andrueastman/fixMerge
andrueastman Jun 27, 2024
0d15ba1
Bump docker/build-push-action from 6.1.0 to 6.2.0
dependabot[bot] Jul 1, 2024
041938d
Merge pull request #1713 from microsoft/dependabot/github_actions/doc…
andrueastman Jul 2, 2024
d4057f2
Bump Verify.Xunit from 25.0.4 to 25.2.0
dependabot[bot] Jul 2, 2024
3d971de
Merge pull request #1714 from microsoft/dependabot/nuget/Verify.Xunit…
andrueastman Jul 3, 2024
05713cb
Bump Verify.Xunit from 25.2.0 to 25.3.0
dependabot[bot] Jul 3, 2024
9a7f078
Merge pull request #1716 from microsoft/dependabot/nuget/Verify.Xunit…
andrueastman Jul 4, 2024
a70f2be
Bump dependabot/fetch-metadata from 2.1.0 to 2.2.0
dependabot[bot] Jul 8, 2024
827339f
Bump docker/build-push-action from 6.2.0 to 6.3.0
dependabot[bot] Jul 8, 2024
734e84f
Merge pull request #1720 from microsoft/dependabot/github_actions/dep…
andrueastman Jul 9, 2024
b2469d4
Bump xunit.runner.visualstudio from 2.8.1 to 2.8.2 (#1723)
dependabot[bot] Jul 9, 2024
0199484
Merge pull request #1721 from microsoft/dependabot/github_actions/doc…
andrueastman Jul 9, 2024
06bf70b
Bump xunit from 2.8.1 to 2.9.0 (#1722)
dependabot[bot] Jul 9, 2024
2a602ca
Bump Microsoft.Windows.Compatibility from 8.0.6 to 8.0.7
dependabot[bot] Jul 9, 2024
4470204
Merge pull request #1724 from microsoft/dependabot/nuget/Microsoft.Wi…
baywet Jul 10, 2024
b9bff33
Bump Verify.Xunit from 25.3.0 to 25.3.1
dependabot[bot] Jul 11, 2024
1eae046
Merge pull request #1725 from microsoft/dependabot/nuget/Verify.Xunit…
andrueastman Jul 12, 2024
ff0d4f8
Update packages
MaggieKimani1 Jul 16, 2024
286c317
Use async Task as async void is obsolete
MaggieKimani1 Jul 16, 2024
a9075aa
Merge vnext into v2; Resolve merge conflicts
MaggieKimani1 Jul 16, 2024
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
622 changes: 286 additions & 336 deletions .azure-pipelines/ci-build.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/auto-merge-dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2.0.0
uses: dependabot/fetch-metadata@v2.2.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"

Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4
- name: Login to GitHub package feed
uses: docker/login-action@v3.1.0
uses: docker/login-action@v3.2.0
with:
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
Expand All @@ -30,13 +30,13 @@ jobs:
id: getversion
- name: Push to GitHub Packages - Nightly
if: ${{ github.ref == 'refs/heads/vnext' }}
uses: docker/build-push-action@v5.3.0
uses: docker/build-push-action@v6.3.0
with:
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly
- name: Push to GitHub Packages - Release
if: ${{ github.ref == 'refs/heads/master' }}
uses: docker/build-push-action@v5.3.0
uses: docker/build-push-action@v6.3.0
with:
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.getversion.outputs.version }}
17 changes: 3 additions & 14 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,28 +52,17 @@ jobs:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v4
with:
path: ./.sonar/scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: pwsh
run: |
New-Item -Path ./.sonar/scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path ./.sonar/scanner
run: dotnet tool install dotnet-sonarscanner --create-manifest-if-needed
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
CollectCoverage: true
CoverletOutputFormat: 'opencover' # https://github.com/microsoft/vstest/issues/4014#issuecomment-1307913682
shell: pwsh
run: |
./.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"
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"
dotnet workload restore
dotnet build
dotnet test Microsoft.OpenApi.sln --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
./.sonar/scanner/dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
dotnet tool run dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}"
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/src/Microsoft.OpenApi.Hidi/bin/Debug/net8.0/Microsoft.OpenApi.Hidi.dll",
"args": ["plugin",
"-m","C:\\Users\\darrmi\\src\\github\\microsoft\\openapi.net\\test\\Microsoft.OpenApi.Hidi.Tests\\UtilityFiles\\exampleapimanifest.json",
"-m","${workspaceFolder}/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/exampleapimanifest.json",
"--of","./output"],
"cwd": "${workspaceFolder}/src/Microsoft.OpenApi.Hidi",
// For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console
Expand Down
10 changes: 10 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Microsoft Open Source Code of Conduct

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).

Resources:

- [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/)
- [Microsoft Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
- Contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with questions or concerns
- Employees can reach out at [aka.ms/opensource/moderation-support](https://aka.ms/opensource/moderation-support)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,4 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

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.
To provide feedback and ask questions you can use Stack Overflow with the [OpenAPI.NET](https://stackoverflow.com/questions/tagged/openapi.net) tag.
4 changes: 2 additions & 2 deletions src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public async Task<int> InvokeAsync(InvocationContext context)
try
{
if (hidiOptions.OpenApi is null) throw new InvalidOperationException("OpenApi file is required");
await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false);
return 0;
var isValid = await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false);
return isValid is not false ? 0 : -1;
}
#if RELEASE
#pragma warning disable CA1031 // Do not catch general exception types
Expand Down
6 changes: 3 additions & 3 deletions src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Nullable>enable</Nullable>
<ToolCommandName>hidi</ToolCommandName>
<PackageOutputPath>./../../artifacts</PackageOutputPath>
<Version>1.4.1</Version>
<Version>1.4.6</Version>
<Description>OpenAPI.NET CLI tool for slicing OpenAPI documents</Description>
<SignAssembly>true</SignAssembly>
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->
Expand All @@ -34,8 +34,8 @@
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
<PackageReference Include="Microsoft.OData.Edm" Version="7.20.0" />
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.6.1" />
<PackageReference Include="Microsoft.OData.Edm" Version="7.21.3" />
<PackageReference Include="Microsoft.OpenApi.OData" Version="1.6.7" />
<PackageReference Include="Microsoft.OpenApi.ApiManifest" Version="0.5.0-preview" />
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
</ItemGroup>
Expand Down
11 changes: 9 additions & 2 deletions src/Microsoft.OpenApi.Hidi/OpenApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe
/// <summary>
/// Implementation of the validate command
/// </summary>
public static async Task ValidateOpenApiDocument(
/// <returns><see langword="true"/> when valid, <see langword="false"/> when invalid and <see langword="null"/> when cancelled</returns>
public static async Task<bool?> ValidateOpenApiDocument(
string openApi,
ILogger logger,
CancellationToken cancellationToken = default)
Expand All @@ -345,11 +346,13 @@ public static async Task ValidateOpenApiDocument(
throw new ArgumentNullException(nameof(openApi));
}

ReadResult? result = null;

try
{
using var stream = await GetStream(openApi, logger, cancellationToken).ConfigureAwait(false);

var result = await ParseOpenApi(openApi, false, logger, stream, cancellationToken).ConfigureAwait(false);
result = await ParseOpenApi(openApi, false, logger, stream, cancellationToken).ConfigureAwait(false);

using (logger.BeginScope("Calculating statistics"))
{
Expand All @@ -371,6 +374,10 @@ public static async Task ValidateOpenApiDocument(
{
throw new InvalidOperationException($"Could not validate the document, reason: {ex.Message}", ex);
}

if (result is null) return null;

return result.OpenApiDiagnostic.Errors.Count == 0;
}

private static async Task<ReadResult> ParseOpenApi(string openApiFile, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken = default)
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Hidi/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ This command accepts the following parameters:
hidi transform --openapi files\People.yml --format yaml --output files\People2.yml --version OpenApi3_0 --filterByCollection Graph-Collection-0017059134807617005.postman_collection.json

3. CSDL--->OpenAPI conversion and filtering
hidi transform --input Files/Todo.xml --output Files/Todo-subset.yml --format yaml --version OpenApi3_0 --filterByOperationIds Todos.Todo.UpdateTodo
hidi transform --csdl Files/Todo.xml --output Files/Todo-subset.yml --format yaml --version OpenApi3_0 --filterByOperationIds Todos.Todo.UpdateTodo

4. CSDL Filtering by EntitySets and Singletons
hidi transform --cs dataverse.csdl --csdlFilter "appointments,opportunities" -o appointmentsAndOpportunities.yaml --ll trace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.6.14</Version>
<Version>1.6.15</Version>
<Description>OpenAPI.NET Readers for JSON and YAML documents</Description>
<SignAssembly>true</SignAssembly>
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->
Expand All @@ -27,7 +27,7 @@
<PackageReference Include="JsonSchema.Net" Version="4.1.5" />
<PackageReference Include="JsonSchema.Net.OpenApi" Version="1.1.0" />
<PackageReference Include="SharpYaml" Version="2.1.1" />
<PackageReference Include="System.Text.Json" Version="7.0.2" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.UpgradeAssistant.Extensions.Default.Analyzers" Version="0.4.421302" PrivateAssets="all" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.4" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="8.0.7" />
</ItemGroup>
<ItemGroup>
<Resource Include="Themes\Metro\HowToApplyTheme.txt" />
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi/Extensions/OpenApiTypeMapper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.

using System;
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.OpenApi/Microsoft.OpenApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>Latest</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>1.6.14</Version>
<Version>1.6.15</Version>
<Description>.NET models with JSON and YAML writers for OpenAPI specification</Description>
<SignAssembly>true</SignAssembly>
<!-- https://github.com/dotnet/sourcelink/blob/main/docs/README.md#embeduntrackedsources -->
Expand All @@ -26,7 +26,7 @@
<PackageReference Include="JsonSchema.Net.OpenApi" Version="1.1.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Text.Json" Version="7.0.2" />
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion)
/// <exception cref="ArgumentOutOfRangeException">When the source element is not an object</exception>
public static OpenApiDeprecationExtension Parse(OpenApiAny source)
{
if (source.Node is not JsonObject rawObject) throw new ArgumentOutOfRangeException(nameof(source));
if (source.Node is not JsonObject rawObject) return null;
var extension = new OpenApiDeprecationExtension();
if (rawObject.TryGetPropertyValue(nameof(RemovalDate).ToFirstCharacterLowerCase(), out var removalDate) && removalDate is JsonNode removalDateValue)
extension.RemovalDate = removalDateValue.GetValue<DateTimeOffset>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ------------------------------------------------------------
// ------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// ------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion)
/// <exception cref="ArgumentOutOfRangeException">When the source element is not an object</exception>
public static OpenApiEnumValuesDescriptionExtension Parse(OpenApiAny source)
{
if (source.Node is not JsonObject rawObject) throw new ArgumentOutOfRangeException(nameof(source));
if (source.Node is not JsonObject rawObject) return null;
var extension = new OpenApiEnumValuesDescriptionExtension();
if (rawObject.TryGetPropertyValue("values", out var values) && values is JsonArray valuesArray)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion)
/// <exception cref="ArgumentOutOfRangeException">When the source element is not an object</exception>
public static OpenApiPagingExtension Parse(OpenApiAny source)
{
if (source.Node is not JsonObject rawObject) throw new ArgumentOutOfRangeException(nameof(source));
if (source.Node is not JsonObject rawObject) return null;
var extension = new OpenApiPagingExtension();
if (rawObject.TryGetPropertyValue(nameof(NextLinkName).ToFirstCharacterLowerCase(), out var nextLinkName) && nextLinkName is JsonNode nextLinkNameStr)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void Write(IOpenApiWriter writer, OpenApiSpecVersion specVersion)
/// <returns>The <see cref="OpenApiPrimaryErrorMessageExtension"/>.</returns>
public static OpenApiPrimaryErrorMessageExtension Parse(OpenApiAny source)
{
if (source.Node is not JsonNode rawObject) throw new ArgumentOutOfRangeException(nameof(source));
if (source.Node is not JsonNode rawObject) return null;
return new()
{
IsPrimaryErrorMessage = rawObject.GetValue<bool>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public bool? IsReserved
/// <returns></returns>
public static OpenApiReservedParameterExtension Parse(OpenApiAny source)
{
if (source.Node is not JsonNode rawBoolean) throw new ArgumentOutOfRangeException(nameof(source));
if (source.Node is not JsonNode rawBoolean) return null;
return new()
{
IsReserved = rawBoolean.GetValue<bool>()
Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.OpenApi/Properties/SRResource.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi/Properties/SRResource.resx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
<value>Invalid Reference identifier '{0}'.</value>
</data>
<data name="InvalidReferenceType" xml:space="preserve">
<value>Invalid Reference Type.</value>
<value>Invalid Reference Type '{0}'.</value>
</data>
<data name="LocalReferenceRequiresType" xml:space="preserve">
<value>Local reference must have type specified.</value>
Expand Down
5 changes: 3 additions & 2 deletions src/Microsoft.OpenApi/Reader/V3/OpenApiV3Deserializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,15 @@

private static IOpenApiExtension LoadExtension(string name, ParseNode node)
{
if (node.Context.ExtensionParsers.TryGetValue(name, out var parser))
if (node.Context.ExtensionParsers.TryGetValue(name, out var parser) && parser(
node.CreateAny(), OpenApiSpecVersion.OpenApi3_0) is { } result)
{
return parser(node.CreateAny(), OpenApiSpecVersion.OpenApi3_0);
return result;
}
else
{
return node.CreateAny();
}

Check notice

Code scanning / CodeQL

Missed ternary opportunity Note

Both branches of this 'if' statement return - consider using '?' to express intent better.
}

private static string LoadString(ParseNode node)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="6.0.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.7.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.8" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" PrivateAssets="all" />
<PackageReference Include="coverlet.collector" Version="6.0.2" PrivateAssets="all" />
</ItemGroup>

Expand Down
25 changes: 25 additions & 0 deletions test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,31 @@ public async Task ValidateCommandProcessesOpenApi()
Assert.True(true);
}

[Fact]
public async Task ValidFileReturnsTrue()
{
var isValid = await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger);

Assert.True(isValid);
}

[Fact]
public async Task InvalidFileReturnsFalse()
{
var isValid = await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "InvalidSampleOpenApi.yml"), _logger);

Assert.False(isValid);
}

[Fact]
public async Task CancellingValidationReturnsNull()
{
using var cts = new CancellationTokenSource();
await cts.CancelAsync();
var isValid = await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger, cts.Token);

Assert.Null(isValid);
}

[Fact]
public async Task TransformCommandConvertsOpenApi()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
openapi: 3.0.0
info:
title: Sample OpenApi
version: 1.0.0
paths:
/api/editresource:
get:
operationId: api.ListEditresource
patch:
operationId: api.UpdateEditresource
responses:
'200':
description: OK
/api/viewresource:
get:
operationId: api.ListViewresource
responses:
'200':
description: OK
Loading
Loading