Skip to content

Commit 4ffe083

Browse files
committed
Use extension to validate
1 parent 7b42b1b commit 4ffe083

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/Microsoft.OpenApi.Readers/OpenApiStreamReader.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.IO;
55
using System.Linq;
6+
using Microsoft.OpenApi.Extensions;
67
using Microsoft.OpenApi.Models;
78
using Microsoft.OpenApi.Readers.Interface;
89
using Microsoft.OpenApi.Services;
@@ -46,10 +47,8 @@ public OpenApiDocument Read(Stream input, out OpenApiDiagnostic diagnostic)
4647
var document = context.Parse(yamlDocument, diagnostic);
4748

4849
// Validate the document
49-
var openApiValidator = new OpenApiValidator();
50-
var walker = new OpenApiWalker(openApiValidator);
51-
walker.Walk(document);
52-
foreach (var item in openApiValidator.Errors)
50+
var errors = document.Validate();
51+
foreach (var item in errors)
5352
{
5453
diagnostic.Errors.Add(new OpenApiError(item.ErrorPath, item.ErrorMessage));
5554
}

0 commit comments

Comments
 (0)