Skip to content

Commit 015b3cd

Browse files
committed
Code cleanup
1 parent deaa2fe commit 015b3cd

File tree

5 files changed

+30
-6
lines changed

5 files changed

+30
-6
lines changed

src/Microsoft.OpenApi.Tool/OpenApiService.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ public static void ProcessOpenApiDocument(
3131
{
3232
throw new ArgumentNullException(nameof(input));
3333
}
34+
if(output == null)
35+
{
36+
throw new ArgumentException(nameof(output));
37+
}
3438
if (output.Exists)
3539
{
3640
throw new IOException("The file you're writing to already exists. Please input a new output path.");
@@ -123,7 +127,6 @@ internal static void ValidateOpenApiDocument(string input)
123127

124128
document = new OpenApiStreamReader(new OpenApiReaderSettings
125129
{
126-
//ReferenceResolution = resolveExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences,
127130
RuleSet = ValidationRuleSet.GetDefaultRuleSet()
128131
}
129132
).Read(stream, out var context);

src/Microsoft.OpenApi/Services/OpenApiFilterService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public static OpenApiDocument CreateFilteredDocument(OpenApiDocument source, Fun
7575
foreach (var result in results)
7676
{
7777
OpenApiPathItem pathItem;
78-
string pathKey = result.CurrentKeys.Path;
78+
var pathKey = result.CurrentKeys.Path;
7979

8080
if (subset.Paths == null)
8181
{

src/Microsoft.OpenApi/Services/OperationSearch.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,23 @@
88

99
namespace Microsoft.OpenApi.Services
1010
{
11+
/// <summary>
12+
/// Visits OpenApi operations and parameters.
13+
/// </summary>
1114
public class OperationSearch : OpenApiVisitorBase
1215
{
1316
private readonly Func<OpenApiOperation, bool> _predicate;
1417
private readonly List<SearchResult> _searchResults = new();
1518

19+
/// <summary>
20+
/// A list of operations from the operation search.
21+
/// </summary>
1622
public IList<SearchResult> SearchResults => _searchResults;
1723

24+
/// <summary>
25+
/// The OperationSearch constructor.
26+
/// </summary>
27+
/// <param name="predicate">A predicate function.</param>
1828
public OperationSearch(Func<OpenApiOperation, bool> predicate)
1929
{
2030
_predicate = predicate ?? throw new ArgumentNullException(nameof(predicate));

src/Microsoft.OpenApi/Services/SearchResult.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,19 @@
55

66
namespace Microsoft.OpenApi.Services
77
{
8+
/// <summary>
9+
/// Defines a search result model for visited operations.
10+
/// </summary>
811
public class SearchResult
912
{
13+
/// <summary>
14+
/// An object containing contextual information based on where the walker is currently referencing in an OpenApiDocument.
15+
/// </summary>
1016
public CurrentKeys CurrentKeys { get; set; }
17+
18+
/// <summary>
19+
/// An Operation object.
20+
/// </summary>
1121
public OpenApiOperation Operation { get; set; }
1222
}
1323
}

test/Microsoft.OpenApi.Tests/Workspaces/OpenApiWorkspaceTests.cs

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

44
using System;
55
using System.Collections.Generic;
@@ -12,7 +12,7 @@
1212

1313
namespace Microsoft.OpenApi.Tests
1414
{
15-
15+
1616
public class OpenApiWorkspaceTests
1717
{
1818
[Fact]
@@ -61,7 +61,7 @@ public void OpenApiWorkspacesAllowDocumentsToReferenceEachOther()
6161
}
6262
}
6363
}
64-
}
64+
}
6565
}
6666
});
6767
workspace.AddDocument("common", new OpenApiDocument() {
@@ -111,7 +111,7 @@ public void OpenApiWorkspacesAllowDocumentsToReferenceEachOther_short()
111111
re.CreateContent("application/json", co =>
112112
co.Schema = new OpenApiSchema()
113113
{
114-
Reference = new OpenApiReference() // Reference
114+
Reference = new OpenApiReference() // Reference
115115
{
116116
Id = "test",
117117
Type = ReferenceType.Schema,
@@ -150,6 +150,7 @@ public void OpenApiWorkspacesShouldNormalizeDocumentLocations()
150150
// Enable Workspace to load from any reader, not just streams.
151151

152152
// Test fragments
153+
[Fact]
153154
public void OpenApiWorkspacesShouldLoadDocumentFragments()
154155
{
155156
Assert.True(false);

0 commit comments

Comments
 (0)