Skip to content

Commit c329b37

Browse files
committed
ISSUE #1228: Changes for review comments
1 parent 6a46338 commit c329b37

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ public OpenApiReference ConvertToOpenApiReference(
131131
}
132132
else if (id.StartsWith("/paths/"))
133133
{
134-
var localSegments = segments[1].Split('/');
135-
if (localSegments.Length == 3)
134+
var localSegments = segments[1].Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
135+
if (localSegments.Length == 2)
136136
{
137137
// The reference of a path may contain JSON escape character ~1 for the forward-slash character, replace this otherwise
138138
// the reference cannot be resolved.
139-
id = localSegments[2].Replace("~1", "/");
139+
id = localSegments[1].Replace("~1", "/");
140140
}
141141
else
142142
{

src/Microsoft.OpenApi/Services/OpenApiWalker.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -447,14 +447,11 @@ internal void Walk(OpenApiPathItem pathItem)
447447

448448
_visitor.Visit(pathItem);
449449

450-
if (pathItem != null)
450+
// The path may be a reference
451+
if (pathItem != null && !ProcessAsReference(pathItem))
451452
{
452-
// The path may be a reference
453-
if (!ProcessAsReference(pathItem))
454-
{
455-
Walk(OpenApiConstants.Parameters, () => Walk(pathItem.Parameters));
456-
Walk(pathItem.Operations);
457-
}
453+
Walk(OpenApiConstants.Parameters, () => Walk(pathItem.Parameters));
454+
Walk(pathItem.Operations);
458455
}
459456
_visitor.Visit(pathItem as IOpenApiExtensible);
460457

0 commit comments

Comments
 (0)