Skip to content

Commit 991b309

Browse files
committed
Resolve bugs from resolving merge conflicts
1 parent d600825 commit 991b309

File tree

8 files changed

+102
-192
lines changed

8 files changed

+102
-192
lines changed

src/Microsoft.OpenApi/Reader/ParseNodes/ListNode.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

44
using System;
@@ -8,6 +8,7 @@
88
using System.Text.Json.Nodes;
99
using Microsoft.OpenApi.Any;
1010
using Microsoft.OpenApi.Exceptions;
11+
using Microsoft.OpenApi.Models;
1112

1213
namespace Microsoft.OpenApi.Reader.ParseNodes
1314
{

src/Microsoft.OpenApi/Reader/V3/OpenApiDiscriminatorDeserializer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ internal static partial class OpenApiV3Deserializer
2727

2828
private static readonly PatternFieldMap<OpenApiDiscriminator> _discriminatorPatternFields = new();
2929

30-
public static OpenApiDiscriminator LoadDiscriminator(ParseNode node)
30+
public static OpenApiDiscriminator LoadDiscriminator(ParseNode node, OpenApiDocument hostDocument = null)
3131
{
3232
var mapNode = node.CheckMapNode("discriminator");
3333

test/Microsoft.OpenApi.Readers.Tests/V2Tests/OpenApiDocumentTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

44
using System;
@@ -189,10 +189,10 @@ public void ShouldAssignSchemaToAllResponses()
189189
public void ShouldAllowComponentsThatJustContainAReference()
190190
{
191191
// Act
192-
var actual = OpenApiDocument.Load(Path.Combine(SampleFolderPath, "ComponentRootReference.json"));
193-
JsonSchema schema = actual.OpenApiDocument.Components.Schemas["AllPets"];
192+
var actual = OpenApiDocument.Load(Path.Combine(SampleFolderPath, "ComponentRootReference.json")).OpenApiDocument;
193+
JsonSchema schema = actual.Components.Schemas["AllPets"];
194194

195-
schema = doc.ResolveJsonSchemaReference(schema.GetRef()) ?? schema;
195+
schema = actual.ResolveJsonSchemaReference(schema.GetRef()) ?? schema;
196196

197197
// Assert
198198
if (schema.Keywords.Count.Equals(1) && schema.GetRef() != null)

test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiDocumentTests.cs

Lines changed: 84 additions & 174 deletions
Large diffs are not rendered by default.

test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiOperationTests.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

44
using System.IO;
@@ -8,7 +8,6 @@
88
using Microsoft.OpenApi.Models;
99
using Microsoft.OpenApi.Models.References;
1010
using Microsoft.OpenApi.Reader;
11-
using Microsoft.OpenApi.Readers.V3;
1211
using Xunit;
1312

1413
namespace Microsoft.OpenApi.Readers.Tests.V3Tests
@@ -27,9 +26,9 @@ public void OperationWithSecurityRequirementShouldReferenceSecurityScheme()
2726
{
2827
var result = OpenApiDocument.Load(Path.Combine(SampleFolderPath, "securedOperation.yaml"));
2928

30-
var securityScheme = openApiDoc.Paths["/"].Operations[OperationType.Get].Security.First().Keys.First();
29+
var securityScheme = result.OpenApiDocument.Paths["/"].Operations[OperationType.Get].Security.First().Keys.First();
3130

32-
securityScheme.Should().BeEquivalentTo(openApiDoc.Components.SecuritySchemes.First().Value,
31+
securityScheme.Should().BeEquivalentTo(result.OpenApiDocument.Components.SecuritySchemes.First().Value,
3332
options => options.Excluding(x => x.Reference.HostDocument));
3433
}
3534

@@ -38,9 +37,7 @@ public void ParseOperationWithParameterWithNoLocationShouldSucceed()
3837
{
3938
// Act
4039
var operation = OpenApiModelFactory.Load<OpenApiOperation>(Path.Combine(SampleFolderPath, "operationWithParameterWithNoLocation.json"), OpenApiSpecVersion.OpenApi3_0, out _);
41-
42-
// Assert
43-
operation.Should().BeEquivalentTo(new OpenApiOperation
40+
var expectedOp = new OpenApiOperation
4441
{
4542
Tags =
4643
{
@@ -70,6 +67,7 @@ public void ParseOperationWithParameterWithNoLocationShouldSucceed()
7067
}
7168
}
7269
};
70+
7371
// Assert
7472
expectedOp.Should().BeEquivalentTo(operation,
7573
options => options.Excluding(x => x.Tags[0].Reference.HostDocument)

test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiParameterTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using Microsoft.OpenApi.Models;
1111
using Microsoft.OpenApi.Reader;
1212
using Xunit;
13+
using Microsoft.OpenApi.Reader.V3;
1314

1415
namespace Microsoft.OpenApi.Readers.Tests.V3Tests
1516
{

test/Microsoft.OpenApi.Readers.Tests/V3Tests/OpenApiResponseTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

44
using System.IO;
@@ -25,9 +25,9 @@ public void ResponseWithReferencedHeaderShouldReferenceComponent()
2525
{
2626
var result = OpenApiDocument.Load(Path.Combine(SampleFolderPath, "responseWithHeaderReference.yaml"));
2727

28-
var response = openApiDoc.Components.Responses["Test"];
28+
var response = result.OpenApiDocument.Components.Responses["Test"];
2929
var expected = response.Headers.First().Value;
30-
var actual = openApiDoc.Components.Headers.First().Value;
30+
var actual = result.OpenApiDocument.Components.Headers.First().Value;
3131

3232
actual.Description.Should().BeEquivalentTo(expected.Description);
3333
}

test/Microsoft.OpenApi.Tests/Microsoft.OpenApi.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929

3030
<ItemGroup>
3131
<EmbeddedResource Include="Models\Samples\sampleDocument.yaml">
32-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
32+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3333
</EmbeddedResource>
3434
<EmbeddedResource Include="Models\Samples\sampleDocumentWithWhiteSpaces.yaml">
35-
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
35+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3636
</EmbeddedResource>
3737
</ItemGroup>
3838

0 commit comments

Comments
 (0)