Skip to content

Commit 07169a4

Browse files
committed
Check input file for .xml extension
1 parent c2ae2dd commit 07169a4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 9 additions & 3 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;
@@ -46,16 +46,22 @@ public static void ProcessOpenApiDocument(
4646
}
4747

4848
var stream = GetStream(input);
49+
OpenApiDocument document;
50+
51+
if (input.Contains("xml"))
52+
{
53+
document = ConvertCsdlToOpenApi(stream);
54+
}
55+
4956
var result = new OpenApiStreamReader(new OpenApiReaderSettings
5057
{
5158
ReferenceResolution = resolveExternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences,
5259
RuleSet = ValidationRuleSet.GetDefaultRuleSet()
5360
}
5461
).ReadAsync(stream).GetAwaiter().GetResult();
5562

56-
OpenApiDocument document;
5763
document = result.OpenApiDocument;
58-
64+
5965
// Check if filter options are provided, then execute
6066
if (!string.IsNullOrEmpty(filterByOperationIds) && !string.IsNullOrEmpty(filterByTags))
6167
{

0 commit comments

Comments
 (0)