From b53d50f6f0fb79f5c4794f090d6c80382a7e9d98 Mon Sep 17 00:00:00 2001 From: Mike Lorbetske Date: Tue, 7 Aug 2018 16:16:33 -0700 Subject: [PATCH] Fix incorrectly resolved cross-document pointers --- src/Microsoft.HttpRepl/OpenApi/PointerUtil.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.HttpRepl/OpenApi/PointerUtil.cs b/src/Microsoft.HttpRepl/OpenApi/PointerUtil.cs index c8566095b7..5bff058b95 100644 --- a/src/Microsoft.HttpRepl/OpenApi/PointerUtil.cs +++ b/src/Microsoft.HttpRepl/OpenApi/PointerUtil.cs @@ -19,6 +19,8 @@ namespace Microsoft.HttpRepl.OpenApi private static async Task 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) {