Skip to content

Commit d6593ab

Browse files
committed
Refactor V2 schema deserializer to update the referenceable schema's baseUri to match that of the document
1 parent babc887 commit d6593ab

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Microsoft.OpenApi/Reader/V2/JsonSchemaDeserializer.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,13 @@ public static JsonSchema LoadSchema(ParseNode node, OpenApiDocument hostDocument
234234
var pointer = mapNode.GetReferencePointer();
235235
if (pointer != null)
236236
{
237-
return schemaBuilder.Ref(pointer);
237+
var jsonSchema = schemaBuilder.Ref(pointer).Build();
238+
if (hostDocument != null)
239+
{
240+
jsonSchema.BaseUri = hostDocument.BaseUri;
241+
}
242+
243+
return jsonSchema;
238244
}
239245

240246
foreach (var propertyNode in mapNode)

0 commit comments

Comments
 (0)