Skip to content

Commit c1f37ee

Browse files
committed
Clean up code
1 parent 57312fa commit c1f37ee

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/Microsoft.OpenApi.Hidi/OpenApiService.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace Microsoft.OpenApi.Hidi
2121
public static class OpenApiService
2222
{
2323
public static void ProcessOpenApiDocument(
24-
string input,
24+
string openapi,
2525
FileInfo output,
2626
OpenApiSpecVersion? version,
2727
OpenApiFormat? format,
@@ -31,9 +31,9 @@ public static void ProcessOpenApiDocument(
3131
bool inline,
3232
bool resolveExternal)
3333
{
34-
if (string.IsNullOrEmpty(input))
34+
if (string.IsNullOrEmpty(openapi))
3535
{
36-
throw new ArgumentNullException(nameof(input));
36+
throw new ArgumentNullException(nameof(openapi));
3737
}
3838
if(output == null)
3939
{
@@ -44,7 +44,7 @@ public static void ProcessOpenApiDocument(
4444
throw new IOException("The file you're writing to already exists. Please input a new output path.");
4545
}
4646

47-
var stream = GetStream(input);
47+
var stream = GetStream(openapi);
4848
var result = new OpenApiStreamReader(new OpenApiReaderSettings
4949
{
5050
ReferenceResolution = resolveExternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences,
@@ -102,7 +102,7 @@ public static void ProcessOpenApiDocument(
102102
ReferenceInline = inline ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences
103103
};
104104

105-
var openApiFormat = format ?? GetOpenApiFormat(input);
105+
var openApiFormat = format ?? GetOpenApiFormat(openapi);
106106
var openApiVersion = version ?? result.OpenApiDiagnostic.SpecificationVersion;
107107
IOpenApiWriter writer = openApiFormat switch
108108
{
@@ -115,10 +115,10 @@ public static void ProcessOpenApiDocument(
115115
textWriter.Flush();
116116
}
117117

118-
private static Stream GetStream(string input)
118+
private static Stream GetStream(string openapi)
119119
{
120120
Stream stream;
121-
if (input.StartsWith("http"))
121+
if (openapi.StartsWith("http"))
122122
{
123123
var httpClient = new HttpClient(new HttpClientHandler()
124124
{
@@ -127,11 +127,11 @@ private static Stream GetStream(string input)
127127
{
128128
DefaultRequestVersion = HttpVersion.Version20
129129
};
130-
stream = httpClient.GetStreamAsync(input).Result;
130+
stream = httpClient.GetStreamAsync(openapi).Result;
131131
}
132132
else
133133
{
134-
var fileInput = new FileInfo(input);
134+
var fileInput = new FileInfo(openapi);
135135
stream = fileInput.OpenRead();
136136
}
137137

@@ -170,14 +170,14 @@ public static Dictionary<string, List<string>> ParseJsonCollectionFile(Stream st
170170
return requestUrls;
171171
}
172172

173-
internal static void ValidateOpenApiDocument(string input)
173+
internal static void ValidateOpenApiDocument(string openapi)
174174
{
175-
if (input == null)
175+
if (openapi == null)
176176
{
177-
throw new ArgumentNullException("input");
177+
throw new ArgumentNullException("openapi");
178178
}
179179

180-
var stream = GetStream(input);
180+
var stream = GetStream(openapi);
181181

182182
OpenApiDocument document;
183183

@@ -202,9 +202,9 @@ internal static void ValidateOpenApiDocument(string input)
202202
Console.WriteLine(statsVisitor.GetStatisticsReport());
203203
}
204204

205-
private static OpenApiFormat GetOpenApiFormat(string input)
205+
private static OpenApiFormat GetOpenApiFormat(string openapi)
206206
{
207-
return !input.StartsWith("http") && Path.GetExtension(input) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml;
207+
return !openapi.StartsWith("http") && Path.GetExtension(openapi) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml;
208208
}
209209
}
210210
}

0 commit comments

Comments
 (0)