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

BREAKING CHANGE: Rename Microsoft.OpenApi.Readers to Microsoft.OpenApi.YamlReader #2166

Merged
merged 10 commits into from
Mar 18, 2025
28 changes: 14 additions & 14 deletions .azure-pipelines/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ extends:
displayName: 'pack OpenAPI'

# Pack readers
- pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg
- pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi.YamlReader/Microsoft.OpenApi.YamlReader.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg
displayName: 'pack Readers'

# Pack hidi
- pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg
displayName: 'pack Hidi'

# - pwsh: dotnet pack $(Build.SourcesDirectory)/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -o $(Build.ArtifactStagingDirectory) --configuration $(BuildConfiguration) --no-build --include-symbols --include-source /p:SymbolPackageFormat=snupkg
# displayName: 'pack Hidi'
- task: EsrpCodeSigning@5
displayName: 'ESRP CodeSigning Nuget Packages'
inputs:
Expand Down Expand Up @@ -183,14 +183,14 @@ extends:
PendingAnalysisWaitTimeoutMinutes: '5'

# publish hidi as an .exe
- task: DotNetCoreCLI@2
displayName: publish Hidi as executable
inputs:
command: 'publish'
arguments: -c Release --runtime win-x64 /p:PublishSingleFile=true /p:PackAsTool=false --self-contained --output $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi
projects: 'src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj'
publishWebProjects: False
zipAfterPublish: false
# - task: DotNetCoreCLI@2
# displayName: publish Hidi as executable
# inputs:
# command: 'publish'
# arguments: -c Release --runtime win-x64 /p:PublishSingleFile=true /p:PackAsTool=false --self-contained --output $(Build.ArtifactStagingDirectory)/Microsoft.OpenApi.Hidi
# projects: 'src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj'
# publishWebProjects: False
# zipAfterPublish: false

- task: CopyFiles@2
displayName: Prepare staging folder for upload
Expand Down Expand Up @@ -244,7 +244,7 @@ extends:
vmImage: ubuntu-latest
steps:
- powershell: |
$fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Readers.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg"
$fileNames = "$(Pipeline.Workspace)/Microsoft.OpenApi.Hidi.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg", "$(Pipeline.Workspace)/Microsoft.OpenApi.Workbench.*.nupkg"
foreach($fileName in $fileNames) {
if(Test-Path $fileName) {
rm $fileName -Verbose
Expand Down Expand Up @@ -278,7 +278,7 @@ extends:
- task: 1ES.PublishNuget@1
displayName: 'NuGet push'
inputs:
packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.Readers.*.nupkg'
packagesToPush: '$(Pipeline.Workspace)/Microsoft.OpenApi.YamlReader.*.nupkg'
packageParentPath: '$(Pipeline.Workspace)'
nuGetFeedType: external
publishFeedCredentials: 'OpenAPI Nuget Connection'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
run: |
$projectsArray = @(
'.\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj',
'.\src\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj',
'.\src\Microsoft.OpenApi.YamlReader\Microsoft.OpenApi.YamlReader.csproj',
'.\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj'
)

Expand Down
16 changes: 1 addition & 15 deletions Microsoft.OpenApi.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.Workbench", "src\Microsoft.OpenApi.Workbench\Microsoft.OpenApi.Workbench.csproj", "{6A5E91E5-0441-46EE-AEB9-8334981B7F08}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.Readers", "src\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj", "{79933258-0126-4382-8755-D50820ECC483}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.YamlReader", "src\Microsoft.OpenApi.YamlReader\Microsoft.OpenApi.YamlReader.csproj", "{79933258-0126-4382-8755-D50820ECC483}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.Tests", "test\Microsoft.OpenApi.Tests\Microsoft.OpenApi.Tests.csproj", "{AD83F991-DBF3-4251-8613-9CC54C826964}"
EndProject
Expand All @@ -24,10 +24,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E546B92F-20A
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{6357D7FD-2DE4-4900-ADB9-ABC37052040A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.Hidi", "src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj", "{254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OpenApi.Hidi.Tests", "test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj", "{D8F799DD-04AC-4A13-B344-45A5B944450A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OpenApi.Trimming.Tests", "test\Microsoft.OpenApi.Trimming.Tests\Microsoft.OpenApi.Trimming.Tests.csproj", "{1D2E0C6E-B103-4CB6-912E-D56FA1501296}"
EndProject
Global
Expand Down Expand Up @@ -56,14 +52,6 @@ Global
{1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237}.Release|Any CPU.Build.0 = Release|Any CPU
{254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}.Release|Any CPU.Build.0 = Release|Any CPU
{D8F799DD-04AC-4A13-B344-45A5B944450A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D8F799DD-04AC-4A13-B344-45A5B944450A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D8F799DD-04AC-4A13-B344-45A5B944450A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D8F799DD-04AC-4A13-B344-45A5B944450A}.Release|Any CPU.Build.0 = Release|Any CPU
{1D2E0C6E-B103-4CB6-912E-D56FA1501296}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D2E0C6E-B103-4CB6-912E-D56FA1501296}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D2E0C6E-B103-4CB6-912E-D56FA1501296}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -78,8 +66,6 @@ Global
{79933258-0126-4382-8755-D50820ECC483} = {E546B92F-20A8-49C3-8323-4B25BB78F3E1}
{AD83F991-DBF3-4251-8613-9CC54C826964} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A}
{1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A}
{254841B5-7DAC-4D1D-A9C5-44FE5CE467BE} = {E546B92F-20A8-49C3-8323-4B25BB78F3E1}
{D8F799DD-04AC-4A13-B344-45A5B944450A} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A}
{1D2E0C6E-B103-4CB6-912E-D56FA1501296} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj" />
<ProjectReference Include="..\Microsoft.OpenApi.YamlReader\Microsoft.OpenApi.YamlReader.csproj" />
<ProjectReference Include="..\Microsoft.OpenApi\Microsoft.OpenApi.csproj" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/Microsoft.OpenApi.Hidi/OpenApiService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.OData;
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.Readers;
using Microsoft.OpenApi.Services;
using Microsoft.OpenApi.Writers;
using Microsoft.OpenApi.YamlReader;
using static Microsoft.OpenApi.Hidi.OpenApiSpecVersionHelper;

namespace Microsoft.OpenApi.Hidi
Expand Down Expand Up @@ -394,7 +394,7 @@
new Uri("file://" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar),
HttpClient = httpClient.Value
};
settings.AddYamlReader();

