Skip to content

Commit e417084

Browse files
committed
Fix failing test
1 parent 2a4a780 commit e417084

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/Microsoft.OpenApi.Tests/Walkers/WalkerLocationTests.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,9 @@ public void LocateReferences()
221221
locator.Locations.Where(l => l.StartsWith("referenceAt:")).Should().BeEquivalentTo(new List<string> {
222222
"referenceAt: #/paths/~1/get/responses/200/content/application~1json/schema",
223223
"referenceAt: #/paths/~1/get/responses/200/headers/test-header",
224-
"referenceAt: #/components/schemas/derived/anyOf/0",
224+
"referenceAt: #/components/schemas/derived",
225+
"referenceAt: #/components/schemas/derived/anyOf",
226+
"referenceAt: #/components/schemas/base",
225227
"referenceAt: #/components/headers/test-header/schema"
226228
});
227229
}
@@ -291,7 +293,14 @@ public override void Visit(OpenApiMediaType mediaType)
291293

292294
public override void Visit(ref JsonSchema schema)
293295
{
294-
Locations.Add(this.PathString);
296+
if (schema.GetRef() != null)
297+
{
298+
Locations.Add("referenceAt: " + this.PathString);
299+
}
300+
else
301+
{
302+
Locations.Add(this.PathString);
303+
}
295304
}
296305

297306
public override void Visit(IList<OpenApiTag> openApiTags)

0 commit comments

Comments
 (0)