Skip to content

Commit 520b327

Browse files
committed
Updated based on code review
1 parent 60da5b7 commit 520b327

File tree

4 files changed

+26
-24
lines changed

4 files changed

+26
-24
lines changed

src/Microsoft.OpenApi.Readers/V2/OpenApiDocumentDeserializer.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -230,18 +230,6 @@ private static void FixRequestBodyReferences(OpenApiDocument doc)
230230
walker.Walk(doc);
231231
}
232232
}
233-
234-
internal static IOpenApiExtension LoadExtension(string name, ParseNode node)
235-
{
236-
if (node.Context.ExtensionParsers.TryGetValue(name, out var parser))
237-
{
238-
return parser(node.CreateAny());
239-
}
240-
else
241-
{
242-
return node.CreateAny();
243-
}
244-
}
245233
}
246234

247235
internal class RequestBodyReferenceFixer : OpenApiVisitorBase

src/Microsoft.OpenApi.Readers/V2/OpenApiV2Deserializer.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Collections.Generic;
55
using System.Linq;
66
using Microsoft.OpenApi.Any;
7+
using Microsoft.OpenApi.Interfaces;
78
using Microsoft.OpenApi.Readers.ParseNodes;
89

910
namespace Microsoft.OpenApi.Readers.V2
@@ -38,6 +39,18 @@ public static IOpenApiAny LoadAny(ParseNode node)
3839
return node.CreateAny();
3940
}
4041

42+
private static IOpenApiExtension LoadExtension(string name, ParseNode node)
43+
{
44+
if (node.Context.ExtensionParsers.TryGetValue(name, out var parser))
45+
{
46+
return parser(node.CreateAny());
47+
}
48+
else
49+
{
50+
return node.CreateAny();
51+
}
52+
}
53+
4154
private static string LoadString(ParseNode node)
4255
{
4356
return node.GetScalarValue();

src/Microsoft.OpenApi.Readers/V3/OpenApiDocumentDeserializer.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,17 +57,5 @@ public static OpenApiDocument LoadOpenApi(RootNode rootNode)
5757

5858
return openApidoc;
5959
}
60-
61-
62-
internal static IOpenApiExtension LoadExtension(string name, ParseNode node)
63-
{
64-
if (node.Context.ExtensionParsers.TryGetValue(name, out var parser)) {
65-
return parser(node.CreateAny());
66-
}
67-
else
68-
{
69-
return node.CreateAny();
70-
}
71-
}
7260
}
7361
}

src/Microsoft.OpenApi.Readers/V3/OpenApiV3Deserializer.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Linq;
66
using Microsoft.OpenApi.Any;
77
using Microsoft.OpenApi.Expressions;
8+
using Microsoft.OpenApi.Interfaces;
89
using Microsoft.OpenApi.Models;
910
using Microsoft.OpenApi.Readers.ParseNodes;
1011

@@ -63,6 +64,18 @@ public static IOpenApiAny LoadAny(ParseNode node)
6364
return node.CreateAny();
6465
}
6566

67+
private static IOpenApiExtension LoadExtension(string name, ParseNode node)
68+
{
69+
if (node.Context.ExtensionParsers.TryGetValue(name, out var parser))
70+
{
71+
return parser(node.CreateAny());
72+
}
73+
else
74+
{
75+
return node.CreateAny();
76+
}
77+
}
78+
6679
private static string LoadString(ParseNode node)
6780
{
6881
return node.GetScalarValue();

0 commit comments

Comments
 (0)