Skip to content

Commit af61c14

Browse files
committed
Add --filterbyOperationId command option
1 parent 9cda4fb commit af61c14

File tree

1 file changed

+5
-26
lines changed

1 file changed

+5
-26
lines changed

src/Microsoft.OpenApi.Tool/Program.cs

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,12 @@
1-
using System;
2-
using System.CommandLine;
1+
using System.CommandLine;
32
using System.CommandLine.Invocation;
43
using System.IO;
54
using System.Threading.Tasks;
6-
using Microsoft.OpenApi;
75

86
namespace Microsoft.OpenApi.Tool
97
{
10-
class Program
8+
static class Program
119
{
12-
static async Task<int> OldMain(string[] args)
13-
{
14-
15-
var command = new RootCommand
16-
{
17-
new Option("--input", "Input OpenAPI description file path or URL", typeof(string) ),
18-
new Option("--output","Output OpenAPI description file", typeof(FileInfo), arity: ArgumentArity.ZeroOrOne),
19-
new Option("--version", "OpenAPI specification version", typeof(OpenApiSpecVersion)),
20-
new Option("--format", "File format",typeof(OpenApiFormat) ),
21-
new Option("--inline", "Inline $ref instances", typeof(bool) ),
22-
new Option("--resolveExternal","Resolve external $refs", typeof(bool))
23-
};
24-
25-
command.Handler = CommandHandler.Create<string,FileInfo,OpenApiSpecVersion,OpenApiFormat,bool, bool>(
26-
OpenApiService.ProcessOpenApiDocument);
27-
28-
// Parse the incoming args and invoke the handler
29-
return await command.InvokeAsync(args);
30-
}
31-
3210
static async Task<int> Main(string[] args)
3311
{
3412
var rootCommand = new RootCommand() {
@@ -47,9 +25,10 @@ static async Task<int> Main(string[] args)
4725
new Option("--version", "OpenAPI specification version", typeof(OpenApiSpecVersion)),
4826
new Option("--format", "File format",typeof(OpenApiFormat) ),
4927
new Option("--inline", "Inline $ref instances", typeof(bool) ),
50-
new Option("--resolveExternal","Resolve external $refs", typeof(bool))
28+
new Option("--resolveExternal","Resolve external $refs", typeof(bool)),
29+
new Option("--filterByOperationId", "Filters by OperationId provided", typeof(string))
5130
};
52-
transformCommand.Handler = CommandHandler.Create<string, FileInfo, OpenApiSpecVersion, OpenApiFormat, bool, bool>(
31+
transformCommand.Handler = CommandHandler.Create<string, FileInfo, OpenApiSpecVersion, OpenApiFormat, string, bool, bool>(
5332
OpenApiService.ProcessOpenApiDocument);
5433

5534
rootCommand.Add(transformCommand);

0 commit comments

Comments
 (0)