Skip to content

Commit 2a4a780

Browse files
committed
Add a method for processing JSON schemas as references
1 parent 5f8b0ce commit 2a4a780

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/Microsoft.OpenApi/Services/OpenApiWalker.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -807,8 +807,7 @@ internal void Walk(OpenApiEncoding encoding)
807807
/// </summary>
808808
internal JsonSchema Walk(JsonSchema schema, bool isComponent = false)
809809
{
810-
if (schema == null
811-
|| (schema.GetRef() != null && !isComponent))
810+
if (schema == null || ProcessSchemaAsReference(schema, isComponent))
812811
{
813812
return schema;
814813
}
@@ -1162,6 +1161,17 @@ private bool ProcessAsReference(IOpenApiReferenceable referenceable, bool isComp
11621161
}
11631162
return isReference;
11641163
}
1164+
1165+
private bool ProcessSchemaAsReference(JsonSchema schema, bool isComponent = false)
1166+
{
1167+
var isReference = schema.GetRef() != null && !isComponent;
1168+
if (isReference)
1169+
{
1170+
_visitor.Visit(ref schema);
1171+
}
1172+
1173+
return isReference;
1174+
}
11651175
}
11661176

11671177
/// <summary>

0 commit comments

Comments
 (0)