Skip to content

Commit babc887

Browse files
committed
Set the new schema's baseUri to match the document's
1 parent dcc7b7f commit babc887

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Microsoft.OpenApi/Services/OpenApiWalker.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace Microsoft.OpenApi.Services
1818
/// </summary>
1919
public class OpenApiWalker
2020
{
21+
private static OpenApiDocument HostDocument;
2122
private readonly OpenApiVisitorBase _visitor;
2223
private readonly Stack<JsonSchema> _schemaLoop = new Stack<JsonSchema>();
2324
private readonly Stack<OpenApiPathItem> _pathItemLoop = new Stack<OpenApiPathItem>();
@@ -41,6 +42,7 @@ public void Walk(OpenApiDocument doc)
4142
return;
4243
}
4344

45+
HostDocument = doc;
4446
_schemaLoop.Clear();
4547
_pathItemLoop.Clear();
4648

@@ -900,6 +902,7 @@ internal JsonSchema Walk(JsonSchema schema, bool isComponent = false)
900902
Walk(key, () => newSchema = Walk(item.Value));
901903
props.Add(key, newSchema);
902904
schema = builder.Properties(props);
905+
schema.BaseUri = HostDocument.BaseUri;
903906
}
904907
});
905908
}

0 commit comments

Comments
 (0)