Skip to content

Commit 7f5d24c

Browse files
committed
Register the host document with the schema registry for reference resolution
1 parent 3cae500 commit 7f5d24c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/Microsoft.OpenApi/Validations/Rules/RuleHelpers.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,14 @@ public static void ValidateDataTypeMismatch(
4949
{
5050
if (schema is not null)
5151
{
52-
if (context.HostDocument != null)
53-
{
54-
var visitor = new JsonSchemaReferenceResolver(context.HostDocument);
55-
var walker = new OpenApiWalker(visitor);
56-
schema = walker.Walk(schema);
57-
}
58-
5952
var options = new EvaluationOptions();
6053
options.OutputFormat = OutputFormat.List;
6154

55+
if (context.HostDocument != null)
56+
{
57+
options.SchemaRegistry.Register(context.HostDocument.BaseUri, context.HostDocument);
58+
}
59+
6260
var results = schema.Evaluate(value, options);
6361

6462
if (!results.IsValid)

0 commit comments

Comments
 (0)