From 05cb00275f5ced9c393944ed17044f3e8e992a13 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 26 Nov 2024 16:34:25 +0300 Subject: [PATCH 1/3] Rename OpenApi.Readers lib to OpenApi.YamlReader --- Microsoft.OpenApi.sln | 2 +- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- src/Microsoft.OpenApi.Workbench/MainModel.cs | 2 +- .../Microsoft.OpenApi.Workbench.csproj | 2 +- .../Microsoft.OpenApi.YamlReader.csproj} | 0 .../OpenApiYamlReader.cs | 2 +- .../Properties/AssemblyInfo.cs | 0 .../Properties/SRResource.Designer.cs | 0 .../Properties/SRResource.resx | 0 .../YamlConverter.cs | 2 +- .../Services/OpenApiServiceTests.cs | 4 ++-- .../Microsoft.OpenApi.Readers.Tests.csproj | 3 ++- .../OpenApiReaderTests/OpenApiDiagnosticTests.cs | 2 +- .../OpenApiReaderTests/OpenApiStreamReaderTests.cs | 3 ++- .../OpenApiWorkspaceTests/OpenApiWorkspaceStreamTests.cs | 7 +++---- test/Microsoft.OpenApi.Readers.Tests/ParseNodeTests.cs | 2 +- .../ReferenceService/TryLoadReferenceV2Tests.cs | 1 + .../Microsoft.OpenApi.Readers.Tests/TestCustomExtension.cs | 2 +- test/Microsoft.OpenApi.Readers.Tests/TestHelper.cs | 6 +++--- .../V2Tests/ComparisonTests.cs | 3 ++- .../V2Tests/OpenApiDocumentTests.cs | 4 ++-- .../V2Tests/OpenApiSecuritySchemeTests.cs | 3 ++- .../V2Tests/OpenApiServerTests.cs | 3 ++- .../V31Tests/OpenApiDocumentTests.cs | 5 ++--- .../V31Tests/OpenApiInfoTests.cs | 3 ++- .../V31Tests/OpenApiLicenseTests.cs | 3 ++- .../V31Tests/OpenApiSchemaTests.cs | 1 + .../V3Tests/OpenApiCallbackTests.cs | 1 + .../V3Tests/OpenApiDiscriminatorTests.cs | 1 + .../V3Tests/OpenApiDocumentTests.cs | 4 ++-- .../V3Tests/OpenApiEncodingTests.cs | 1 + .../V3Tests/OpenApiExampleTests.cs | 3 ++- .../V3Tests/OpenApiInfoTests.cs | 1 + .../V3Tests/OpenApiMediaTypeTests.cs | 1 + .../V3Tests/OpenApiOperationTests.cs | 3 ++- .../V3Tests/OpenApiParameterTests.cs | 4 +--- .../V3Tests/OpenApiResponseTests.cs | 1 + .../V3Tests/OpenApiSchemaTests.cs | 3 ++- .../V3Tests/OpenApiSecuritySchemeTests.cs | 1 + .../V3Tests/OpenApiXmlTests.cs | 1 + .../Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs | 5 ++--- .../Models/References/OpenApiCallbackReferenceTests.cs | 5 ++--- .../Models/References/OpenApiExampleReferenceTests.cs | 3 +-- .../Models/References/OpenApiHeaderReferenceTests.cs | 3 +-- .../Models/References/OpenApiLinkReferenceTests.cs | 3 +-- .../Models/References/OpenApiParameterReferenceTests.cs | 3 +-- .../Models/References/OpenApiPathItemReferenceTests.cs | 3 +-- .../Models/References/OpenApiRequestBodyReferenceTests.cs | 3 +-- .../Models/References/OpenApiResponseReferenceTest.cs | 3 +-- .../References/OpenApiSecuritySchemeReferenceTests.cs | 2 +- .../Models/References/OpenApiTagReferenceTest.cs | 2 +- 52 files changed, 68 insertions(+), 61 deletions(-) rename src/{Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj => Microsoft.OpenApi.YamlReader/Microsoft.OpenApi.YamlReader.csproj} (100%) rename src/{Microsoft.OpenApi.Readers => Microsoft.OpenApi.YamlReader}/OpenApiYamlReader.cs (98%) rename src/{Microsoft.OpenApi.Readers => Microsoft.OpenApi.YamlReader}/Properties/AssemblyInfo.cs (100%) rename src/{Microsoft.OpenApi.Readers => Microsoft.OpenApi.YamlReader}/Properties/SRResource.Designer.cs (100%) rename src/{Microsoft.OpenApi.Readers => Microsoft.OpenApi.YamlReader}/Properties/SRResource.resx (100%) rename src/{Microsoft.OpenApi.Readers => Microsoft.OpenApi.YamlReader}/YamlConverter.cs (99%) diff --git a/Microsoft.OpenApi.sln b/Microsoft.OpenApi.sln index a39756a42..aa64dc5be 100644 --- a/Microsoft.OpenApi.sln +++ b/Microsoft.OpenApi.sln @@ -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 diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 2b0582db7..47ef0b906 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -49,7 +49,7 @@ - + diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 7dfb5d797..5afdbeb46 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -30,9 +30,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 diff --git a/src/Microsoft.OpenApi.Workbench/MainModel.cs b/src/Microsoft.OpenApi.Workbench/MainModel.cs index d518645a5..65f8e1ba5 100644 --- a/src/Microsoft.OpenApi.Workbench/MainModel.cs +++ b/src/Microsoft.OpenApi.Workbench/MainModel.cs @@ -11,7 +11,7 @@ using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; -using Microsoft.OpenApi.Readers; +using Microsoft.OpenApi.YamlReader; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Validations; diff --git a/src/Microsoft.OpenApi.Workbench/Microsoft.OpenApi.Workbench.csproj b/src/Microsoft.OpenApi.Workbench/Microsoft.OpenApi.Workbench.csproj index 3210463df..660a7b9dd 100644 --- a/src/Microsoft.OpenApi.Workbench/Microsoft.OpenApi.Workbench.csproj +++ b/src/Microsoft.OpenApi.Workbench/Microsoft.OpenApi.Workbench.csproj @@ -20,7 +20,7 @@ - + diff --git a/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj b/src/Microsoft.OpenApi.YamlReader/Microsoft.OpenApi.YamlReader.csproj similarity index 100% rename from src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj rename to src/Microsoft.OpenApi.YamlReader/Microsoft.OpenApi.YamlReader.csproj diff --git a/src/Microsoft.OpenApi.Readers/OpenApiYamlReader.cs b/src/Microsoft.OpenApi.YamlReader/OpenApiYamlReader.cs similarity index 98% rename from src/Microsoft.OpenApi.Readers/OpenApiYamlReader.cs rename to src/Microsoft.OpenApi.YamlReader/OpenApiYamlReader.cs index cff6dd1da..65b8dcba5 100644 --- a/src/Microsoft.OpenApi.Readers/OpenApiYamlReader.cs +++ b/src/Microsoft.OpenApi.YamlReader/OpenApiYamlReader.cs @@ -12,7 +12,7 @@ using System.Linq; using Microsoft.OpenApi.Models; -namespace Microsoft.OpenApi.Readers +namespace Microsoft.OpenApi.YamlReader { /// /// Reader for parsing YAML files into an OpenAPI document. diff --git a/src/Microsoft.OpenApi.Readers/Properties/AssemblyInfo.cs b/src/Microsoft.OpenApi.YamlReader/Properties/AssemblyInfo.cs similarity index 100% rename from src/Microsoft.OpenApi.Readers/Properties/AssemblyInfo.cs rename to src/Microsoft.OpenApi.YamlReader/Properties/AssemblyInfo.cs diff --git a/src/Microsoft.OpenApi.Readers/Properties/SRResource.Designer.cs b/src/Microsoft.OpenApi.YamlReader/Properties/SRResource.Designer.cs similarity index 100% rename from src/Microsoft.OpenApi.Readers/Properties/SRResource.Designer.cs rename to src/Microsoft.OpenApi.YamlReader/Properties/SRResource.Designer.cs diff --git a/src/Microsoft.OpenApi.Readers/Properties/SRResource.resx b/src/Microsoft.OpenApi.YamlReader/Properties/SRResource.resx similarity index 100% rename from src/Microsoft.OpenApi.Readers/Properties/SRResource.resx rename to src/Microsoft.OpenApi.YamlReader/Properties/SRResource.resx diff --git a/src/Microsoft.OpenApi.Readers/YamlConverter.cs b/src/Microsoft.OpenApi.YamlReader/YamlConverter.cs similarity index 99% rename from src/Microsoft.OpenApi.Readers/YamlConverter.cs rename to src/Microsoft.OpenApi.YamlReader/YamlConverter.cs index 7d338ffa1..e2fc5f434 100644 --- a/src/Microsoft.OpenApi.Readers/YamlConverter.cs +++ b/src/Microsoft.OpenApi.YamlReader/YamlConverter.cs @@ -6,7 +6,7 @@ using SharpYaml; using SharpYaml.Serialization; -namespace Microsoft.OpenApi.Reader +namespace Microsoft.OpenApi.YamlReader { /// /// Provides extensions to convert YAML models to JSON models. diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 798b7532e..97a071567 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -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.CommandLine; @@ -12,8 +12,8 @@ using Microsoft.OpenApi.Models; using Microsoft.OpenApi.OData; using Microsoft.OpenApi.Reader; -using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Services; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Hidi.Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj b/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj index eeac984a0..a9b8fedd6 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj +++ b/test/Microsoft.OpenApi.Readers.Tests/Microsoft.OpenApi.Readers.Tests.csproj @@ -27,8 +27,9 @@ + - + diff --git a/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiDiagnosticTests.cs b/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiDiagnosticTests.cs index 5ecd58071..3e4a4a4ad 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiDiagnosticTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiDiagnosticTests.cs @@ -5,12 +5,12 @@ using System.Threading.Tasks; using System; using FluentAssertions; -using Microsoft.OpenApi.Exceptions; using Microsoft.OpenApi.Models; using Xunit; using System.IO; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; namespace Microsoft.OpenApi.Readers.Tests.OpenApiReaderTests { diff --git a/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiStreamReaderTests.cs b/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiStreamReaderTests.cs index 82a410946..6331b0a22 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiStreamReaderTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiStreamReaderTests.cs @@ -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; @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.OpenApiReaderTests diff --git a/test/Microsoft.OpenApi.Readers.Tests/OpenApiWorkspaceTests/OpenApiWorkspaceStreamTests.cs b/test/Microsoft.OpenApi.Readers.Tests/OpenApiWorkspaceTests/OpenApiWorkspaceStreamTests.cs index 4aca9b54e..b10376c26 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/OpenApiWorkspaceTests/OpenApiWorkspaceStreamTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/OpenApiWorkspaceTests/OpenApiWorkspaceStreamTests.cs @@ -1,17 +1,16 @@ -using System; +using System; using System.IO; using System.Threading.Tasks; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.OpenApiWorkspaceTests { public class OpenApiWorkspaceStreamTests - { - private const string SampleFolderPath = "V3Tests/Samples/OpenApiWorkspace/"; - + { public OpenApiWorkspaceStreamTests() { OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader()); diff --git a/test/Microsoft.OpenApi.Readers.Tests/ParseNodeTests.cs b/test/Microsoft.OpenApi.Readers.Tests/ParseNodeTests.cs index 3f7c669b0..b7e2704b2 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/ParseNodeTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/ParseNodeTests.cs @@ -6,7 +6,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 diff --git a/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs b/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs index d6fb3b8ba..074ccde22 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/ReferenceService/TryLoadReferenceV2Tests.cs @@ -7,6 +7,7 @@ using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.ReferenceService diff --git a/test/Microsoft.OpenApi.Readers.Tests/TestCustomExtension.cs b/test/Microsoft.OpenApi.Readers.Tests/TestCustomExtension.cs index 9d7727aae..8b971c976 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/TestCustomExtension.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/TestCustomExtension.cs @@ -7,6 +7,7 @@ using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Writers; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests @@ -39,7 +40,6 @@ public void ParseCustomExtension() }; OpenApiReaderRegistry.RegisterReader("yaml", new OpenApiYamlReader()); - var diag = new OpenApiDiagnostic(); var actual = OpenApiDocument.Parse(description, "yaml", settings: settings); var fooExtension = actual.OpenApiDocument.Info.Extensions["x-foo"] as FooExtension; diff --git a/test/Microsoft.OpenApi.Readers.Tests/TestHelper.cs b/test/Microsoft.OpenApi.Readers.Tests/TestHelper.cs index f8b222c36..32ee4d53c 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/TestHelper.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/TestHelper.cs @@ -2,20 +2,20 @@ // Licensed under the MIT license. using System.IO; -using System.Linq; using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Reader.ParseNodes; +using Microsoft.OpenApi.YamlReader; using SharpYaml.Serialization; namespace Microsoft.OpenApi.Readers.Tests { - internal class TestHelper + internal static class TestHelper { 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(); diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/ComparisonTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/ComparisonTests.cs index b3e30c672..08a4381a0 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/ComparisonTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/ComparisonTests.cs @@ -1,10 +1,11 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System.IO; using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V2Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs index 596269644..0249fc673 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs @@ -12,6 +12,7 @@ using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V2Tests @@ -329,8 +330,7 @@ public void ParseDocumentWithDefaultContentTypeSettingShouldSucceed() public void testContentType() { var contentType = "application/json; charset = utf-8"; - var res = contentType.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).First(); - var expected = res.Split('/').LastOrDefault(); + var res = contentType.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)[0]; Assert.Equal("application/json", res); } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSecuritySchemeTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSecuritySchemeTests.cs index 82565facd..c30d47c7a 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSecuritySchemeTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiSecuritySchemeTests.cs @@ -9,6 +9,7 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Reader.ParseNodes; using Microsoft.OpenApi.Reader.V2; +using Microsoft.OpenApi.YamlReader; using SharpYaml.Serialization; using Xunit; @@ -216,7 +217,7 @@ static YamlDocument LoadYamlDocument(Stream input) using var reader = new StreamReader(input); var yamlStream = new YamlStream(); yamlStream.Load(reader); - return yamlStream.Documents.First(); + return yamlStream.Documents[0]; } } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs index 2e5779adb..a3f19e753 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs @@ -1,7 +1,8 @@ -using System.Linq; +using System.Linq; using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V2Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs index 638d69667..d429022b5 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Globalization; using System.IO; using System.Threading.Tasks; @@ -9,10 +9,9 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Tests; using Microsoft.OpenApi.Writers; -using Microsoft.OpenApi.Services; using Xunit; -using System.Linq; using VerifyXunit; +using Microsoft.OpenApi.YamlReader; namespace Microsoft.OpenApi.Readers.Tests.V31Tests { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiInfoTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiInfoTests.cs index 8ecfcf7d5..063c2a51a 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiInfoTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiInfoTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using FluentAssertions; @@ -6,6 +6,7 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Reader.ParseNodes; using Microsoft.OpenApi.Reader.V31; +using Microsoft.OpenApi.YamlReader; using SharpYaml.Serialization; using Xunit; diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiLicenseTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiLicenseTests.cs index cb617064e..255cbe058 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiLicenseTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiLicenseTests.cs @@ -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.IO; @@ -8,6 +8,7 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Reader.ParseNodes; using Microsoft.OpenApi.Reader.V31; +using Microsoft.OpenApi.YamlReader; using SharpYaml.Serialization; using Xunit; diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs index 967bb0f3e..e23e87895 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiSchemaTests.cs @@ -10,6 +10,7 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Tests; using Microsoft.OpenApi.Writers; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V31Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiCallbackTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiCallbackTests.cs index cab621c14..166d7e173 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiCallbackTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiCallbackTests.cs @@ -7,6 +7,7 @@ using Microsoft.OpenApi.Expressions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V3Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDiscriminatorTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDiscriminatorTests.cs index 6556ade48..769ec72ab 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDiscriminatorTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDiscriminatorTests.cs @@ -5,6 +5,7 @@ using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V3Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs index 1382d0248..ca3d1c7bc 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs @@ -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; @@ -16,7 +16,7 @@ using Microsoft.OpenApi.Validations; using Microsoft.OpenApi.Validations.Rules; using Microsoft.OpenApi.Writers; -using SharpYaml.Model; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V3Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiEncodingTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiEncodingTests.cs index eaf802d8c..e323d5205 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiEncodingTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiEncodingTests.cs @@ -5,6 +5,7 @@ using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V3Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs index 84f028f6b..0ec7cda42 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs @@ -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.IO; @@ -7,6 +7,7 @@ using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V3Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiInfoTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiInfoTests.cs index 2fa75cf60..b18b72480 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiInfoTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiInfoTests.cs @@ -8,6 +8,7 @@ using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V3Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiMediaTypeTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiMediaTypeTests.cs index 26de35edb..10075ba84 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiMediaTypeTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiMediaTypeTests.cs @@ -8,6 +8,7 @@ using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Reader.ParseNodes; using Microsoft.OpenApi.Reader.V3; +using Microsoft.OpenApi.YamlReader; using Microsoft.OpenApi.Tests; using Xunit; diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiOperationTests.cs index 9ba96bbda..17817d82c 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiOperationTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiOperationTests.cs @@ -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.IO; @@ -7,6 +7,7 @@ using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V3Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs index e0f6460aa..0f44fde8b 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs @@ -2,15 +2,13 @@ // Licensed under the MIT license. using System.Collections.Generic; -using System; using System.IO; using FluentAssertions; -using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; using Xunit; using Microsoft.OpenApi.Reader.V3; -using Microsoft.OpenApi.Services; +using Microsoft.OpenApi.YamlReader; namespace Microsoft.OpenApi.Readers.Tests.V3Tests { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiResponseTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiResponseTests.cs index 09a1d00a1..7bffc466b 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiResponseTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiResponseTests.cs @@ -6,6 +6,7 @@ using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V3Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs index 81cb4376b..f4b1f2e4c 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs @@ -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.Collections.Generic; @@ -16,6 +16,7 @@ using Microsoft.OpenApi.Reader.V3; using FluentAssertions.Equivalency; using Microsoft.OpenApi.Models.References; +using Microsoft.OpenApi.YamlReader; namespace Microsoft.OpenApi.Readers.Tests.V3Tests { diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSecuritySchemeTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSecuritySchemeTests.cs index ef1aa0fdb..b2b8d05c0 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSecuritySchemeTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSecuritySchemeTests.cs @@ -6,6 +6,7 @@ using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V3Tests diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiXmlTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiXmlTests.cs index c0d99793e..bb12b2585 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiXmlTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiXmlTests.cs @@ -6,6 +6,7 @@ using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.YamlReader; using Xunit; namespace Microsoft.OpenApi.Readers.Tests.V3Tests diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs index 884ffa68c..4b4a25be0 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs @@ -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; @@ -13,12 +13,11 @@ 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 Microsoft.VisualBasic; using VerifyXunit; using Xunit; -using Xunit.Abstractions; namespace Microsoft.OpenApi.Tests.Models { diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiCallbackReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiCallbackReferenceTests.cs index 3a16f4d2a..6e1b3c9b0 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiCallbackReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiCallbackReferenceTests.cs @@ -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.Globalization; @@ -8,9 +8,8 @@ using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader; -using Microsoft.OpenApi.Readers; -using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Writers; +using Microsoft.OpenApi.YamlReader; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiExampleReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiExampleReferenceTests.cs index 4ea8cdef9..237e7ead7 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiExampleReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiExampleReferenceTests.cs @@ -8,9 +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.Services; +using Microsoft.OpenApi.YamlReader; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiHeaderReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiHeaderReferenceTests.cs index cfdf4ab1c..5743b7785 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiHeaderReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiHeaderReferenceTests.cs @@ -8,11 +8,10 @@ using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader; -using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Writers; -using Microsoft.OpenApi.Services; using VerifyXunit; using Xunit; +using Microsoft.OpenApi.YamlReader; namespace Microsoft.OpenApi.Tests.Models.References { diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiLinkReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiLinkReferenceTests.cs index 87d2db06e..27941360e 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiLinkReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiLinkReferenceTests.cs @@ -8,9 +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.Services; +using Microsoft.OpenApi.YamlReader; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiParameterReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiParameterReferenceTests.cs index c00db94f5..87c7a4c88 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiParameterReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiParameterReferenceTests.cs @@ -8,9 +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.Services; +using Microsoft.OpenApi.YamlReader; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiPathItemReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiPathItemReferenceTests.cs index a2d9b525d..01c71d9ee 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiPathItemReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiPathItemReferenceTests.cs @@ -8,9 +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.Services; +using Microsoft.OpenApi.YamlReader; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiRequestBodyReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiRequestBodyReferenceTests.cs index 54521e83c..49a53e866 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiRequestBodyReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiRequestBodyReferenceTests.cs @@ -8,9 +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.Services; +using Microsoft.OpenApi.YamlReader; using VerifyXunit; using Xunit; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiResponseReferenceTest.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiResponseReferenceTest.cs index 4b6b25564..bc8674cbc 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiResponseReferenceTest.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiResponseReferenceTest.cs @@ -8,11 +8,10 @@ using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader; -using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Writers; -using Microsoft.OpenApi.Services; using VerifyXunit; using Xunit; +using Microsoft.OpenApi.YamlReader; namespace Microsoft.OpenApi.Tests.Models.References { diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiSecuritySchemeReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiSecuritySchemeReferenceTests.cs index 7fcd7dfd8..c74a3d86e 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiSecuritySchemeReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiSecuritySchemeReferenceTests.cs @@ -7,8 +7,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; diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiTagReferenceTest.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiTagReferenceTest.cs index 82f1b27a2..f5521b937 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiTagReferenceTest.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiTagReferenceTest.cs @@ -7,8 +7,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; From f407702b1f316c5d59c3b11796a18536d6358189 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 26 Nov 2024 16:35:26 +0300 Subject: [PATCH 2/3] use async overloads --- .../OpenApiReaderTests/OpenApiStreamReaderTests.cs | 6 +++--- .../V31Tests/OpenApiDocumentTests.cs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiStreamReaderTests.cs b/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiStreamReaderTests.cs index 6331b0a22..66beff944 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiStreamReaderTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiStreamReaderTests.cs @@ -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; @@ -49,7 +49,7 @@ public async Task StreamShouldNotBeDisposedIfLeaveStreamOpenSettingIsTrueAsync() memoryStream.Position = 0; var stream = memoryStream; - var result = OpenApiDocument.Load(stream, "yaml", new OpenApiReaderSettings { LeaveStreamOpen = true }); + _ = await OpenApiDocument.LoadAsync(stream, "yaml", new OpenApiReaderSettings { LeaveStreamOpen = true }); stream.Seek(0, SeekOrigin.Begin); // does not throw an object disposed exception Assert.True(stream.CanRead); } @@ -65,7 +65,7 @@ public async Task StreamShouldReadWhenInitializedAsync() var stream = await httpClient.GetStreamAsync("20fe7a7b720a0e48e5842d002ac418b12a8201df/tests/v3.0/pass/petstore.yaml"); // Read V3 as YAML - var result = OpenApiDocument.Load(stream, "yaml"); + var result = await OpenApiDocument.LoadAsync(stream, "yaml"); Assert.NotNull(result.OpenApiDocument); } } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs index d429022b5..9e857ad56 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs @@ -522,9 +522,9 @@ public async Task ParseExternalDocumentDereferenceToOpenApiDocumentByIdWorks() // Act var result = await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "externalRefById.yaml"), settings); - var doc2 = OpenApiDocument.Load(Path.Combine(SampleFolderPath, "externalResource.yaml")).OpenApiDocument; + var doc2 = (await OpenApiDocument.LoadAsync(Path.Combine(SampleFolderPath, "externalResource.yaml"))).OpenApiDocument; - var requestBodySchema = result.OpenApiDocument.Paths["/resource"].Operations[OperationType.Get].Parameters.First().Schema; + var requestBodySchema = result.OpenApiDocument.Paths["/resource"].Operations[OperationType.Get].Parameters[0].Schema; result.OpenApiDocument.Workspace.RegisterComponents(doc2); // Assert @@ -535,10 +535,10 @@ public async Task ParseExternalDocumentDereferenceToOpenApiDocumentByIdWorks() public async Task ParseDocumentWith31PropertiesWorks() { var path = Path.Combine(SampleFolderPath, "documentWith31Properties.yaml"); - var doc = OpenApiDocument.Load(path).OpenApiDocument; + var doc = (await OpenApiDocument.LoadAsync(path)).OpenApiDocument; var outputStringWriter = new StringWriter(); doc.SerializeAsV31(new OpenApiYamlWriter(outputStringWriter)); - outputStringWriter.Flush(); + await outputStringWriter.FlushAsync(); var actual = outputStringWriter.GetStringBuilder().ToString(); // Assert From 5dc7876eca654ad3823e41437866bd97525df8c6 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 26 Nov 2024 16:36:27 +0300 Subject: [PATCH 3/3] code cleanup --- .../Services/OpenApiFilterServiceTests.cs | 2 -- .../Services/OpenApiServiceTests.cs | 6 ++--- .../V2Tests/OpenApiServerTests.cs | 22 +++++++++---------- .../V31Tests/OpenApiDocumentTests.cs | 3 +-- .../V31Tests/OpenApiInfoTests.cs | 4 ++-- .../V31Tests/OpenApiLicenseTests.cs | 4 ++-- .../V3Tests/OpenApiDocumentTests.cs | 9 ++++---- .../V3Tests/OpenApiExampleTests.cs | 5 +---- .../V3Tests/OpenApiOperationTests.cs | 4 ++-- .../V3Tests/OpenApiSchemaTests.cs | 17 ++++++-------- .../Models/OpenApiDocumentTests.cs | 4 +--- .../OpenApiCallbackReferenceTests.cs | 6 ++--- .../Microsoft.OpenApi.Trimming.Tests.csproj | 2 +- 13 files changed, 38 insertions(+), 50 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 3bd9efd2a..61eec5e6a 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -3,11 +3,9 @@ using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Models; -using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Tests.UtilityFiles; using Moq; -using SharpYaml.Tokens; using Xunit; namespace Microsoft.OpenApi.Hidi.Tests diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 97a071567..3387b96b5 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -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.CommandLine; @@ -335,7 +335,7 @@ public async Task InvokeShowCommandAsync() var openApi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); var args = new[] { "show", "-d", openApi, "-o", "sample.md" }; var parseResult = rootCommand.Parse(args); - var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler; + var handler = rootCommand.Subcommands.First(c => c.Name == "show").Handler; var context = new InvocationContext(parseResult); await handler!.InvokeAsync(context); @@ -351,7 +351,7 @@ public async Task InvokePluginCommandAsync() var manifest = Path.Combine(".", "UtilityFiles", "exampleapimanifest.json"); var args = new[] { "plugin", "-m", manifest, "--of", AppDomain.CurrentDomain.BaseDirectory }; var parseResult = rootCommand.Parse(args); - var handler = rootCommand.Subcommands.Where(c => c.Name == "plugin").First().Handler; + var handler = rootCommand.Subcommands.First(c => c.Name == "plugin").Handler; var context = new InvocationContext(parseResult); await handler!.InvokeAsync(context); diff --git a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs index a3f19e753..45dac5817 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiServerTests.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using FluentAssertions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Reader; @@ -63,7 +63,7 @@ public void JustHostNoDefault() """; var result = OpenApiDocument.Parse(input, "yaml"); - var server = result.OpenApiDocument.Servers.First(); + var server = result.OpenApiDocument.Servers[0]; Assert.Single(result.OpenApiDocument.Servers); Assert.Equal("//www.foo.com", server.Url); } @@ -88,7 +88,7 @@ public void NoBasePath() }; var result = OpenApiDocument.Parse(input, "yaml", settings); - var server = result.OpenApiDocument.Servers.First(); + var server = result.OpenApiDocument.Servers[0]; Assert.Single(result.OpenApiDocument.Servers); Assert.Equal("http://www.foo.com", server.Url); } @@ -107,7 +107,7 @@ public void JustBasePathNoDefault() """; var result = OpenApiDocument.Parse(input, "yaml"); - var server = result.OpenApiDocument.Servers.First(); + var server = result.OpenApiDocument.Servers[0]; Assert.Single(result.OpenApiDocument.Servers); Assert.Equal("/baz", server.Url); } @@ -132,7 +132,7 @@ public void JustSchemeWithCustomHost() var result = OpenApiDocument.Parse(input, "yaml", settings); - var server = result.OpenApiDocument.Servers.First(); + var server = result.OpenApiDocument.Servers[0]; Assert.Single(result.OpenApiDocument.Servers); Assert.Equal("http://bing.com/foo", server.Url); } @@ -157,7 +157,7 @@ public void JustSchemeWithCustomHostWithEmptyPath() var result = OpenApiDocument.Parse(input, "yaml", settings); - var server = result.OpenApiDocument.Servers.First(); + var server = result.OpenApiDocument.Servers[0]; Assert.Single(result.OpenApiDocument.Servers); Assert.Equal("http://bing.com", server.Url); } @@ -181,7 +181,7 @@ public void JustBasePathWithCustomHost() var result = OpenApiDocument.Parse(input, "yaml", settings); - var server = result.OpenApiDocument.Servers.First(); + var server = result.OpenApiDocument.Servers[0]; Assert.Single(result.OpenApiDocument.Servers); Assert.Equal("https://bing.com/api", server.Url); } @@ -205,7 +205,7 @@ public void JustHostWithCustomHost() var result = OpenApiDocument.Parse(input, "yaml", settings); - var server = result.OpenApiDocument.Servers.First(); + var server = result.OpenApiDocument.Servers[0]; Assert.Single(result.OpenApiDocument.Servers); Assert.Equal("https://www.example.com", server.Url); } @@ -229,7 +229,7 @@ public void JustHostWithCustomHostWithApi() }; var result = OpenApiDocument.Parse(input, "yaml", settings); - var server = result.OpenApiDocument.Servers.First(); + var server = result.OpenApiDocument.Servers[0]; Assert.Single(result.OpenApiDocument.Servers); Assert.Equal("https://prod.bing.com", server.Url); } @@ -255,7 +255,7 @@ public void MultipleServers() }; var result = OpenApiDocument.Parse(input, "yaml", settings); - var server = result.OpenApiDocument.Servers.First(); + var server = result.OpenApiDocument.Servers[0]; Assert.Equal(2, result.OpenApiDocument.Servers.Count); Assert.Equal("http://dev.bing.com/api", server.Url); Assert.Equal("https://dev.bing.com/api", result.OpenApiDocument.Servers.Last().Url); @@ -281,7 +281,7 @@ public void LocalHostWithCustomHost() var result = OpenApiDocument.Parse(input, "yaml", settings); - var server = result.OpenApiDocument.Servers.First(); + var server = result.OpenApiDocument.Servers[0]; Assert.Single(result.OpenApiDocument.Servers); Assert.Equal("https://localhost:23232", server.Url); } diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs index 9e857ad56..ecb331c2e 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiDocumentTests.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Globalization; using System.IO; using System.Threading.Tasks; @@ -396,7 +396,6 @@ public void ParseDocumentsWithReusablePathItemInWebhooksSucceeds() var outputWriter = new StringWriter(CultureInfo.InvariantCulture); var writer = new OpenApiJsonWriter(outputWriter, new() { InlineLocalReferences = true }); actual.OpenApiDocument.SerializeAsV31(writer); - var serialized = outputWriter.ToString(); } [Fact] diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiInfoTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiInfoTests.cs index 063c2a51a..dbacc76b6 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiInfoTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiInfoTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using FluentAssertions; @@ -22,7 +22,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); diff --git a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiLicenseTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiLicenseTests.cs index 255cbe058..16aefbb7a 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiLicenseTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V31Tests/OpenApiLicenseTests.cs @@ -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.IO; @@ -25,7 +25,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); diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs index ca3d1c7bc..02d475464 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs @@ -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; @@ -1118,7 +1118,7 @@ public void GlobalSecurityRequirementShouldReferenceSecurityScheme() { var result = OpenApiDocument.Load(System.IO.Path.Combine(SampleFolderPath, "securedApi.yaml")); - var securityRequirement = result.OpenApiDocument.SecurityRequirements.First(); + var securityRequirement = result.OpenApiDocument.SecurityRequirements[0]; securityRequirement.Keys.First().Should().BeEquivalentTo(result.OpenApiDocument.Components.SecuritySchemes.First().Value, options => options.Excluding(x => x.Reference)); @@ -1331,10 +1331,9 @@ public void ParseDocWithRefsUsingProxyReferencesSucceeds() // Act var doc = OpenApiDocument.Load(stream, "yaml").OpenApiDocument; - var actualParam = doc.Paths["/pets"].Operations[OperationType.Get].Parameters.First(); + var actualParam = doc.Paths["/pets"].Operations[OperationType.Get].Parameters[0]; var outputDoc = doc.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0).MakeLineBreaksEnvironmentNeutral(); - var output = actualParam.SerializeAsYaml(OpenApiSpecVersion.OpenApi3_0); - var expectedParam = expected.Paths["/pets"].Operations[OperationType.Get].Parameters.First(); + var expectedParam = expected.Paths["/pets"].Operations[OperationType.Get].Parameters[0]; // Assert actualParam.Should().BeEquivalentTo(expectedParam, options => options diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs index 0ec7cda42..249b45e91 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiExampleTests.cs @@ -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.IO; @@ -63,9 +63,6 @@ public void ParseAdvancedExampleShouldSucceed() } }; - var actualRoot = example.Value["versions"][0]["status"].Root; - var expectedRoot = expected.Value["versions"][0]["status"].Root; - diagnostic.Errors.Should().BeEmpty(); example.Should().BeEquivalentTo(expected, options => options.IgnoringCyclicReferences() diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiOperationTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiOperationTests.cs index 17817d82c..c5ce3c31c 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiOperationTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiOperationTests.cs @@ -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.IO; @@ -26,7 +26,7 @@ public void OperationWithSecurityRequirementShouldReferenceSecurityScheme() { var result = OpenApiDocument.Load(Path.Combine(SampleFolderPath, "securedOperation.yaml")); - var securityScheme = result.OpenApiDocument.Paths["/"].Operations[OperationType.Get].Security.First().Keys.First(); + var securityScheme = result.OpenApiDocument.Paths["/"].Operations[OperationType.Get].Security[0].Keys.First(); securityScheme.Should().BeEquivalentTo(result.OpenApiDocument.Components.SecuritySchemes.First().Value, options => options.Excluding(x => x.Reference)); diff --git a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs index f4b1f2e4c..ad85d9f09 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiSchemaTests.cs @@ -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.Collections.Generic; @@ -36,7 +36,7 @@ public void ParsePrimitiveSchemaShouldSucceed() using var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "primitiveSchema.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); @@ -66,10 +66,9 @@ public void ParseExampleStringFragmentShouldSucceed() ""foo"": ""bar"", ""baz"": [ 1,2] }"; - var diagnostic = new OpenApiDiagnostic(); // Act - var openApiAny = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, out diagnostic); + var openApiAny = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, out var diagnostic); // Assert diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); @@ -90,10 +89,9 @@ public void ParseEnumFragmentShouldSucceed() ""foo"", ""baz"" ]"; - var diagnostic = new OpenApiDiagnostic(); // Act - var openApiAny = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, out diagnostic); + var openApiAny = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, out var diagnostic); // Assert diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); @@ -116,10 +114,9 @@ public void ParsePathFragmentShouldSucceed() '200': description: Ok "; - var diagnostic = new OpenApiDiagnostic(); // Act - var openApiAny = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, out diagnostic, "yaml"); + var openApiAny = OpenApiModelFactory.Parse(input, OpenApiSpecVersion.OpenApi3_0, out var diagnostic, "yaml"); // Assert diagnostic.Should().BeEquivalentTo(new OpenApiDiagnostic()); @@ -151,7 +148,7 @@ public void ParseDictionarySchemaShouldSucceed() { 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); @@ -183,7 +180,7 @@ public void ParseBasicSchemaWithExampleShouldSucceed() using var stream = Resources.GetStream(Path.Combine(SampleFolderPath, "basicSchemaWithExample.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); diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs index 4b4a25be0..3a23955a7 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs @@ -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; @@ -1582,8 +1582,6 @@ public void SerializeDocumentWithReferenceButNoComponents() } }; - var reference = document.Paths["/"].Operations[OperationType.Get].Responses["200"].Content["application/json"].Schema.Reference; - // Act var actual = document.Serialize(OpenApiSpecVersion.OpenApi2_0, OpenApiFormat.Json); diff --git a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiCallbackReferenceTests.cs b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiCallbackReferenceTests.cs index 6e1b3c9b0..56a64c9ca 100644 --- a/test/Microsoft.OpenApi.Tests/Models/References/OpenApiCallbackReferenceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/References/OpenApiCallbackReferenceTests.cs @@ -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.Globalization; @@ -149,13 +149,13 @@ public void CallbackReferenceResolutionWorks() Assert.NotEmpty(_externalCallbackReference.PathItems); Assert.Single(_externalCallbackReference.PathItems); Assert.Equal("{$request.body#/callbackUrl}", _externalCallbackReference.PathItems.First().Key.Expression); - Assert.Equal(OperationType.Post, _externalCallbackReference.PathItems.FirstOrDefault().Value.Operations.FirstOrDefault().Key);; + Assert.Equal(OperationType.Post, _externalCallbackReference.PathItems.FirstOrDefault().Value.Operations.FirstOrDefault().Key); // Local reference resolution works Assert.NotEmpty(_localCallbackReference.PathItems); Assert.Single(_localCallbackReference.PathItems); Assert.Equal("{$request.body#/callbackUrl}", _localCallbackReference.PathItems.First().Key.Expression); - Assert.Equal(OperationType.Post, _localCallbackReference.PathItems.FirstOrDefault().Value.Operations.FirstOrDefault().Key); ; + Assert.Equal(OperationType.Post, _localCallbackReference.PathItems.FirstOrDefault().Value.Operations.FirstOrDefault().Key); } [Theory] diff --git a/test/Microsoft.OpenApi.Trimming.Tests/Microsoft.OpenApi.Trimming.Tests.csproj b/test/Microsoft.OpenApi.Trimming.Tests/Microsoft.OpenApi.Trimming.Tests.csproj index 3e6daf74c..9cdd3dba3 100644 --- a/test/Microsoft.OpenApi.Trimming.Tests/Microsoft.OpenApi.Trimming.Tests.csproj +++ b/test/Microsoft.OpenApi.Trimming.Tests/Microsoft.OpenApi.Trimming.Tests.csproj @@ -13,7 +13,7 @@ - +