@@ -24,19 +24,19 @@ namespace Microsoft.OpenApi.Hidi
24
24
public static class OpenApiService
25
25
{
26
26
public static void ProcessOpenApiDocument (
27
- string input ,
27
+ string openapi ,
28
28
FileInfo output ,
29
29
OpenApiSpecVersion ? version ,
30
30
OpenApiFormat ? format ,
31
- string filterByOperationIds ,
32
- string filterByTags ,
33
- string filterByCollection ,
31
+ string filterbyoperationids ,
32
+ string filterbytags ,
33
+ string filterbycollection ,
34
34
bool inline ,
35
- bool resolveExternal )
35
+ bool resolveexternal )
36
36
{
37
- if ( string . IsNullOrEmpty ( input ) )
37
+ if ( string . IsNullOrEmpty ( openapi ) )
38
38
{
39
- throw new ArgumentNullException ( nameof ( input ) ) ;
39
+ throw new ArgumentNullException ( nameof ( openapi ) ) ;
40
40
}
41
41
if ( output == null )
42
42
{
@@ -86,24 +86,24 @@ public static void ProcessOpenApiDocument(
86
86
Func < string , OperationType ? , OpenApiOperation , bool > predicate ;
87
87
88
88
// Check if filter options are provided, then execute
89
- if ( ! string . IsNullOrEmpty ( filterByOperationIds ) && ! string . IsNullOrEmpty ( filterByTags ) )
89
+ if ( ! string . IsNullOrEmpty ( filterbyoperationids ) && ! string . IsNullOrEmpty ( filterbytags ) )
90
90
{
91
91
throw new InvalidOperationException ( "Cannot filter by operationIds and tags at the same time." ) ;
92
92
}
93
- if ( ! string . IsNullOrEmpty ( filterByOperationIds ) )
93
+ if ( ! string . IsNullOrEmpty ( filterbyoperationids ) )
94
94
{
95
- predicate = OpenApiFilterService . CreatePredicate ( operationIds : filterByOperationIds ) ;
95
+ predicate = OpenApiFilterService . CreatePredicate ( operationIds : filterbyoperationids ) ;
96
96
document = OpenApiFilterService . CreateFilteredDocument ( document , predicate ) ;
97
97
}
98
- if ( ! string . IsNullOrEmpty ( filterByTags ) )
98
+ if ( ! string . IsNullOrEmpty ( filterbytags ) )
99
99
{
100
- predicate = OpenApiFilterService . CreatePredicate ( tags : filterByTags ) ;
100
+ predicate = OpenApiFilterService . CreatePredicate ( tags : filterbytags ) ;
101
101
document = OpenApiFilterService . CreateFilteredDocument ( document , predicate ) ;
102
102
}
103
103
104
- if ( ! string . IsNullOrEmpty ( filterByCollection ) )
104
+ if ( ! string . IsNullOrEmpty ( filterbycollection ) )
105
105
{
106
- var fileStream = GetStream ( filterByCollection ) ;
106
+ var fileStream = GetStream ( filterbycollection ) ;
107
107
var requestUrls = ParseJsonCollectionFile ( fileStream ) ;
108
108
predicate = OpenApiFilterService . CreatePredicate ( requestUrls : requestUrls , source : document ) ;
109
109
document = OpenApiFilterService . CreateFilteredDocument ( document , predicate ) ;
@@ -118,7 +118,7 @@ public static void ProcessOpenApiDocument(
118
118
ReferenceInline = inline ? ReferenceInlineSetting . InlineLocalReferences : ReferenceInlineSetting . DoNotInlineReferences
119
119
} ;
120
120
121
- var openApiFormat = format ?? GetOpenApiFormat ( input ) ;
121
+ var openApiFormat = format ?? GetOpenApiFormat ( openapi ) ;
122
122
var openApiVersion = version ?? result . OpenApiDiagnostic . SpecificationVersion ;
123
123
IOpenApiWriter writer = openApiFormat switch
124
124
{
@@ -182,7 +182,7 @@ public static OpenApiDocument FixReferences(OpenApiDocument document)
182
182
private static Stream GetStream ( string input )
183
183
{
184
184
Stream stream ;
185
- if ( input . StartsWith ( "http" ) )
185
+ if ( openapi . StartsWith ( "http" ) )
186
186
{
187
187
var httpClient = new HttpClient ( new HttpClientHandler ( )
188
188
{
@@ -191,11 +191,11 @@ private static Stream GetStream(string input)
191
191
{
192
192
DefaultRequestVersion = HttpVersion . Version20
193
193
} ;
194
- stream = httpClient . GetStreamAsync ( input ) . Result ;
194
+ stream = httpClient . GetStreamAsync ( openapi ) . Result ;
195
195
}
196
196
else
197
197
{
198
- var fileInput = new FileInfo ( input ) ;
198
+ var fileInput = new FileInfo ( openapi ) ;
199
199
stream = fileInput . OpenRead ( ) ;
200
200
}
201
201
@@ -234,14 +234,14 @@ public static Dictionary<string, List<string>> ParseJsonCollectionFile(Stream st
234
234
return requestUrls ;
235
235
}
236
236
237
- internal static void ValidateOpenApiDocument ( string input )
237
+ internal static void ValidateOpenApiDocument ( string openapi )
238
238
{
239
- if ( input == null )
239
+ if ( openapi == null )
240
240
{
241
- throw new ArgumentNullException ( "input " ) ;
241
+ throw new ArgumentNullException ( "openapi " ) ;
242
242
}
243
243
244
- var stream = GetStream ( input ) ;
244
+ var stream = GetStream ( openapi ) ;
245
245
246
246
OpenApiDocument document ;
247
247
@@ -266,9 +266,9 @@ internal static void ValidateOpenApiDocument(string input)
266
266
Console . WriteLine ( statsVisitor . GetStatisticsReport ( ) ) ;
267
267
}
268
268
269
- private static OpenApiFormat GetOpenApiFormat ( string input )
269
+ private static OpenApiFormat GetOpenApiFormat ( string openapi )
270
270
{
271
- return ! input . StartsWith ( "http" ) && Path . GetExtension ( input ) == ".json" ? OpenApiFormat . Json : OpenApiFormat . Yaml ;
271
+ return ! openapi . StartsWith ( "http" ) && Path . GetExtension ( openapi ) == ".json" ? OpenApiFormat . Json : OpenApiFormat . Yaml ;
272
272
}
273
273
}
274
274
}
0 commit comments