Fix incorrectly resolved cross-document pointers

This commit is contained in:
Mike Lorbetske 2018-08-07 16:16:33 -07:00
parent eb591fb29d
commit b53d50f6f0
No known key found for this signature in database
GPG Key ID: 9EA3D5A33FBABE3B
1 changed files with 3 additions and 2 deletions

View File

@ -19,6 +19,8 @@ namespace Microsoft.HttpRepl.OpenApi
private static async Task<JToken> ResolvePointersAsync(Uri loadLocation, JToken root, JToken toResolve, HttpClient client)
{
JToken cursor = root;
if (toResolve is JArray arr)
{
for (int i = 0; i < arr.Count; ++i)
@ -69,7 +71,7 @@ namespace Microsoft.HttpRepl.OpenApi
return new JValue((object)null);
}
return await ResolvePointersAsync(loadTarget, newRoot, newRoot, client).ConfigureAwait(false);
cursor = await ResolvePointersAsync(loadTarget, newRoot, newRoot, client).ConfigureAwait(false);
}
//We're in the right document, grab the bookmark (fragment) of the URI and get the element at that path
@ -81,7 +83,6 @@ namespace Microsoft.HttpRepl.OpenApi
}
string[] parts = fragment.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
JToken cursor = root;
for (int i = 0; i < parts.Length; ++i)
{