Skip to content

Commit 8683e37

Browse files
committed
Catch any OpenApiExceptions thrown during parsing and continue processing of schema components
1 parent 5c01fbe commit 8683e37

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/Microsoft.OpenApi.Readers/V3/OpenApiV3VersionService.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft Corporation. All rights reserved.
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
22
// Licensed under the MIT license.
33

44
using System;
@@ -88,7 +88,14 @@ public OpenApiReference ConvertToOpenApiReference(
8888
if (reference.StartsWith("#"))
8989
{
9090
// "$ref": "#/components/schemas/Pet"
91-
return ParseLocalReference(segments[1]);
91+
try
92+
{
93+
return ParseLocalReference(segments[1]);
94+
}
95+
catch (OpenApiException)
96+
{
97+
return null;
98+
}
9299
}
93100
// Where fragments point into a non-OpenAPI document, the id will be the complete fragment identifier
94101
string id = segments[1];

0 commit comments

Comments
 (0)