Check failure on line 397 in src/Microsoft.OpenApi.Hidi/OpenApiService.cs

View workflow job for this annotation

GitHub Actions / CodeQL Analysis

The call is ambiguous between the following methods or properties: 'Microsoft.OpenApi.Reader.OpenApiReaderSettingsExtensions.AddYamlReader(Microsoft.OpenApi.Reader.OpenApiReaderSettings)' and 'Microsoft.OpenApi.Reader.OpenApiReaderSettingsExtensions.AddYamlReader(Microsoft.OpenApi.Reader.OpenApiReaderSettings)'

Check failure on line 397 in src/Microsoft.OpenApi.Hidi/OpenApiService.cs

View workflow job for this annotation

GitHub Actions / CodeQL Analysis

The call is ambiguous between the following methods or properties: 'Microsoft.OpenApi.Reader.OpenApiReaderSettingsExtensions.AddYamlReader(Microsoft.OpenApi.Reader.OpenApiReaderSettings)' and 'Microsoft.OpenApi.Reader.OpenApiReaderSettingsExtensions.AddYamlReader(Microsoft.OpenApi.Reader.OpenApiReaderSettings)'

result = await OpenApiDocument.LoadAsync(stream, settings: settings, cancellationToken: cancellationToken).ConfigureAwait(false);

Expand Down
3 changes: 2 additions & 1 deletion src/Microsoft.OpenApi.Workbench/MainModel.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 All @@ -13,6 +13,7 @@
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.Services;
using Microsoft.OpenApi.Validations;
using Microsoft.OpenApi.YamlReader;
using Microsoft.OpenApi.Writers;

namespace Microsoft.OpenApi.Workbench
Expand Down Expand Up @@ -209,7 +210,7 @@
/// The core method of the class.
/// Runs the parsing and serializing.
/// </summary>
internal async Task ParseDocumentAsync()

Check warning on line 213 in src/Microsoft.OpenApi.Workbench/MainModel.cs

View workflow job for this annotation

GitHub Actions / Build

Refactor this method to reduce its Cognitive Complexity from 16 to the 15 allowed. (https://rules.sonarsource.com/csharp/RSPEC-3776)
{
Stream stream = null;
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<Resource Include="Themes\Metro\HowToApplyTheme.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj" />
<ProjectReference Include="..\Microsoft.OpenApi.YamlReader\Microsoft.OpenApi.YamlReader.csproj" />
<ProjectReference Include="..\Microsoft.OpenApi\Microsoft.OpenApi.csproj" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<!-- net6.0 target is present because of the conditional build in OpenApiYamlReader.Read -->
<LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>OpenAPI.NET Readers for JSON and YAML documents</Description>
<Description>OpenAPI.NET Reader for YAML documents</Description>
<SignAssembly>true</SignAssembly>
<IsTrimmable Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)','net5.0'))">true</IsTrimmable>
<IsAotCompatible Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)','net8.0'))">true</IsAotCompatible>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Readers;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.YamlReader;

