Skip to content

Commit 5e44ad5

Browse files
committed
More code/test cleanup
1 parent 6b3343c commit 5e44ad5

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

src/Microsoft.OpenApi.Readers/YamlConverter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
using SharpYaml.Serialization;
66
using SharpYaml;
77
using System.Globalization;
8-
//using YamlDotNet.Core;
9-
//using YamlDotNet.RepresentationModel;
108

119
namespace Microsoft.OpenApi.Readers
1210
{

src/Microsoft.OpenApi/Helpers/JsonNodeCloneHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
namespace Microsoft.OpenApi.Helpers
99
{
10-
internal class JsonNodeCloneHelper
10+
internal static class JsonNodeCloneHelper
1111
{
1212
internal static OpenApiAny Clone(OpenApiAny value)
1313
{

src/Microsoft.OpenApi/Validations/Rules/RuleHelpers.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,9 @@ public static void ValidateDataTypeMismatch(
8585
return;
8686
}
8787

88-
var anyObject = value as JsonObject;
89-
90-
foreach (var property in anyObject)
88+
if (value is JsonObject anyObject)
9189
{
92-
if (anyObject != null)
90+
foreach (var property in anyObject)
9391
{
9492
context.Enter(property.Key);
9593
if (schema.Properties.TryGetValue(property.Key, out var propertyValue))
@@ -102,7 +100,7 @@ public static void ValidateDataTypeMismatch(
102100
}
103101

104102
context.Exit();
105-
}
103+
}
106104
}
107105

108106
return;

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

Lines changed: 6 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;
@@ -1314,7 +1314,8 @@ public void HeaderParameterShouldAllowExample()
13141314
Type = ReferenceType.Header,
13151315
Id = "example-header"
13161316
}
1317-
}, options => options.IgnoringCyclicReferences());
1317+
}, options => options.IgnoringCyclicReferences()
1318+
.Excluding(e => e.Example.Node.Parent));
13181319

13191320
var examplesHeader = openApiDoc.Components?.Headers?["examples-header"];
13201321
Assert.NotNull(examplesHeader);
@@ -1351,7 +1352,9 @@ public void HeaderParameterShouldAllowExample()
13511352
Type = ReferenceType.Header,
13521353
Id = "examples-header"
13531354
}
1354-
}, options => options.IgnoringCyclicReferences());
1355+
}, options => options.IgnoringCyclicReferences()
1356+
.Excluding(e => e.Examples["uuid1"].Value.Node.Parent)
1357+
.Excluding(e => e.Examples["uuid2"].Value.Node.Parent));
13551358
}
13561359
}
13571360

0 commit comments

Comments
 (0)