namespace Microsoft.OpenApi.Reader;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using System.Linq;
using System.Text;

namespace Microsoft.OpenApi.Readers
namespace Microsoft.OpenApi.YamlReader
{
/// <summary>
/// Reader for parsing YAML files into an OpenAPI document.
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using SharpYaml;
using SharpYaml.Serialization;

namespace Microsoft.OpenApi.Reader
namespace Microsoft.OpenApi.YamlReader
{
/// <summary>
/// Provides extensions to convert YAML models to JSON models.
Expand Down Expand Up @@ -117,7 +117,7 @@
case ScalarStyle.Plain:
return decimal.TryParse(yaml.Value, NumberStyles.Float, CultureInfo.InvariantCulture, out var d)
? JsonValue.Create(d)
: bool.TryParse(yaml.Value, out var b)

Check warning on line 120 in src/Microsoft.OpenApi.YamlReader/YamlConverter.cs

View workflow job for this annotation

GitHub Actions / Build

Extract this nested ternary operation into an independent statement. (https://rules.sonarsource.com/csharp/RSPEC-3358)

Check warning on line 120 in src/Microsoft.OpenApi.YamlReader/YamlConverter.cs

View workflow job for this annotation

GitHub Actions / Build

Extract this nested ternary operation into an independent statement. (https://rules.sonarsource.com/csharp/RSPEC-3358)

Check warning on line 120 in src/Microsoft.OpenApi.YamlReader/YamlConverter.cs

View workflow job for this annotation

GitHub Actions / Build

Extract this nested ternary operation into an independent statement. (https://rules.sonarsource.com/csharp/RSPEC-3358)

Check warning on line 120 in src/Microsoft.OpenApi.YamlReader/YamlConverter.cs

View workflow job for this annotation

GitHub Actions / Build

Extract this nested ternary operation into an independent statement. (https://rules.sonarsource.com/csharp/RSPEC-3358)
? JsonValue.Create(b)
: JsonValue.Create(yaml.Value)!;
case ScalarStyle.SingleQuoted:
Expand All @@ -127,7 +127,7 @@
case ScalarStyle.Any:
return JsonValue.Create(yaml.Value)!;
default:
throw new ArgumentOutOfRangeException();

Check warning on line 130 in src/Microsoft.OpenApi.YamlReader/YamlConverter.cs

View workflow job for this annotation

GitHub Actions / Build

Use a constructor overloads that allows a more meaningful exception message to be provided. (https://rules.sonarsource.com/csharp/RSPEC-3928)

Check warning on line 130 in src/Microsoft.OpenApi.YamlReader/YamlConverter.cs

View workflow job for this annotation

GitHub Actions / Build

Use a constructor overloads that allows a more meaningful exception message to be provided. (https://rules.sonarsource.com/csharp/RSPEC-3928)

Check warning on line 130 in src/Microsoft.OpenApi.YamlReader/YamlConverter.cs

View workflow job for this annotation

GitHub Actions / Build

Use a constructor overloads that allows a more meaningful exception message to be provided. (https://rules.sonarsource.com/csharp/RSPEC-3928)

Check warning on line 130 in src/Microsoft.OpenApi.YamlReader/YamlConverter.cs

View workflow job for this annotation

GitHub Actions / Build

Use a constructor overloads that allows a more meaningful exception message to be provided. (https://rules.sonarsource.com/csharp/RSPEC-3928)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj" />
<ProjectReference Include="..\..\src\Microsoft.OpenApi.YamlReader\Microsoft.OpenApi.YamlReader.csproj" />
<ProjectReference Include="..\..\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.OData;
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.Readers;
using Microsoft.OpenApi.YamlReader;
using Microsoft.OpenApi.Services;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.OpenApi.YamlReader\Microsoft.OpenApi.YamlReader.csproj" />
<ProjectReference Include="..\..\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj" />
<ProjectReference Include="..\..\src\Microsoft.OpenApi.Readers\Microsoft.OpenApi.Readers.csproj" />
<ProjectReference Include="..\Microsoft.OpenApi.Tests\Microsoft.OpenApi.Tests.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.YamlReader;
using Xunit;

namespace Microsoft.OpenApi.Readers.Tests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using System.IO;
using Microsoft.OpenApi.Interfaces;
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.YamlReader;

namespace Microsoft.OpenApi.Readers.Tests.OpenApiReaderTests
{
Expand Down
2 changes: 1 addition & 1 deletion test/Microsoft.OpenApi.Readers.Tests/ParseNodeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.OpenApi.Exceptions;
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.Readers;
using Microsoft.OpenApi.YamlReader;
using Xunit;

namespace Microsoft.OpenApi.Tests
Expand Down
3 changes: 2 additions & 1 deletion test/Microsoft.OpenApi.Readers.Tests/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Linq;
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.Reader.ParseNodes;
using Microsoft.OpenApi.YamlReader;
using SharpYaml.Serialization;

namespace Microsoft.OpenApi.Readers.Tests
Expand All @@ -15,7 +16,7 @@ public static MapNode CreateYamlMapNode(Stream stream)
{
var yamlStream = new YamlStream();
yamlStream.Load(new StreamReader(stream));
var yamlNode = yamlStream.Documents.First().RootNode;
var yamlNode = yamlStream.Documents[0].RootNode;

var context = new ParsingContext(new OpenApiDiagnostic());
var asJsonNode = yamlNode.ToJsonNode();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.Reader.ParseNodes;
using Microsoft.OpenApi.Reader.V2;
using Microsoft.OpenApi.YamlReader;
using SharpYaml.Serialization;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.Reader.ParseNodes;
using Microsoft.OpenApi.Reader.V31;
using Microsoft.OpenApi.YamlReader;
using SharpYaml.Serialization;
using Xunit;

Expand All @@ -20,7 +21,7 @@ public void ParseBasicInfoShouldSucceed()
using var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "basicInfo.yaml"));
var yamlStream = new YamlStream();
yamlStream.Load(new StreamReader(stream));
var yamlNode = yamlStream.Documents.First().RootNode;
var yamlNode = yamlStream.Documents[0].RootNode;

var diagnostic = new OpenApiDiagnostic();
var context = new ParsingContext(diagnostic);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.Reader.ParseNodes;
using Microsoft.OpenApi.Reader.V31;
using Microsoft.OpenApi.YamlReader;
using SharpYaml.Serialization;
using Xunit;

Expand All @@ -23,7 +24,7 @@ public void ParseLicenseWithSpdxIdentifierShouldSucceed()
using var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "licenseWithSpdxIdentifier.yaml"));
var yamlStream = new YamlStream();
yamlStream.Load(new StreamReader(stream));
var yamlNode = yamlStream.Documents.First().RootNode;
var yamlNode = yamlStream.Documents[0].RootNode;

var diagnostic = new OpenApiDiagnostic();
var context = new ParsingContext(diagnostic);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
using Microsoft.OpenApi.Models.References;
using System.Threading.Tasks;
using System.Net.Http;
using Microsoft.OpenApi.YamlReader;

namespace Microsoft.OpenApi.Readers.Tests.V3Tests
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="SharpYaml" Version="2.1.1" />
<PackageReference Include="System.Text.Json" Version="9.0.3" />
<PackageReference Include="Verify.Xunit" Version="28.16.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2" PrivateAssets="all" />
Expand All @@ -22,7 +23,8 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj" />
<!--<ProjectReference Include="..\..\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj" />-->
<ProjectReference Include="..\..\src\Microsoft.OpenApi.YamlReader\Microsoft.OpenApi.YamlReader.csproj" />
<ProjectReference Include="..\..\src\Microsoft.OpenApi\Microsoft.OpenApi.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
using Microsoft.OpenApi.Models.Interfaces;
using Microsoft.OpenApi.Models.References;
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.Readers;
using Microsoft.OpenApi.Writers;
using Microsoft.OpenApi.YamlReader;
using Microsoft.VisualBasic;
using VerifyXunit;
using Xunit;
Expand Down Expand Up @@ -1848,7 +1848,7 @@
}

[Fact]
public void SerializeExamplesDoesNotThrowNullReferenceException()

Check warning on line 1851 in test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs

View workflow job for this annotation

GitHub Actions / Build

Add at least one assertion to this test case. (https://rules.sonarsource.com/csharp/RSPEC-2699)
{
OpenApiDocument doc = new OpenApiDocument
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.References;
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.Readers;
using Microsoft.OpenApi.Writers;
using Microsoft.OpenApi.YamlReader;
using VerifyXunit;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.References;
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.Readers;
using Microsoft.OpenApi.Writers;
using Microsoft.OpenApi.YamlReader;
using VerifyXunit;
using Xunit;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.References;
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.Readers;
using Microsoft.OpenApi.YamlReader;
using Microsoft.OpenApi.Writers;
using VerifyXunit;
using Xunit;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using Microsoft.OpenApi.Models;
using Microsoft.OpenApi.Models.References;
using Microsoft.OpenApi.Reader;
using Microsoft.OpenApi.Readers;
using Microsoft.OpenApi.YamlReader;
using Microsoft.OpenApi.Writers;
using VerifyXunit;
using Xunit;
Expand Down
Loading
Loading