From bc250e2473ef0cf0b121f25416be8869efdec01c Mon Sep 17 00:00:00 2001 From: darrelmiller Date: Mon, 20 Jan 2020 16:59:14 -0500 Subject: [PATCH 001/752] Initial implementation of OpenAPI cmdline tool --- .../Microsoft.OpenApi.Tool.csproj | 20 +++++++ src/Microsoft.OpenApi.Tool/OpenApiService.cs | 59 +++++++++++++++++++ src/Microsoft.OpenApi.Tool/Program.cs | 50 ++++++++++++++++ 3 files changed, 129 insertions(+) create mode 100644 src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj create mode 100644 src/Microsoft.OpenApi.Tool/OpenApiService.cs create mode 100644 src/Microsoft.OpenApi.Tool/Program.cs diff --git a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj new file mode 100644 index 000000000..5ac8d8e16 --- /dev/null +++ b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj @@ -0,0 +1,20 @@ + + + + Exe + netcoreapp3.1 + true + openapi + ./../../artifacts + + + + + + + + + + + + diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs new file mode 100644 index 000000000..0f0c8039f --- /dev/null +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -0,0 +1,59 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Readers; +using Microsoft.OpenApi.Validations; +using Microsoft.OpenApi.Writers; + +namespace Microsoft.OpenApi.Tool +{ + static class OpenApiService + { + public static void ProcessOpenApiDocument( + FileInfo fileOption, + string outputPath, + OpenApiSpecVersion version, + OpenApiFormat format, + bool inline = false) + { + Stream stream = fileOption.OpenRead(); + + var document = new OpenApiStreamReader(new OpenApiReaderSettings + { + ReferenceResolution = ReferenceResolutionSetting.ResolveLocalReferences, + RuleSet = ValidationRuleSet.GetDefaultRuleSet() + } + ).Read(stream, out var context); + + if (context.Errors.Count != 0) + { + var errorReport = new StringBuilder(); + + foreach (var error in context.Errors) + { + errorReport.AppendLine(error.ToString()); + } + + throw new ArgumentException(String.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())); + } + + using (var outputStream = new FileStream(outputPath, FileMode.Create)) + { + document.Serialize( + outputStream, + version, + format, + new OpenApiWriterSettings() + { + ReferenceInline = inline == true ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences + }); + + outputStream.Position = 0; + outputStream.Flush(); + } + } +} +} diff --git a/src/Microsoft.OpenApi.Tool/Program.cs b/src/Microsoft.OpenApi.Tool/Program.cs new file mode 100644 index 000000000..ce0296b2e --- /dev/null +++ b/src/Microsoft.OpenApi.Tool/Program.cs @@ -0,0 +1,50 @@ +using System; +using System.CommandLine; +using System.CommandLine.Invocation; +using System.IO; +using Microsoft.OpenApi; + +namespace Microsoft.OpenApi.Tool +{ + class Program + { + static int Main(string[] args) + { + var rootCommand = new RootCommand + { + new Option( + "--input", + "Input OpenAPI description") + { + Argument = new Argument() + }, + new Option( + "--output", + "Output path for OpenAPI Description") + { + Argument = new Argument() + }, + new Option( + "--output-version", + "OpenAPI Version") + { + Argument = new Argument(() => OpenApiSpecVersion.OpenApi3_0) + }, + new Option( + "--output-format", + "OpenAPI format [Json | Yaml") + { + Argument = new Argument(() => OpenApiFormat.Yaml ) + } + }; + + rootCommand.Description = "OpenAPI"; + + rootCommand.Handler = CommandHandler.Create( + OpenApiService.ProcessOpenApiDocument); + + // Parse the incoming args and invoke the handler + return rootCommand.InvokeAsync(args).Result; + } + } +} From 6f21c7bf923526125a80bdc3a6efc7b51dc676e9 Mon Sep 17 00:00:00 2001 From: darrelmiller Date: Mon, 20 Jan 2020 23:07:04 -0500 Subject: [PATCH 002/752] First running version of OpenApi tool --- .../Microsoft.OpenApi.Tool.csproj | 1 + src/Microsoft.OpenApi.Tool/OpenApiService.cs | 56 +++++++++++++------ src/Microsoft.OpenApi.Tool/Program.cs | 42 ++++---------- 3 files changed, 51 insertions(+), 48 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj index 5ac8d8e16..0fda71fa9 100644 --- a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj +++ b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj @@ -6,6 +6,7 @@ true openapi ./../../artifacts + 0.5.0 diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index 0f0c8039f..7a8e8ced2 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Validations; using Microsoft.OpenApi.Writers; @@ -13,21 +14,22 @@ namespace Microsoft.OpenApi.Tool static class OpenApiService { public static void ProcessOpenApiDocument( - FileInfo fileOption, - string outputPath, + FileInfo input, + FileInfo output, OpenApiSpecVersion version, OpenApiFormat format, - bool inline = false) + bool inline) { - Stream stream = fileOption.OpenRead(); + OpenApiDocument document; + using (Stream stream = input.OpenRead()) + { - var document = new OpenApiStreamReader(new OpenApiReaderSettings + document = new OpenApiStreamReader(new OpenApiReaderSettings { ReferenceResolution = ReferenceResolutionSetting.ResolveLocalReferences, RuleSet = ValidationRuleSet.GetDefaultRuleSet() } ).Read(stream, out var context); - if (context.Errors.Count != 0) { var errorReport = new StringBuilder(); @@ -38,21 +40,41 @@ public static void ProcessOpenApiDocument( } throw new ArgumentException(String.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())); + } } - using (var outputStream = new FileStream(outputPath, FileMode.Create)) + using (var outputStream = output?.Create()) { - document.Serialize( - outputStream, - version, - format, - new OpenApiWriterSettings() - { - ReferenceInline = inline == true ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences - }); + TextWriter textWriter; + + if (outputStream!=null) + { + textWriter = new StreamWriter(outputStream); + } else + { + textWriter = Console.Out; + } + + var settings = new OpenApiWriterSettings() + { + ReferenceInline = inline == true ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences + }; + IOpenApiWriter writer; + switch (format) + { + case OpenApiFormat.Json: + writer = new OpenApiJsonWriter(textWriter, settings); + break; + case OpenApiFormat.Yaml: + writer = new OpenApiYamlWriter(textWriter, settings); + break; + default: + throw new ArgumentException("Unknown format"); + } + + document.Serialize(writer,version ); - outputStream.Position = 0; - outputStream.Flush(); + textWriter.Flush(); } } } diff --git a/src/Microsoft.OpenApi.Tool/Program.cs b/src/Microsoft.OpenApi.Tool/Program.cs index ce0296b2e..3d229c411 100644 --- a/src/Microsoft.OpenApi.Tool/Program.cs +++ b/src/Microsoft.OpenApi.Tool/Program.cs @@ -2,49 +2,29 @@ using System.CommandLine; using System.CommandLine.Invocation; using System.IO; +using System.Threading.Tasks; using Microsoft.OpenApi; namespace Microsoft.OpenApi.Tool { class Program { - static int Main(string[] args) + static async Task Main(string[] args) { - var rootCommand = new RootCommand + var command = new RootCommand { - new Option( - "--input", - "Input OpenAPI description") - { - Argument = new Argument() - }, - new Option( - "--output", - "Output path for OpenAPI Description") - { - Argument = new Argument() - }, - new Option( - "--output-version", - "OpenAPI Version") - { - Argument = new Argument(() => OpenApiSpecVersion.OpenApi3_0) - }, - new Option( - "--output-format", - "OpenAPI format [Json | Yaml") - { - Argument = new Argument(() => OpenApiFormat.Yaml ) - } + new Option("--input") { Argument = new Argument() }, + new Option("--output") { Argument = new Argument() }, + new Option("--version") { Argument = new Argument() }, + new Option("--format") { Argument = new Argument() }, + new Option("--inline") { Argument = new Argument() } }; - rootCommand.Description = "OpenAPI"; - - rootCommand.Handler = CommandHandler.Create( - OpenApiService.ProcessOpenApiDocument); + command.Handler = CommandHandler.Create( + OpenApiService.ProcessOpenApiDocument); // Parse the incoming args and invoke the handler - return rootCommand.InvokeAsync(args).Result; + return await command.InvokeAsync(args); } } } From 169f4271a0c5893baf44ccc806da885503903498 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Fri, 6 Mar 2020 10:50:24 -0600 Subject: [PATCH 003/752] Updated nuget packages --- src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj index 0fda71fa9..f8f1eab1c 100644 --- a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj +++ b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj @@ -10,7 +10,7 @@ - + @@ -18,4 +18,8 @@ + + + + From 48905cd208d3c6f90a5441533a537bb897db961a Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Fri, 6 Mar 2020 11:46:05 -0600 Subject: [PATCH 004/752] Moved commandline tool to .net core 3.0 --- src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj index f8f1eab1c..aa22d5fd3 100644 --- a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj +++ b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + netcoreapp3.0 true openapi ./../../artifacts From 1957a5567874983da3bd66dd1930239c47bf1605 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Fri, 6 Mar 2020 11:47:49 -0600 Subject: [PATCH 005/752] Moved commandline tool to .net core 2.2 --- src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj index aa22d5fd3..5d6f12463 100644 --- a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj +++ b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.0 + netcoreapp2.2 true openapi ./../../artifacts From c383a05469fe064976b55ea569e07162cde5f288 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Fri, 6 Mar 2020 17:19:46 -0600 Subject: [PATCH 006/752] Put commandline tool back to 3.1 now that pipeline has new Nuget --- src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj index 5d6f12463..f8f1eab1c 100644 --- a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj +++ b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp2.2 + netcoreapp3.1 true openapi ./../../artifacts From 731dc2a65d72c3723624058c75705b376859efb0 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 17 May 2020 14:12:42 -0400 Subject: [PATCH 007/752] Merged vnext --- .../Microsoft.OpenApi.Tool.csproj | 25 ++++++ src/Microsoft.OpenApi.Tool/OpenApiService.cs | 81 +++++++++++++++++++ src/Microsoft.OpenApi.Tool/Program.cs | 30 +++++++ 3 files changed, 136 insertions(+) create mode 100644 src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj create mode 100644 src/Microsoft.OpenApi.Tool/OpenApiService.cs create mode 100644 src/Microsoft.OpenApi.Tool/Program.cs diff --git a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj new file mode 100644 index 000000000..f8f1eab1c --- /dev/null +++ b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj @@ -0,0 +1,25 @@ + + + + Exe + netcoreapp3.1 + true + openapi + ./../../artifacts + 0.5.0 + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs new file mode 100644 index 000000000..7a8e8ced2 --- /dev/null +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Readers; +using Microsoft.OpenApi.Validations; +using Microsoft.OpenApi.Writers; + +namespace Microsoft.OpenApi.Tool +{ + static class OpenApiService + { + public static void ProcessOpenApiDocument( + FileInfo input, + FileInfo output, + OpenApiSpecVersion version, + OpenApiFormat format, + bool inline) + { + OpenApiDocument document; + using (Stream stream = input.OpenRead()) + { + + document = new OpenApiStreamReader(new OpenApiReaderSettings + { + ReferenceResolution = ReferenceResolutionSetting.ResolveLocalReferences, + RuleSet = ValidationRuleSet.GetDefaultRuleSet() + } + ).Read(stream, out var context); + if (context.Errors.Count != 0) + { + var errorReport = new StringBuilder(); + + foreach (var error in context.Errors) + { + errorReport.AppendLine(error.ToString()); + } + + throw new ArgumentException(String.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())); + } + } + + using (var outputStream = output?.Create()) + { + TextWriter textWriter; + + if (outputStream!=null) + { + textWriter = new StreamWriter(outputStream); + } else + { + textWriter = Console.Out; + } + + var settings = new OpenApiWriterSettings() + { + ReferenceInline = inline == true ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences + }; + IOpenApiWriter writer; + switch (format) + { + case OpenApiFormat.Json: + writer = new OpenApiJsonWriter(textWriter, settings); + break; + case OpenApiFormat.Yaml: + writer = new OpenApiYamlWriter(textWriter, settings); + break; + default: + throw new ArgumentException("Unknown format"); + } + + document.Serialize(writer,version ); + + textWriter.Flush(); + } + } +} +} diff --git a/src/Microsoft.OpenApi.Tool/Program.cs b/src/Microsoft.OpenApi.Tool/Program.cs new file mode 100644 index 000000000..3d229c411 --- /dev/null +++ b/src/Microsoft.OpenApi.Tool/Program.cs @@ -0,0 +1,30 @@ +using System; +using System.CommandLine; +using System.CommandLine.Invocation; +using System.IO; +using System.Threading.Tasks; +using Microsoft.OpenApi; + +namespace Microsoft.OpenApi.Tool +{ + class Program + { + static async Task Main(string[] args) + { + var command = new RootCommand + { + new Option("--input") { Argument = new Argument() }, + new Option("--output") { Argument = new Argument() }, + new Option("--version") { Argument = new Argument() }, + new Option("--format") { Argument = new Argument() }, + new Option("--inline") { Argument = new Argument() } + }; + + command.Handler = CommandHandler.Create( + OpenApiService.ProcessOpenApiDocument); + + // Parse the incoming args and invoke the handler + return await command.InvokeAsync(args); + } + } +} From ce643a52cbc66174cd9c53effc7aa3ca13890a84 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 14 Mar 2021 16:20:42 -0400 Subject: [PATCH 008/752] Updated version and added extenalReference support to commandline tool --- src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj | 4 ++-- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 5 +++-- src/Microsoft.OpenApi.Tool/Program.cs | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj index f8f1eab1c..5845ce4f9 100644 --- a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj +++ b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj @@ -6,11 +6,11 @@ true openapi ./../../artifacts - 0.5.0 + 1.3.0-preview - + diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index 7a8e8ced2..fd42da1a1 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -18,7 +18,8 @@ public static void ProcessOpenApiDocument( FileInfo output, OpenApiSpecVersion version, OpenApiFormat format, - bool inline) + bool inline, + bool resolveExternal) { OpenApiDocument document; using (Stream stream = input.OpenRead()) @@ -26,7 +27,7 @@ public static void ProcessOpenApiDocument( document = new OpenApiStreamReader(new OpenApiReaderSettings { - ReferenceResolution = ReferenceResolutionSetting.ResolveLocalReferences, + ReferenceResolution = resolveExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, RuleSet = ValidationRuleSet.GetDefaultRuleSet() } ).Read(stream, out var context); diff --git a/src/Microsoft.OpenApi.Tool/Program.cs b/src/Microsoft.OpenApi.Tool/Program.cs index 3d229c411..2c95b954f 100644 --- a/src/Microsoft.OpenApi.Tool/Program.cs +++ b/src/Microsoft.OpenApi.Tool/Program.cs @@ -17,10 +17,11 @@ static async Task Main(string[] args) new Option("--output") { Argument = new Argument() }, new Option("--version") { Argument = new Argument() }, new Option("--format") { Argument = new Argument() }, - new Option("--inline") { Argument = new Argument() } + new Option("--inline") { Argument = new Argument() }, + new Option("--resolveExternal") { Argument = new Argument() } }; - command.Handler = CommandHandler.Create( + command.Handler = CommandHandler.Create( OpenApiService.ProcessOpenApiDocument); // Parse the incoming args and invoke the handler From aa13c98553017e40fc294e101f5807c76830756b Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 17 May 2021 09:52:02 -0400 Subject: [PATCH 009/752] Enhanced tool to support validation --- install-tool.ps1 | 7 ++ .../Microsoft.OpenApi.Tool.csproj | 6 +- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 109 ++++++++++++++---- src/Microsoft.OpenApi.Tool/Program.cs | 47 ++++++-- src/Microsoft.OpenApi.Tool/StatsVisitor.cs | 91 +++++++++++++++ 5 files changed, 227 insertions(+), 33 deletions(-) create mode 100644 install-tool.ps1 create mode 100644 src/Microsoft.OpenApi.Tool/StatsVisitor.cs diff --git a/install-tool.ps1 b/install-tool.ps1 new file mode 100644 index 000000000..0e6521110 --- /dev/null +++ b/install-tool.ps1 @@ -0,0 +1,7 @@ +$latest = Get-ChildItem .\artifacts\ Microsoft.OpenApi.Tool* | select-object -Last 1 +$version = $latest.Name.Split(".")[3..5] | join-string -Separator "." + +if (Test-Path -Path ./artifacts/openapi-parser.exe) { + dotnet tool uninstall --tool-path artifacts Microsoft.OpenApi.Tool +} +dotnet tool install --tool-path artifacts --add-source .\artifacts\ --version $version Microsoft.OpenApi.Tool \ No newline at end of file diff --git a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj index 5845ce4f9..40e46f1a4 100644 --- a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj +++ b/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj @@ -4,13 +4,13 @@ Exe netcoreapp3.1 true - openapi + openapi-parser ./../../artifacts 1.3.0-preview - + @@ -19,7 +19,7 @@ - + diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index fd42da1a1..e65e51aca 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -2,10 +2,13 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Net; +using System.Net.Http; using System.Text; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Readers; +using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Validations; using Microsoft.OpenApi.Writers; @@ -14,48 +17,54 @@ namespace Microsoft.OpenApi.Tool static class OpenApiService { public static void ProcessOpenApiDocument( - FileInfo input, + string input, FileInfo output, OpenApiSpecVersion version, OpenApiFormat format, bool inline, bool resolveExternal) { + if (input == null) + { + throw new ArgumentNullException("input"); + } + + var stream = GetStream(input); + OpenApiDocument document; - using (Stream stream = input.OpenRead()) + + document = new OpenApiStreamReader(new OpenApiReaderSettings { + ReferenceResolution = resolveExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, + RuleSet = ValidationRuleSet.GetDefaultRuleSet() + } + ).Read(stream, out var context); - document = new OpenApiStreamReader(new OpenApiReaderSettings + if (context.Errors.Count != 0) + { + var errorReport = new StringBuilder(); + + foreach (var error in context.Errors) { - ReferenceResolution = resolveExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, - RuleSet = ValidationRuleSet.GetDefaultRuleSet() + errorReport.AppendLine(error.ToString()); } - ).Read(stream, out var context); - if (context.Errors.Count != 0) - { - var errorReport = new StringBuilder(); - foreach (var error in context.Errors) - { - errorReport.AppendLine(error.ToString()); - } - - throw new ArgumentException(String.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())); - } + throw new ArgumentException(String.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())); } using (var outputStream = output?.Create()) { TextWriter textWriter; - if (outputStream!=null) + if (outputStream != null) { textWriter = new StreamWriter(outputStream); - } else + } + else { textWriter = Console.Out; } - + var settings = new OpenApiWriterSettings() { ReferenceInline = inline == true ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences @@ -72,11 +81,67 @@ public static void ProcessOpenApiDocument( default: throw new ArgumentException("Unknown format"); } - - document.Serialize(writer,version ); + + document.Serialize(writer, version); textWriter.Flush(); } } -} + + private static Stream GetStream(string input) + { + Stream stream; + if (input.StartsWith("http")) + { + var httpClient = new HttpClient(new HttpClientHandler() + { + SslProtocols = System.Security.Authentication.SslProtocols.Tls12, + }) + { + DefaultRequestVersion = HttpVersion.Version20 + }; + stream = httpClient.GetStreamAsync(input).Result; + } + else + { + var fileInput = new FileInfo(input); + stream = fileInput.OpenRead(); + } + + return stream; + } + + internal static void ValidateOpenApiDocument(string input) + { + if (input == null) + { + throw new ArgumentNullException("input"); + } + + var stream = GetStream(input); + + OpenApiDocument document; + + document = new OpenApiStreamReader(new OpenApiReaderSettings + { + //ReferenceResolution = resolveExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, + RuleSet = ValidationRuleSet.GetDefaultRuleSet() + } + ).Read(stream, out var context); + + if (context.Errors.Count != 0) + { + foreach (var error in context.Errors) + { + Console.WriteLine(error.ToString()); + } + } + + var statsVisitor = new StatsVisitor(); + var walker = new OpenApiWalker(statsVisitor); + walker.Walk(document); + + Console.WriteLine(statsVisitor.GetStatisticsReport()); + } + } } diff --git a/src/Microsoft.OpenApi.Tool/Program.cs b/src/Microsoft.OpenApi.Tool/Program.cs index 2c95b954f..446e2829a 100644 --- a/src/Microsoft.OpenApi.Tool/Program.cs +++ b/src/Microsoft.OpenApi.Tool/Program.cs @@ -9,23 +9,54 @@ namespace Microsoft.OpenApi.Tool { class Program { - static async Task Main(string[] args) + static async Task OldMain(string[] args) { + var command = new RootCommand { - new Option("--input") { Argument = new Argument() }, - new Option("--output") { Argument = new Argument() }, - new Option("--version") { Argument = new Argument() }, - new Option("--format") { Argument = new Argument() }, - new Option("--inline") { Argument = new Argument() }, - new Option("--resolveExternal") { Argument = new Argument() } + new Option("--input", "Input OpenAPI description file path or URL", typeof(string) ), + new Option("--output","Output OpenAPI description file", typeof(FileInfo), arity: ArgumentArity.ZeroOrOne), + new Option("--version", "OpenAPI specification version", typeof(OpenApiSpecVersion)), + new Option("--format", "File format",typeof(OpenApiFormat) ), + new Option("--inline", "Inline $ref instances", typeof(bool) ), + new Option("--resolveExternal","Resolve external $refs", typeof(bool)) }; - command.Handler = CommandHandler.Create( + command.Handler = CommandHandler.Create( OpenApiService.ProcessOpenApiDocument); // Parse the incoming args and invoke the handler return await command.InvokeAsync(args); } + + static async Task Main(string[] args) + { + var rootCommand = new RootCommand() { + }; + + var validateCommand = new Command("validate") + { + new Option("--input", "Input OpenAPI description file path or URL", typeof(string) ) + }; + validateCommand.Handler = CommandHandler.Create(OpenApiService.ValidateOpenApiDocument); + + var transformCommand = new Command("transform") + { + new Option("--input", "Input OpenAPI description file path or URL", typeof(string) ), + new Option("--output","Output OpenAPI description file", typeof(FileInfo), arity: ArgumentArity.ZeroOrOne), + new Option("--version", "OpenAPI specification version", typeof(OpenApiSpecVersion)), + new Option("--format", "File format",typeof(OpenApiFormat) ), + new Option("--inline", "Inline $ref instances", typeof(bool) ), + new Option("--resolveExternal","Resolve external $refs", typeof(bool)) + }; + transformCommand.Handler = CommandHandler.Create( + OpenApiService.ProcessOpenApiDocument); + + rootCommand.Add(transformCommand); + rootCommand.Add(validateCommand); + + // Parse the incoming args and invoke the handler + return await rootCommand.InvokeAsync(args); + } } } diff --git a/src/Microsoft.OpenApi.Tool/StatsVisitor.cs b/src/Microsoft.OpenApi.Tool/StatsVisitor.cs new file mode 100644 index 000000000..3c633d860 --- /dev/null +++ b/src/Microsoft.OpenApi.Tool/StatsVisitor.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Services; + +namespace Microsoft.OpenApi.Tool +{ + internal class StatsVisitor : OpenApiVisitorBase + { + public int ParameterCount { get; set; } = 0; + + public override void Visit(OpenApiParameter parameter) + { + ParameterCount++; + } + + public int SchemaCount { get; set; } = 0; + + public override void Visit(OpenApiSchema schema) + { + SchemaCount++; + } + + public int HeaderCount { get; set; } = 0; + + public override void Visit(IDictionary headers) + { + HeaderCount++; + } + + public int PathItemCount { get; set; } = 0; + + public override void Visit(OpenApiPathItem pathItem) + { + PathItemCount++; + } + + public int RequestBodyCount { get; set; } = 0; + + public override void Visit(OpenApiRequestBody requestBody) + { + RequestBodyCount++; + } + + public int ResponseCount { get; set; } = 0; + + public override void Visit(OpenApiResponses response) + { + ResponseCount++; + } + + public int OperationCount { get; set; } = 0; + + public override void Visit(OpenApiOperation operation) + { + OperationCount++; + } + + public int LinkCount { get; set; } = 0; + + public override void Visit(OpenApiLink operation) + { + LinkCount++; + } + + public int CallbackCount { get; set; } = 0; + + public override void Visit(OpenApiCallback callback) + { + CallbackCount++; + } + + public string GetStatisticsReport() + { + return $"Path Items: {PathItemCount}" + Environment.NewLine + + $"Operations: {OperationCount}" + Environment.NewLine + + $"Parameters: {ParameterCount}" + Environment.NewLine + + $"Request Bodies: {RequestBodyCount}" + Environment.NewLine + + $"Responses: {ResponseCount}" + Environment.NewLine + + $"Links: {LinkCount}" + Environment.NewLine + + $"Callbacks: {CallbackCount}" + Environment.NewLine + + $"Schemas: {SchemaCount}" + Environment.NewLine; + } + } +} From 7aa85b074931719780984b5d7682ad1765727004 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sat, 22 May 2021 22:16:17 -0400 Subject: [PATCH 010/752] fix: Changed OpenAPI.Tool to use ReadAsync so it can resolve external refs --- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index e65e51aca..c52c08941 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -33,12 +33,15 @@ public static void ProcessOpenApiDocument( OpenApiDocument document; - document = new OpenApiStreamReader(new OpenApiReaderSettings + var result = new OpenApiStreamReader(new OpenApiReaderSettings { ReferenceResolution = resolveExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, RuleSet = ValidationRuleSet.GetDefaultRuleSet() } - ).Read(stream, out var context); + ).ReadAsync(stream).GetAwaiter().GetResult(); + + document = result.OpenApiDocument; + var context = result.OpenApiDiagnostic; if (context.Errors.Count != 0) { From 42c9034dbb2a8afd4de2f30be07162ef04a0b6e0 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 15 Aug 2021 13:34:03 -0400 Subject: [PATCH 011/752] Can validate external references now --- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 71 +++++++++++++++----- src/Microsoft.OpenApi.Tool/Program.cs | 5 +- 2 files changed, 57 insertions(+), 19 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index c52c08941..3b3afcbd0 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -5,6 +5,7 @@ using System.Net; using System.Net.Http; using System.Text; +using System.Threading.Tasks; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Readers; @@ -29,14 +30,16 @@ public static void ProcessOpenApiDocument( throw new ArgumentNullException("input"); } - var stream = GetStream(input); + var inputUrl = GetInputUrl(input); + var stream = GetStream(inputUrl); OpenApiDocument document; var result = new OpenApiStreamReader(new OpenApiReaderSettings { ReferenceResolution = resolveExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, - RuleSet = ValidationRuleSet.GetDefaultRuleSet() + RuleSet = ValidationRuleSet.GetDefaultRuleSet(), + BaseUrl = new Uri(inputUrl.AbsoluteUri) } ).ReadAsync(stream).GetAwaiter().GetResult(); @@ -91,10 +94,22 @@ public static void ProcessOpenApiDocument( } } - private static Stream GetStream(string input) + private static Uri GetInputUrl(string input) { - Stream stream; if (input.StartsWith("http")) + { + return new Uri(input); + } + else + { + return new Uri("file://" + Path.GetFullPath(input)); + } + } + + private static Stream GetStream(Uri input) + { + Stream stream; + if (input.Scheme == "http" || input.Scheme == "https") { var httpClient = new HttpClient(new HttpClientHandler() { @@ -105,32 +120,40 @@ private static Stream GetStream(string input) }; stream = httpClient.GetStreamAsync(input).Result; } - else + else if (input.Scheme == "file") { - var fileInput = new FileInfo(input); + var fileInput = new FileInfo(input.AbsolutePath); stream = fileInput.OpenRead(); + } + else + { + throw new ArgumentException("Unrecognized exception"); } return stream; } - internal static void ValidateOpenApiDocument(string input) + internal static async Task ValidateOpenApiDocument(string input, bool resolveExternal) { if (input == null) { throw new ArgumentNullException("input"); } - - var stream = GetStream(input); + var inputUrl = GetInputUrl(input); + var stream = GetStream(GetInputUrl(input)); OpenApiDocument document; - document = new OpenApiStreamReader(new OpenApiReaderSettings + var result = await new OpenApiStreamReader(new OpenApiReaderSettings { - //ReferenceResolution = resolveExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, - RuleSet = ValidationRuleSet.GetDefaultRuleSet() + ReferenceResolution = resolveExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, + RuleSet = ValidationRuleSet.GetDefaultRuleSet(), + BaseUrl = new Uri(inputUrl.AbsoluteUri) } - ).Read(stream, out var context); + ).ReadAsync(stream); + + document = result.OpenApiDocument; + var context = result.OpenApiDiagnostic; if (context.Errors.Count != 0) { @@ -140,11 +163,25 @@ internal static void ValidateOpenApiDocument(string input) } } - var statsVisitor = new StatsVisitor(); - var walker = new OpenApiWalker(statsVisitor); - walker.Walk(document); + if (document.Workspace == null) { + var statsVisitor = new StatsVisitor(); + var walker = new OpenApiWalker(statsVisitor); + walker.Walk(document); + Console.WriteLine(statsVisitor.GetStatisticsReport()); + } + else + { + foreach (var memberDocument in document.Workspace.Documents) + { + Console.WriteLine("Stats for " + memberDocument.Info.Title); + var statsVisitor = new StatsVisitor(); + var walker = new OpenApiWalker(statsVisitor); + walker.Walk(memberDocument); + Console.WriteLine(statsVisitor.GetStatisticsReport()); + } + } - Console.WriteLine(statsVisitor.GetStatisticsReport()); + } } } diff --git a/src/Microsoft.OpenApi.Tool/Program.cs b/src/Microsoft.OpenApi.Tool/Program.cs index 446e2829a..0ae4cb782 100644 --- a/src/Microsoft.OpenApi.Tool/Program.cs +++ b/src/Microsoft.OpenApi.Tool/Program.cs @@ -36,9 +36,10 @@ static async Task Main(string[] args) var validateCommand = new Command("validate") { - new Option("--input", "Input OpenAPI description file path or URL", typeof(string) ) + new Option("--input", "Input OpenAPI description file path or URL", typeof(string) ), + new Option("--resolveExternal","Resolve external $refs", typeof(bool)) }; - validateCommand.Handler = CommandHandler.Create(OpenApiService.ValidateOpenApiDocument); + validateCommand.Handler = CommandHandler.Create(OpenApiService.ValidateOpenApiDocument); var transformCommand = new Command("transform") { From bdae8a2c37fd2f4db35667701d0966ba7d510240 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 12 Oct 2021 12:22:03 +0300 Subject: [PATCH 012/752] Add tests for filtering validation --- .../Services/OpenApiFilterServiceTests.cs | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs new file mode 100644 index 000000000..7fedd989c --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System; +using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Services; +using OpenAPIService.Test; +using Xunit; + +namespace Microsoft.OpenApi.Tests.Services +{ + public class OpenApiFilterServiceTests + { + private const string Title = "Partial Graph API"; + private const string GraphVersion = "mock"; + private readonly OpenApiFilterService _openApiFilterService; + private readonly OpenApiDocument _openApiDocumentMock; + + public OpenApiFilterServiceTests() + { + _openApiFilterService = new OpenApiFilterService(); + _openApiDocumentMock = OpenApiDocumentMock.CreateOpenApiDocument(); + } + + [Theory] + [InlineData("users.user.ListUser")] + [InlineData("users.user.GetUser")] + [InlineData("administrativeUnits.restore")] + [InlineData("graphService.GetGraphService")] + public void ReturnFilteredOpenApiDocumentBasedOnOperationIds(string operationId) + { + // Act + var predicate = _openApiFilterService.CreatePredicate(operationId); + var subsetOpenApiDocument = _openApiFilterService.CreateFilteredDocument(_openApiDocumentMock, Title, GraphVersion, predicate); + + // Assert + Assert.NotNull(subsetOpenApiDocument); + Assert.Single(subsetOpenApiDocument.Paths); + } + + [Fact] + public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidOperationIdIsSpecified() + { + // Act and Assert + var message = Assert.Throws(() =>_openApiFilterService.CreatePredicate(null)).Message; + Assert.Equal("OperationId needs to be specified.", message); + } + } +} From 1b097cab794bda2b4f76a85d3f38dbce0435826b Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 12 Oct 2021 15:54:42 +0300 Subject: [PATCH 013/752] Simplify using statement and switch condition --- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 49 +++++++------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index c52c08941..80e6bf7bc 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -52,43 +52,26 @@ public static void ProcessOpenApiDocument( errorReport.AppendLine(error.ToString()); } - throw new ArgumentException(String.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())); + throw new ArgumentException(string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())); } - using (var outputStream = output?.Create()) - { - TextWriter textWriter; + using var outputStream = output?.Create(); - if (outputStream != null) - { - textWriter = new StreamWriter(outputStream); - } - else - { - textWriter = Console.Out; - } + var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; - var settings = new OpenApiWriterSettings() - { - ReferenceInline = inline == true ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences - }; - IOpenApiWriter writer; - switch (format) - { - case OpenApiFormat.Json: - writer = new OpenApiJsonWriter(textWriter, settings); - break; - case OpenApiFormat.Yaml: - writer = new OpenApiYamlWriter(textWriter, settings); - break; - default: - throw new ArgumentException("Unknown format"); - } - - document.Serialize(writer, version); + var settings = new OpenApiWriterSettings() + { + ReferenceInline = inline ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences + }; + IOpenApiWriter writer = format switch + { + OpenApiFormat.Json => new OpenApiJsonWriter(textWriter, settings), + OpenApiFormat.Yaml => new OpenApiYamlWriter(textWriter, settings), + _ => throw new ArgumentException("Unknown format"), + }; + document.Serialize(writer, version); - textWriter.Flush(); - } + textWriter.Flush(); } private static Stream GetStream(string input) From b6aab14f1c2b255cf915415c883db99446cc0269 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 18 Oct 2021 11:00:52 +0300 Subject: [PATCH 014/752] Use static class reference --- .../Services/OpenApiFilterServiceTests.cs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs index 7fedd989c..4f6a9bcbf 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs @@ -13,12 +13,10 @@ public class OpenApiFilterServiceTests { private const string Title = "Partial Graph API"; private const string GraphVersion = "mock"; - private readonly OpenApiFilterService _openApiFilterService; private readonly OpenApiDocument _openApiDocumentMock; public OpenApiFilterServiceTests() { - _openApiFilterService = new OpenApiFilterService(); _openApiDocumentMock = OpenApiDocumentMock.CreateOpenApiDocument(); } @@ -30,8 +28,8 @@ public OpenApiFilterServiceTests() public void ReturnFilteredOpenApiDocumentBasedOnOperationIds(string operationId) { // Act - var predicate = _openApiFilterService.CreatePredicate(operationId); - var subsetOpenApiDocument = _openApiFilterService.CreateFilteredDocument(_openApiDocumentMock, Title, GraphVersion, predicate); + var predicate = OpenApiFilterService.CreatePredicate(operationId); + var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(_openApiDocumentMock, Title, GraphVersion, predicate); // Assert Assert.NotNull(subsetOpenApiDocument); @@ -42,7 +40,7 @@ public void ReturnFilteredOpenApiDocumentBasedOnOperationIds(string operationId) public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidOperationIdIsSpecified() { // Act and Assert - var message = Assert.Throws(() =>_openApiFilterService.CreatePredicate(null)).Message; + var message = Assert.Throws(() =>OpenApiFilterService.CreatePredicate(null)).Message; Assert.Equal("OperationId needs to be specified.", message); } } From d447c438c47d14bd2dcbc33fab80dba85fb295c4 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 18 Oct 2021 11:01:53 +0300 Subject: [PATCH 015/752] Add --filterbyOperationId command option --- src/Microsoft.OpenApi.Tool/Program.cs | 31 +++++---------------------- 1 file changed, 5 insertions(+), 26 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/Program.cs b/src/Microsoft.OpenApi.Tool/Program.cs index 446e2829a..938986350 100644 --- a/src/Microsoft.OpenApi.Tool/Program.cs +++ b/src/Microsoft.OpenApi.Tool/Program.cs @@ -1,34 +1,12 @@ -using System; -using System.CommandLine; +using System.CommandLine; using System.CommandLine.Invocation; using System.IO; using System.Threading.Tasks; -using Microsoft.OpenApi; namespace Microsoft.OpenApi.Tool { - class Program + static class Program { - static async Task OldMain(string[] args) - { - - var command = new RootCommand - { - new Option("--input", "Input OpenAPI description file path or URL", typeof(string) ), - new Option("--output","Output OpenAPI description file", typeof(FileInfo), arity: ArgumentArity.ZeroOrOne), - new Option("--version", "OpenAPI specification version", typeof(OpenApiSpecVersion)), - new Option("--format", "File format",typeof(OpenApiFormat) ), - new Option("--inline", "Inline $ref instances", typeof(bool) ), - new Option("--resolveExternal","Resolve external $refs", typeof(bool)) - }; - - command.Handler = CommandHandler.Create( - OpenApiService.ProcessOpenApiDocument); - - // Parse the incoming args and invoke the handler - return await command.InvokeAsync(args); - } - static async Task Main(string[] args) { var rootCommand = new RootCommand() { @@ -47,9 +25,10 @@ static async Task Main(string[] args) new Option("--version", "OpenAPI specification version", typeof(OpenApiSpecVersion)), new Option("--format", "File format",typeof(OpenApiFormat) ), new Option("--inline", "Inline $ref instances", typeof(bool) ), - new Option("--resolveExternal","Resolve external $refs", typeof(bool)) + new Option("--resolveExternal","Resolve external $refs", typeof(bool)), + new Option("--filterByOperationId", "Filters by OperationId provided", typeof(string)) }; - transformCommand.Handler = CommandHandler.Create( + transformCommand.Handler = CommandHandler.Create( OpenApiService.ProcessOpenApiDocument); rootCommand.Add(transformCommand); From 52e5a687a73d0ef1fa97b83de85ad67dd74d6a8d Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 18 Oct 2021 11:02:39 +0300 Subject: [PATCH 016/752] Add filterByOperationId param and logic --- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index 80e6bf7bc..7b56f4516 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -16,11 +16,15 @@ namespace Microsoft.OpenApi.Tool { static class OpenApiService { + public const string GraphVersion_V1 = "v1.0"; + public const string Title = "Partial Graph API"; + public static void ProcessOpenApiDocument( string input, FileInfo output, OpenApiSpecVersion version, OpenApiFormat format, + string filterbyOperationId, bool inline, bool resolveExternal) { @@ -35,12 +39,20 @@ public static void ProcessOpenApiDocument( var result = new OpenApiStreamReader(new OpenApiReaderSettings { - ReferenceResolution = resolveExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, + ReferenceResolution = resolveExternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, RuleSet = ValidationRuleSet.GetDefaultRuleSet() } ).ReadAsync(stream).GetAwaiter().GetResult(); document = result.OpenApiDocument; + + // Check if filter options are provided, then execute + if (!string.IsNullOrEmpty(filterbyOperationId)) + { + var predicate = OpenApiFilterService.CreatePredicate(filterbyOperationId); + document = OpenApiFilterService.CreateFilteredDocument(document, Title, GraphVersion_V1, predicate); + } + var context = result.OpenApiDiagnostic; if (context.Errors.Count != 0) From 03fc2a65045281dcc55c1dc539daa6de1a112ef5 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 20 Oct 2021 09:58:22 +0300 Subject: [PATCH 017/752] Clean up: Remove unnecessary params --- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 5 +---- .../Services/OpenApiFilterServiceTests.cs | 4 +--- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index 7b56f4516..fe1a9d9b4 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -16,9 +16,6 @@ namespace Microsoft.OpenApi.Tool { static class OpenApiService { - public const string GraphVersion_V1 = "v1.0"; - public const string Title = "Partial Graph API"; - public static void ProcessOpenApiDocument( string input, FileInfo output, @@ -50,7 +47,7 @@ public static void ProcessOpenApiDocument( if (!string.IsNullOrEmpty(filterbyOperationId)) { var predicate = OpenApiFilterService.CreatePredicate(filterbyOperationId); - document = OpenApiFilterService.CreateFilteredDocument(document, Title, GraphVersion_V1, predicate); + document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } var context = result.OpenApiDiagnostic; diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs index 4f6a9bcbf..308f00952 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs @@ -11,8 +11,6 @@ namespace Microsoft.OpenApi.Tests.Services { public class OpenApiFilterServiceTests { - private const string Title = "Partial Graph API"; - private const string GraphVersion = "mock"; private readonly OpenApiDocument _openApiDocumentMock; public OpenApiFilterServiceTests() @@ -29,7 +27,7 @@ public void ReturnFilteredOpenApiDocumentBasedOnOperationIds(string operationId) { // Act var predicate = OpenApiFilterService.CreatePredicate(operationId); - var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(_openApiDocumentMock, Title, GraphVersion, predicate); + var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(_openApiDocumentMock, predicate); // Assert Assert.NotNull(subsetOpenApiDocument); From f3bf81c0fc480f864ed853213e9581246e003c32 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 25 Oct 2021 16:20:49 +0300 Subject: [PATCH 018/752] Add test cases for filtering OpenApiDocument by tags provided --- .../Services/OpenApiFilterServiceTests.cs | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs index 308f00952..9676bd1f4 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs @@ -19,19 +19,28 @@ public OpenApiFilterServiceTests() } [Theory] - [InlineData("users.user.ListUser")] - [InlineData("users.user.GetUser")] - [InlineData("administrativeUnits.restore")] - [InlineData("graphService.GetGraphService")] - public void ReturnFilteredOpenApiDocumentBasedOnOperationIds(string operationId) + [InlineData("users.user.ListUser", null)] + [InlineData("users.user.GetUser", null)] + [InlineData("administrativeUnits.restore", null)] + [InlineData("graphService.GetGraphService", null)] + [InlineData(null, "users.user")] + [InlineData(null, "applications.application")] + public void ReturnFilteredOpenApiDocumentBasedOnOperationIds(string operationIds, string tags) { // Act - var predicate = OpenApiFilterService.CreatePredicate(operationId); + var predicate = OpenApiFilterService.CreatePredicate(operationIds, tags); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(_openApiDocumentMock, predicate); // Assert Assert.NotNull(subsetOpenApiDocument); - Assert.Single(subsetOpenApiDocument.Paths); + if (!string.IsNullOrEmpty(operationIds)) + { + Assert.Single(subsetOpenApiDocument.Paths); + } + else if (!string.IsNullOrEmpty(tags)) + { + Assert.NotEmpty(subsetOpenApiDocument.Paths); + } } [Fact] From 539ab63fd488d5175453d1975289c9df579f90b9 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 25 Oct 2021 16:21:49 +0300 Subject: [PATCH 019/752] Add --filterByTag command option --- src/Microsoft.OpenApi.Tool/Program.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/Program.cs b/src/Microsoft.OpenApi.Tool/Program.cs index 938986350..5eaedbde8 100644 --- a/src/Microsoft.OpenApi.Tool/Program.cs +++ b/src/Microsoft.OpenApi.Tool/Program.cs @@ -26,9 +26,10 @@ static async Task Main(string[] args) new Option("--format", "File format",typeof(OpenApiFormat) ), new Option("--inline", "Inline $ref instances", typeof(bool) ), new Option("--resolveExternal","Resolve external $refs", typeof(bool)), - new Option("--filterByOperationId", "Filters by OperationId provided", typeof(string)) + new Option("--filterByOperationId", "Filters OpenApiDocument by OperationId provided", typeof(string)), + new Option("--filterByTag", "Filters OpenApiDocument by Tag(s) provided", typeof(string)) }; - transformCommand.Handler = CommandHandler.Create( + transformCommand.Handler = CommandHandler.Create( OpenApiService.ProcessOpenApiDocument); rootCommand.Add(transformCommand); From fda255ad81158bd0c3678fdaa5b500e9a44f6861 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 25 Oct 2021 16:26:30 +0300 Subject: [PATCH 020/752] Add a filterByTag param and logic --- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index fe1a9d9b4..4bc28adcf 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -21,7 +21,8 @@ public static void ProcessOpenApiDocument( FileInfo output, OpenApiSpecVersion version, OpenApiFormat format, - string filterbyOperationId, + string filterbyOperationIds, + string filterByTags, bool inline, bool resolveExternal) { @@ -44,9 +45,9 @@ public static void ProcessOpenApiDocument( document = result.OpenApiDocument; // Check if filter options are provided, then execute - if (!string.IsNullOrEmpty(filterbyOperationId)) + if (!string.IsNullOrEmpty(filterbyOperationIds) || !string.IsNullOrEmpty(filterByTags)) { - var predicate = OpenApiFilterService.CreatePredicate(filterbyOperationId); + var predicate = OpenApiFilterService.CreatePredicate(filterbyOperationIds, filterByTags); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } From bb379f33e785a7252485454d083ad8c25c5324cb Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 26 Oct 2021 09:36:36 +0300 Subject: [PATCH 021/752] Code refactoring --- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 9 +++++++-- src/Microsoft.OpenApi.Tool/Program.cs | 4 ++-- .../Services/OpenApiFilterServiceTests.cs | 5 +++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index 4bc28adcf..317306a1f 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -45,9 +45,14 @@ public static void ProcessOpenApiDocument( document = result.OpenApiDocument; // Check if filter options are provided, then execute - if (!string.IsNullOrEmpty(filterbyOperationIds) || !string.IsNullOrEmpty(filterByTags)) + if (!string.IsNullOrEmpty(filterbyOperationIds)) { - var predicate = OpenApiFilterService.CreatePredicate(filterbyOperationIds, filterByTags); + var predicate = OpenApiFilterService.CreatePredicate(operationIds: filterbyOperationIds); + document = OpenApiFilterService.CreateFilteredDocument(document, predicate); + } + if (!string.IsNullOrEmpty(filterByTags)) + { + var predicate = OpenApiFilterService.CreatePredicate(tags: filterByTags); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } diff --git a/src/Microsoft.OpenApi.Tool/Program.cs b/src/Microsoft.OpenApi.Tool/Program.cs index 5eaedbde8..ae3967181 100644 --- a/src/Microsoft.OpenApi.Tool/Program.cs +++ b/src/Microsoft.OpenApi.Tool/Program.cs @@ -26,8 +26,8 @@ static async Task Main(string[] args) new Option("--format", "File format",typeof(OpenApiFormat) ), new Option("--inline", "Inline $ref instances", typeof(bool) ), new Option("--resolveExternal","Resolve external $refs", typeof(bool)), - new Option("--filterByOperationId", "Filters OpenApiDocument by OperationId provided", typeof(string)), - new Option("--filterByTag", "Filters OpenApiDocument by Tag(s) provided", typeof(string)) + new Option("--filterByOperationIds", "Filters OpenApiDocument by OperationId provided", typeof(string)), + new Option("--filterByTags", "Filters OpenApiDocument by Tag(s) provided", typeof(string)) }; transformCommand.Handler = CommandHandler.Create( OpenApiService.ProcessOpenApiDocument); diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs index 9676bd1f4..058fc8c42 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs @@ -25,6 +25,7 @@ public OpenApiFilterServiceTests() [InlineData("graphService.GetGraphService", null)] [InlineData(null, "users.user")] [InlineData(null, "applications.application")] + [InlineData(null, "reports.Functions")] public void ReturnFilteredOpenApiDocumentBasedOnOperationIds(string operationIds, string tags) { // Act @@ -47,8 +48,8 @@ public void ReturnFilteredOpenApiDocumentBasedOnOperationIds(string operationIds public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidOperationIdIsSpecified() { // Act and Assert - var message = Assert.Throws(() =>OpenApiFilterService.CreatePredicate(null)).Message; - Assert.Equal("OperationId needs to be specified.", message); + var message = Assert.Throws(() =>OpenApiFilterService.CreatePredicate(null, null)).Message; + Assert.Equal("Either operationId(s) or tag(s) need to be specified.", message); } } } From 2a9a7258c4df090424bbc11755582a46501b6ba6 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 1 Nov 2021 10:49:02 +0300 Subject: [PATCH 022/752] Allow filtering for multiple operationIds --- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 9 ++++----- src/Microsoft.OpenApi.Tool/Program.cs | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index fe1a9d9b4..fca5999a1 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System; using System.IO; using System.Linq; using System.Net; @@ -21,7 +20,7 @@ public static void ProcessOpenApiDocument( FileInfo output, OpenApiSpecVersion version, OpenApiFormat format, - string filterbyOperationId, + string filterByOperationIds, bool inline, bool resolveExternal) { @@ -44,9 +43,9 @@ public static void ProcessOpenApiDocument( document = result.OpenApiDocument; // Check if filter options are provided, then execute - if (!string.IsNullOrEmpty(filterbyOperationId)) + if (!string.IsNullOrEmpty(filterByOperationIds)) { - var predicate = OpenApiFilterService.CreatePredicate(filterbyOperationId); + var predicate = OpenApiFilterService.CreatePredicate(filterByOperationIds); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } diff --git a/src/Microsoft.OpenApi.Tool/Program.cs b/src/Microsoft.OpenApi.Tool/Program.cs index 938986350..570f2ea1e 100644 --- a/src/Microsoft.OpenApi.Tool/Program.cs +++ b/src/Microsoft.OpenApi.Tool/Program.cs @@ -26,7 +26,7 @@ static async Task Main(string[] args) new Option("--format", "File format",typeof(OpenApiFormat) ), new Option("--inline", "Inline $ref instances", typeof(bool) ), new Option("--resolveExternal","Resolve external $refs", typeof(bool)), - new Option("--filterByOperationId", "Filters by OperationId provided", typeof(string)) + new Option("--filterByOperationIds", "Filters by OperationId provided", typeof(string)) }; transformCommand.Handler = CommandHandler.Create( OpenApiService.ProcessOpenApiDocument); From 207482072fae2acccefc1c3280664530d9fd246a Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 1 Nov 2021 10:49:59 +0300 Subject: [PATCH 023/752] Add check for writing to an already existing file --- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index fca5999a1..34f51af64 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Linq; using System.Net; @@ -63,6 +63,11 @@ public static void ProcessOpenApiDocument( throw new ArgumentException(string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())); } + if (output.Exists) + { + throw new IOException("The file you're writing to already exists.Please input a new output path."); + } + using var outputStream = output?.Create(); var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; From d4df9e75b7ce17affcba450934e4658b6396a47a Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 1 Nov 2021 12:00:00 +0300 Subject: [PATCH 024/752] Code cleanup --- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index b7972bc0a..2431856e8 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -20,7 +20,7 @@ public static void ProcessOpenApiDocument( FileInfo output, OpenApiSpecVersion version, OpenApiFormat format, - string filterbyOperationIds, + string filterByOperationIds, string filterByTags, bool inline, bool resolveExternal) @@ -44,9 +44,14 @@ public static void ProcessOpenApiDocument( document = result.OpenApiDocument; // Check if filter options are provided, then execute - if (!string.IsNullOrEmpty(filterbyOperationIds)) + if (!string.IsNullOrEmpty(filterByOperationIds) && !string.IsNullOrEmpty(filterByTags)) { - var predicate = OpenApiFilterService.CreatePredicate(operationIds: filterbyOperationIds); + throw new InvalidOperationException("Cannot filter by operationIds and tags at the same time."); + } + + if (!string.IsNullOrEmpty(filterByOperationIds)) + { + var predicate = OpenApiFilterService.CreatePredicate(operationIds: filterByOperationIds); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } if (!string.IsNullOrEmpty(filterByTags)) From 10a1d405caf3d9808a5fabeb09869db7bde9a376 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 2 Nov 2021 09:16:37 +0300 Subject: [PATCH 025/752] Add license header --- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 5 ++++- src/Microsoft.OpenApi.Tool/Program.cs | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index 2431856e8..895d4ff17 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System; using System.IO; using System.Linq; using System.Net; diff --git a/src/Microsoft.OpenApi.Tool/Program.cs b/src/Microsoft.OpenApi.Tool/Program.cs index ae3967181..71507ad8b 100644 --- a/src/Microsoft.OpenApi.Tool/Program.cs +++ b/src/Microsoft.OpenApi.Tool/Program.cs @@ -1,4 +1,7 @@ -using System.CommandLine; +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System.CommandLine; using System.CommandLine.Invocation; using System.IO; using System.Threading.Tasks; From 0661898733e9162d47242240c389299436ff0af8 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 2 Nov 2021 21:57:25 +0300 Subject: [PATCH 026/752] Add license header --- src/Microsoft.OpenApi.Tool/Program.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Tool/Program.cs b/src/Microsoft.OpenApi.Tool/Program.cs index 570f2ea1e..21be3406b 100644 --- a/src/Microsoft.OpenApi.Tool/Program.cs +++ b/src/Microsoft.OpenApi.Tool/Program.cs @@ -1,4 +1,7 @@ -using System.CommandLine; +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System.CommandLine; using System.CommandLine.Invocation; using System.IO; using System.Threading.Tasks; From 650f06b781c3d31c02b8dcfe1058d4de161f97e6 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 2 Nov 2021 21:58:56 +0300 Subject: [PATCH 027/752] Clean up and add XML documentations for public methods --- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index 34f51af64..d9e9fa930 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -1,4 +1,7 @@ -using System; +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System; using System.IO; using System.Linq; using System.Net; @@ -24,9 +27,13 @@ public static void ProcessOpenApiDocument( bool inline, bool resolveExternal) { - if (input == null) + if (string.IsNullOrEmpty(input)) { - throw new ArgumentNullException("input"); + throw new ArgumentNullException(nameof(input)); + } + if (output.Exists) + { + throw new IOException("The file you're writing to already exists. Please input a new output path."); } var stream = GetStream(input); @@ -51,7 +58,7 @@ public static void ProcessOpenApiDocument( var context = result.OpenApiDiagnostic; - if (context.Errors.Count != 0) + if (context.Errors.Count > 0) { var errorReport = new StringBuilder(); @@ -63,11 +70,6 @@ public static void ProcessOpenApiDocument( throw new ArgumentException(string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())); } - if (output.Exists) - { - throw new IOException("The file you're writing to already exists.Please input a new output path."); - } - using var outputStream = output?.Create(); var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; From 550bd0338fb1cfd9e842eb1871ad6ad0276e884d Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 3 Nov 2021 10:01:31 +0300 Subject: [PATCH 028/752] Move declaration closer to first reference point --- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index d9e9fa930..74f9455f0 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -37,9 +37,6 @@ public static void ProcessOpenApiDocument( } var stream = GetStream(input); - - OpenApiDocument document; - var result = new OpenApiStreamReader(new OpenApiReaderSettings { ReferenceResolution = resolveExternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, @@ -47,6 +44,7 @@ public static void ProcessOpenApiDocument( } ).ReadAsync(stream).GetAwaiter().GetResult(); + OpenApiDocument document; document = result.OpenApiDocument; // Check if filter options are provided, then execute From 1b42fc6e5dd5b75f2d0bd955754a0b3529f920e9 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 4 Nov 2021 13:21:57 +0300 Subject: [PATCH 029/752] Code cleanup --- src/Microsoft.OpenApi.Tool/OpenApiService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.OpenApi.Tool/OpenApiService.cs index 74f9455f0..87f02dcce 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Tool/OpenApiService.cs @@ -31,6 +31,10 @@ public static void ProcessOpenApiDocument( { throw new ArgumentNullException(nameof(input)); } + if(output == null) + { + throw new ArgumentException(nameof(output)); + } if (output.Exists) { 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) document = new OpenApiStreamReader(new OpenApiReaderSettings { - //ReferenceResolution = resolveExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, RuleSet = ValidationRuleSet.GetDefaultRuleSet() } ).Read(stream, out var context); From 60fb7bd8649fa4f10552543e7e0de03ee77222f1 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 8 Nov 2021 12:49:28 +0300 Subject: [PATCH 030/752] Rename project and update namespaces --- .../Microsoft.Hidi.csproj} | 2 +- .../OpenApiService.cs | 3 ++- src/{Microsoft.OpenApi.Tool => Microsoft.Hidi}/Program.cs | 3 ++- .../StatsVisitor.cs | 5 +---- 4 files changed, 6 insertions(+), 7 deletions(-) rename src/{Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj => Microsoft.Hidi/Microsoft.Hidi.csproj} (93%) rename src/{Microsoft.OpenApi.Tool => Microsoft.Hidi}/OpenApiService.cs (98%) rename src/{Microsoft.OpenApi.Tool => Microsoft.Hidi}/Program.cs (97%) rename src/{Microsoft.OpenApi.Tool => Microsoft.Hidi}/StatsVisitor.cs (95%) diff --git a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj b/src/Microsoft.Hidi/Microsoft.Hidi.csproj similarity index 93% rename from src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj rename to src/Microsoft.Hidi/Microsoft.Hidi.csproj index 40e46f1a4..27fc4b995 100644 --- a/src/Microsoft.OpenApi.Tool/Microsoft.OpenApi.Tool.csproj +++ b/src/Microsoft.Hidi/Microsoft.Hidi.csproj @@ -4,7 +4,7 @@ Exe netcoreapp3.1 true - openapi-parser + hidi ./../../artifacts 1.3.0-preview diff --git a/src/Microsoft.OpenApi.Tool/OpenApiService.cs b/src/Microsoft.Hidi/OpenApiService.cs similarity index 98% rename from src/Microsoft.OpenApi.Tool/OpenApiService.cs rename to src/Microsoft.Hidi/OpenApiService.cs index 87f02dcce..556eff071 100644 --- a/src/Microsoft.OpenApi.Tool/OpenApiService.cs +++ b/src/Microsoft.Hidi/OpenApiService.cs @@ -7,6 +7,7 @@ using System.Net; using System.Net.Http; using System.Text; +using Microsoft.OpenApi; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Readers; @@ -14,7 +15,7 @@ using Microsoft.OpenApi.Validations; using Microsoft.OpenApi.Writers; -namespace Microsoft.OpenApi.Tool +namespace Microsoft.Hidi { static class OpenApiService { diff --git a/src/Microsoft.OpenApi.Tool/Program.cs b/src/Microsoft.Hidi/Program.cs similarity index 97% rename from src/Microsoft.OpenApi.Tool/Program.cs rename to src/Microsoft.Hidi/Program.cs index 21be3406b..033e3625b 100644 --- a/src/Microsoft.OpenApi.Tool/Program.cs +++ b/src/Microsoft.Hidi/Program.cs @@ -5,8 +5,9 @@ using System.CommandLine.Invocation; using System.IO; using System.Threading.Tasks; +using Microsoft.OpenApi; -namespace Microsoft.OpenApi.Tool +namespace Microsoft.Hidi { static class Program { diff --git a/src/Microsoft.OpenApi.Tool/StatsVisitor.cs b/src/Microsoft.Hidi/StatsVisitor.cs similarity index 95% rename from src/Microsoft.OpenApi.Tool/StatsVisitor.cs rename to src/Microsoft.Hidi/StatsVisitor.cs index 3c633d860..7617edb97 100644 --- a/src/Microsoft.OpenApi.Tool/StatsVisitor.cs +++ b/src/Microsoft.Hidi/StatsVisitor.cs @@ -3,13 +3,10 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; -namespace Microsoft.OpenApi.Tool +namespace Microsoft.Hidi { internal class StatsVisitor : OpenApiVisitorBase { From dd6f3cc3a1db9b3a6997212e38c49490fe9a55dc Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 9 Nov 2021 12:35:30 +0300 Subject: [PATCH 031/752] Address PR feedback --- src/Microsoft.OpenApi.Tool/Program.cs | 2 +- .../Services/OpenApiFilterServiceTests.cs | 32 +++++++++---------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/Microsoft.OpenApi.Tool/Program.cs b/src/Microsoft.OpenApi.Tool/Program.cs index 71507ad8b..a4d32c31e 100644 --- a/src/Microsoft.OpenApi.Tool/Program.cs +++ b/src/Microsoft.OpenApi.Tool/Program.cs @@ -29,7 +29,7 @@ static async Task Main(string[] args) new Option("--format", "File format",typeof(OpenApiFormat) ), new Option("--inline", "Inline $ref instances", typeof(bool) ), new Option("--resolveExternal","Resolve external $refs", typeof(bool)), - new Option("--filterByOperationIds", "Filters OpenApiDocument by OperationId provided", typeof(string)), + new Option("--filterByOperationIds", "Filters OpenApiDocument by OperationId(s) provided", typeof(string)), new Option("--filterByTags", "Filters OpenApiDocument by Tag(s) provided", typeof(string)) }; transformCommand.Handler = CommandHandler.Create( diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs index 058fc8c42..c9b87f57f 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs @@ -19,14 +19,18 @@ public OpenApiFilterServiceTests() } [Theory] - [InlineData("users.user.ListUser", null)] - [InlineData("users.user.GetUser", null)] - [InlineData("administrativeUnits.restore", null)] - [InlineData("graphService.GetGraphService", null)] - [InlineData(null, "users.user")] - [InlineData(null, "applications.application")] - [InlineData(null, "reports.Functions")] - public void ReturnFilteredOpenApiDocumentBasedOnOperationIds(string operationIds, string tags) + [InlineData("users.user.ListUser", null, 1)] + [InlineData("users.user.GetUser", null, 1)] + [InlineData("users.user.ListUser,users.user.GetUser", null, 2)] + [InlineData("*", null, 12)] + [InlineData("administrativeUnits.restore", null, 1)] + [InlineData("graphService.GetGraphService", null, 1)] + [InlineData(null, "users.user,applications.application", 3)] + [InlineData(null, "^users\\.", 3)] + [InlineData(null, "users.user", 2)] + [InlineData(null, "applications.application", 1)] + [InlineData(null, "reports.Functions", 2)] + public void ReturnFilteredOpenApiDocumentBasedOnOperationIdsAndTags(string operationIds, string tags, int expectedPathCount) { // Act var predicate = OpenApiFilterService.CreatePredicate(operationIds, tags); @@ -34,18 +38,12 @@ public void ReturnFilteredOpenApiDocumentBasedOnOperationIds(string operationIds // Assert Assert.NotNull(subsetOpenApiDocument); - if (!string.IsNullOrEmpty(operationIds)) - { - Assert.Single(subsetOpenApiDocument.Paths); - } - else if (!string.IsNullOrEmpty(tags)) - { - Assert.NotEmpty(subsetOpenApiDocument.Paths); - } + Assert.NotEmpty(subsetOpenApiDocument.Paths); + Assert.Equal(expectedPathCount, subsetOpenApiDocument.Paths.Count); } [Fact] - public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidOperationIdIsSpecified() + public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidArgumentsArePassed() { // Act and Assert var message = Assert.Throws(() =>OpenApiFilterService.CreatePredicate(null, null)).Message; From 95125ae2b668727f911d003fd99883b333ad8a1b Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 9 Nov 2021 18:43:02 +0300 Subject: [PATCH 032/752] Add validation check and add test --- .../Services/OpenApiFilterServiceTests.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs index c9b87f57f..ab65ed744 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs @@ -46,8 +46,11 @@ public void ReturnFilteredOpenApiDocumentBasedOnOperationIdsAndTags(string opera public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidArgumentsArePassed() { // Act and Assert - var message = Assert.Throws(() =>OpenApiFilterService.CreatePredicate(null, null)).Message; - Assert.Equal("Either operationId(s) or tag(s) need to be specified.", message); + var message1 = Assert.Throws(() => OpenApiFilterService.CreatePredicate(null, null)).Message; + Assert.Equal("Either operationId(s) or tag(s) need to be specified.", message1); + + var message2 = Assert.Throws(() => OpenApiFilterService.CreatePredicate("users.user.ListUser", "users.user")).Message; + Assert.Equal("Cannot specify both operationIds and tags at the same time.", message2); } } } From ba645e47e360cedc7eac910fe692c563bdaeb3c8 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 9 Nov 2021 21:57:22 +0300 Subject: [PATCH 033/752] Rename tool to OpenApi.Hidi --- install-tool.ps1 | 8 ++++---- .../Microsoft.OpenApi.Hidi.csproj} | 0 .../OpenApiService.cs | 3 +-- src/{Microsoft.Hidi => Microsoft.OpenApi.Hidi}/Program.cs | 3 +-- .../StatsVisitor.cs | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) rename src/{Microsoft.Hidi/Microsoft.Hidi.csproj => Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj} (100%) rename src/{Microsoft.Hidi => Microsoft.OpenApi.Hidi}/OpenApiService.cs (98%) rename src/{Microsoft.Hidi => Microsoft.OpenApi.Hidi}/Program.cs (97%) rename src/{Microsoft.Hidi => Microsoft.OpenApi.Hidi}/StatsVisitor.cs (98%) diff --git a/install-tool.ps1 b/install-tool.ps1 index 0e6521110..d268e826e 100644 --- a/install-tool.ps1 +++ b/install-tool.ps1 @@ -1,7 +1,7 @@ -$latest = Get-ChildItem .\artifacts\ Microsoft.OpenApi.Tool* | select-object -Last 1 +$latest = Get-ChildItem .\artifacts\ Microsoft.OpenApi.Hidi* | select-object -Last 1 $version = $latest.Name.Split(".")[3..5] | join-string -Separator "." -if (Test-Path -Path ./artifacts/openapi-parser.exe) { - dotnet tool uninstall --tool-path artifacts Microsoft.OpenApi.Tool +if (Test-Path -Path ./artifacts/hidi.exe) { + dotnet tool uninstall --tool-path artifacts Microsoft.OpenApi.Hidi } -dotnet tool install --tool-path artifacts --add-source .\artifacts\ --version $version Microsoft.OpenApi.Tool \ No newline at end of file +dotnet tool install --tool-path artifacts --add-source .\artifacts\ --version $version Microsoft.OpenApi.Hidi \ No newline at end of file diff --git a/src/Microsoft.Hidi/Microsoft.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj similarity index 100% rename from src/Microsoft.Hidi/Microsoft.Hidi.csproj rename to src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj diff --git a/src/Microsoft.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs similarity index 98% rename from src/Microsoft.Hidi/OpenApiService.cs rename to src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 556eff071..5a415c115 100644 --- a/src/Microsoft.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -7,7 +7,6 @@ using System.Net; using System.Net.Http; using System.Text; -using Microsoft.OpenApi; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Readers; @@ -15,7 +14,7 @@ using Microsoft.OpenApi.Validations; using Microsoft.OpenApi.Writers; -namespace Microsoft.Hidi +namespace Microsoft.OpenApi.Hidi { static class OpenApiService { diff --git a/src/Microsoft.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs similarity index 97% rename from src/Microsoft.Hidi/Program.cs rename to src/Microsoft.OpenApi.Hidi/Program.cs index 033e3625b..31c5b3e69 100644 --- a/src/Microsoft.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -5,9 +5,8 @@ using System.CommandLine.Invocation; using System.IO; using System.Threading.Tasks; -using Microsoft.OpenApi; -namespace Microsoft.Hidi +namespace Microsoft.OpenApi.Hidi { static class Program { diff --git a/src/Microsoft.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs similarity index 98% rename from src/Microsoft.Hidi/StatsVisitor.cs rename to src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index 7617edb97..b05b0de7c 100644 --- a/src/Microsoft.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -6,7 +6,7 @@ using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; -namespace Microsoft.Hidi +namespace Microsoft.OpenApi.Hidi { internal class StatsVisitor : OpenApiVisitorBase { From 7355653b4491ba6fc5794a94b8d9db676ee6b27b Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 10 Nov 2021 13:09:22 +0300 Subject: [PATCH 034/752] Remove whitespace --- install-tool.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install-tool.ps1 b/install-tool.ps1 index d268e826e..0b4615c67 100644 --- a/install-tool.ps1 +++ b/install-tool.ps1 @@ -1,4 +1,4 @@ -$latest = Get-ChildItem .\artifacts\ Microsoft.OpenApi.Hidi* | select-object -Last 1 +$latest = Get-ChildItem .\artifacts\Microsoft.OpenApi.Hidi* | select-object -Last 1 $version = $latest.Name.Split(".")[3..5] | join-string -Separator "." if (Test-Path -Path ./artifacts/hidi.exe) { From d841b6d7cdb0f4eb0b11ddebdbab612d461a33ac Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 16 Nov 2021 18:29:30 +0300 Subject: [PATCH 035/752] Update the tool's version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 27fc4b995..f0d7943e7 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -6,7 +6,7 @@ true hidi ./../../artifacts - 1.3.0-preview + 0.5.0-preview From 11977d06747bd408552e6d0ec1d379cefe6d34f8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Nov 2021 21:29:38 +0000 Subject: [PATCH 036/752] Bump Microsoft.SourceLink.GitHub from 1.0.0 to 1.1.1 Bumps [Microsoft.SourceLink.GitHub](https://github.com/dotnet/sourcelink) from 1.0.0 to 1.1.1. - [Release notes](https://github.com/dotnet/sourcelink/releases) - [Commits](https://github.com/dotnet/sourcelink/compare/1.0.0...1.1.1) --- updated-dependencies: - dependency-name: Microsoft.SourceLink.GitHub dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index f0d7943e7..b13c9dc18 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -19,7 +19,7 @@ - + From 701514ab78c208a9bcdca3efb224ea18a0e2f4af Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 7 Dec 2021 12:41:16 +0300 Subject: [PATCH 037/752] Add filter by collection parameter and logic --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 11 ++++++++++- src/Microsoft.OpenApi.Hidi/Program.cs | 7 ++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 486666568..3cdb4a4dc 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -25,6 +25,7 @@ public static void ProcessOpenApiDocument( OpenApiFormat format, string filterByOperationIds, string filterByTags, + string filterByCollection, bool inline, bool resolveExternal) { @@ -69,6 +70,14 @@ public static void ProcessOpenApiDocument( document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } + if (!string.IsNullOrEmpty(filterByCollection)) + { + var fileStream = GetStream(filterByCollection); + var urlDictionary = OpenApiFilterService.ParseJsonCollectionFile(fileStream); + var predicate = OpenApiFilterService.CreatePredicate(urls: urlDictionary, source:document); + document = OpenApiFilterService.CreateFilteredDocument(document, predicate); + } + var context = result.OpenApiDiagnostic; if (context.Errors.Count > 0) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 533878a0d..1889efb93 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System.CommandLine; @@ -30,9 +30,10 @@ static async Task Main(string[] args) new Option("--inline", "Inline $ref instances", typeof(bool) ), new Option("--resolveExternal","Resolve external $refs", typeof(bool)), new Option("--filterByOperationIds", "Filters OpenApiDocument by OperationId(s) provided", typeof(string)), - new Option("--filterByTags", "Filters OpenApiDocument by Tag(s) provided", typeof(string)) + new Option("--filterByTags", "Filters OpenApiDocument by Tag(s) provided", typeof(string)), + new Option("--filterByCollection", "Filters OpenApiDocument by Postman collection provided", typeof(string)) }; - transformCommand.Handler = CommandHandler.Create( + transformCommand.Handler = CommandHandler.Create( OpenApiService.ProcessOpenApiDocument); rootCommand.Add(transformCommand); From 0e9fb19cc5bf01b74f0b1f7880939157d4a92a48 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 7 Dec 2021 12:42:47 +0300 Subject: [PATCH 038/752] Add library for json serialization --- src/Microsoft.OpenApi.Hidi/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 1889efb93..099eb70df 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System.CommandLine; From b8b46e8621053989491aa9eeff723aa816304885 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 7 Dec 2021 12:43:15 +0300 Subject: [PATCH 039/752] Move declaration closer to assignment --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 3cdb4a4dc..42765a371 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -50,15 +50,13 @@ public static void ProcessOpenApiDocument( } ).ReadAsync(stream).GetAwaiter().GetResult(); - OpenApiDocument document; - document = result.OpenApiDocument; + var document = result.OpenApiDocument; // Check if filter options are provided, then execute if (!string.IsNullOrEmpty(filterByOperationIds) && !string.IsNullOrEmpty(filterByTags)) { throw new InvalidOperationException("Cannot filter by operationIds and tags at the same time."); } - if (!string.IsNullOrEmpty(filterByOperationIds)) { var predicate = OpenApiFilterService.CreatePredicate(operationIds: filterByOperationIds); From 5f7ae4f2a00d13c0594f34cbca73dc41890ca577 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 7 Dec 2021 16:22:52 +0300 Subject: [PATCH 040/752] Move declaration to the outer scope --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 42765a371..c08e0d84c 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -51,6 +51,7 @@ public static void ProcessOpenApiDocument( ).ReadAsync(stream).GetAwaiter().GetResult(); var document = result.OpenApiDocument; + Func predicate; // Check if filter options are provided, then execute if (!string.IsNullOrEmpty(filterByOperationIds) && !string.IsNullOrEmpty(filterByTags)) @@ -59,12 +60,12 @@ public static void ProcessOpenApiDocument( } if (!string.IsNullOrEmpty(filterByOperationIds)) { - var predicate = OpenApiFilterService.CreatePredicate(operationIds: filterByOperationIds); + predicate = OpenApiFilterService.CreatePredicate(operationIds: filterByOperationIds); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } if (!string.IsNullOrEmpty(filterByTags)) { - var predicate = OpenApiFilterService.CreatePredicate(tags: filterByTags); + predicate = OpenApiFilterService.CreatePredicate(tags: filterByTags); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } @@ -72,7 +73,7 @@ public static void ProcessOpenApiDocument( { var fileStream = GetStream(filterByCollection); var urlDictionary = OpenApiFilterService.ParseJsonCollectionFile(fileStream); - var predicate = OpenApiFilterService.CreatePredicate(urls: urlDictionary, source:document); + predicate = OpenApiFilterService.CreatePredicate(urls: urlDictionary, source:document); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } From 17cbf71802ed351294591a5fffea9b906d352f65 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 14 Dec 2021 12:37:26 +0300 Subject: [PATCH 041/752] Add extra params to predicate function --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index c08e0d84c..7ef622d0a 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -51,7 +51,7 @@ public static void ProcessOpenApiDocument( ).ReadAsync(stream).GetAwaiter().GetResult(); var document = result.OpenApiDocument; - Func predicate; + Func predicate; // Check if filter options are provided, then execute if (!string.IsNullOrEmpty(filterByOperationIds) && !string.IsNullOrEmpty(filterByTags)) From 0161f1edea2b66d70f8464e3a933b8c1d6177016 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 14 Dec 2021 13:34:14 +0300 Subject: [PATCH 042/752] Simplify and clean up code --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 7ef622d0a..49636d80b 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -72,8 +72,8 @@ public static void ProcessOpenApiDocument( if (!string.IsNullOrEmpty(filterByCollection)) { var fileStream = GetStream(filterByCollection); - var urlDictionary = OpenApiFilterService.ParseJsonCollectionFile(fileStream); - predicate = OpenApiFilterService.CreatePredicate(urls: urlDictionary, source:document); + var requestUrls = OpenApiFilterService.ParseJsonCollectionFile(fileStream); + predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source:document); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } From 4953e590f8620ecc68a7bfa08535eb5b58035ba9 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 15 Dec 2021 00:42:37 +0300 Subject: [PATCH 043/752] Add sample postman collections for testing --- .../UtilityFiles/postmanCollection_ver1.json | 102 + .../UtilityFiles/postmanCollection_ver2.json | 23698 ++++++++++++++++ 2 files changed, 23800 insertions(+) create mode 100644 test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver1.json create mode 100644 test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver2.json diff --git a/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver1.json b/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver1.json new file mode 100644 index 000000000..151d184e1 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver1.json @@ -0,0 +1,102 @@ +{ + "info": { + "_postman_id": "0017059134807617005", + "name": "Graph-Collection", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "agreementAcceptances-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "agreementAcceptances" + ] + } + } + }, + { + "name": "agreementAcceptances-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "agreementAcceptances" + ] + } + } + }, + { + "name": "{agreementAcceptance-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances/{agreementAcceptance-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "agreementAcceptances", + "{agreementAcceptance-id}" + ] + } + } + }, + { + "name": "{agreementAcceptance-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances/{agreementAcceptance-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "agreementAcceptances", + "{agreementAcceptance-id}" + ] + } + } + }, + { + "name": "{agreementAcceptance-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances/{agreementAcceptance-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "agreementAcceptances", + "{agreementAcceptance-id}" + ] + } + } + } + ] +} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver2.json b/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver2.json new file mode 100644 index 000000000..003577738 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver2.json @@ -0,0 +1,23698 @@ +{ + "info": { + "_postman_id": "43402ca3-f018-7c9b-2315-f176d9b171a3", + "name": "Graph-Collection", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "users-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users" + ] + } + } + }, + { + "name": "users-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users" + ] + } + } + }, + { + "name": "{user-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}" + ] + } + } + }, + { + "name": "{user-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}" + ] + } + } + }, + { + "name": "{user-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}" + ] + } + } + }, + { + "name": "activities-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/activities", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "activities" + ] + } + } + }, + { + "name": "activities-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/activities", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "activities" + ] + } + } + }, + { + "name": "{userActivity-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/activities/{userActivity-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "activities", + "{userActivity-id}" + ] + } + } + }, + { + "name": "{userActivity-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/activities/{userActivity-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "activities", + "{userActivity-id}" + ] + } + } + }, + { + "name": "{userActivity-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/activities/{userActivity-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "activities", + "{userActivity-id}" + ] + } + } + }, + { + "name": "historyItems-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/activities/{userActivity-id}/historyItems", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "activities", + "{userActivity-id}", + "historyItems" + ] + } + } + }, + { + "name": "historyItems-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/activities/{userActivity-id}/historyItems", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "activities", + "{userActivity-id}", + "historyItems" + ] + } + } + }, + { + "name": "{activityHistoryItem-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/activities/{userActivity-id}/historyItems/{activityHistoryItem-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "activities", + "{userActivity-id}", + "historyItems", + "{activityHistoryItem-id}" + ] + } + } + }, + { + "name": "{activityHistoryItem-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/activities/{userActivity-id}/historyItems/{activityHistoryItem-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "activities", + "{userActivity-id}", + "historyItems", + "{activityHistoryItem-id}" + ] + } + } + }, + { + "name": "{activityHistoryItem-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/activities/{userActivity-id}/historyItems/{activityHistoryItem-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "activities", + "{userActivity-id}", + "historyItems", + "{activityHistoryItem-id}" + ] + } + } + }, + { + "name": "activity-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/activities/{userActivity-id}/historyItems/{activityHistoryItem-id}/activity", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "activities", + "{userActivity-id}", + "historyItems", + "{activityHistoryItem-id}", + "activity" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/activities/{userActivity-id}/historyItems/{activityHistoryItem-id}/activity/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "activities", + "{userActivity-id}", + "historyItems", + "{activityHistoryItem-id}", + "activity", + "$ref" + ] + } + } + }, + { + "name": "$ref-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/activities/{userActivity-id}/historyItems/{activityHistoryItem-id}/activity/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "activities", + "{userActivity-id}", + "historyItems", + "{activityHistoryItem-id}", + "activity", + "$ref" + ] + } + } + }, + { + "name": "$ref-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/activities/{userActivity-id}/historyItems/{activityHistoryItem-id}/activity/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "activities", + "{userActivity-id}", + "historyItems", + "{activityHistoryItem-id}", + "activity", + "$ref" + ] + } + } + }, + { + "name": "agreementAcceptances-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/agreementAcceptances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "agreementAcceptances" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/agreementAcceptances/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "agreementAcceptances", + "$ref" + ] + } + } + }, + { + "name": "$ref-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/agreementAcceptances/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "agreementAcceptances", + "$ref" + ] + } + } + }, + { + "name": "appRoleAssignments-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/appRoleAssignments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "appRoleAssignments" + ] + } + } + }, + { + "name": "appRoleAssignments-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/appRoleAssignments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "appRoleAssignments" + ] + } + } + }, + { + "name": "{appRoleAssignment-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/appRoleAssignments/{appRoleAssignment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "appRoleAssignments", + "{appRoleAssignment-id}" + ] + } + } + }, + { + "name": "{appRoleAssignment-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/appRoleAssignments/{appRoleAssignment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "appRoleAssignments", + "{appRoleAssignment-id}" + ] + } + } + }, + { + "name": "{appRoleAssignment-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/appRoleAssignments/{appRoleAssignment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "appRoleAssignments", + "{appRoleAssignment-id}" + ] + } + } + }, + { + "name": "authentication-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication" + ] + } + } + }, + { + "name": "authentication-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication" + ] + } + } + }, + { + "name": "authentication-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication" + ] + } + } + }, + { + "name": "fido2Methods-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/fido2Methods", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "fido2Methods" + ] + } + } + }, + { + "name": "fido2Methods-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/fido2Methods", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "fido2Methods" + ] + } + } + }, + { + "name": "{fido2AuthenticationMethod-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/fido2Methods/{fido2AuthenticationMethod-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "fido2Methods", + "{fido2AuthenticationMethod-id}" + ] + } + } + }, + { + "name": "{fido2AuthenticationMethod-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/fido2Methods/{fido2AuthenticationMethod-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "fido2Methods", + "{fido2AuthenticationMethod-id}" + ] + } + } + }, + { + "name": "{fido2AuthenticationMethod-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/fido2Methods/{fido2AuthenticationMethod-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "fido2Methods", + "{fido2AuthenticationMethod-id}" + ] + } + } + }, + { + "name": "methods-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/methods", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "methods" + ] + } + } + }, + { + "name": "methods-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/methods", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "methods" + ] + } + } + }, + { + "name": "{authenticationMethod-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/methods/{authenticationMethod-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "methods", + "{authenticationMethod-id}" + ] + } + } + }, + { + "name": "{authenticationMethod-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/methods/{authenticationMethod-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "methods", + "{authenticationMethod-id}" + ] + } + } + }, + { + "name": "{authenticationMethod-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/methods/{authenticationMethod-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "methods", + "{authenticationMethod-id}" + ] + } + } + }, + { + "name": "microsoftAuthenticatorMethods-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/microsoftAuthenticatorMethods", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "microsoftAuthenticatorMethods" + ] + } + } + }, + { + "name": "microsoftAuthenticatorMethods-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/microsoftAuthenticatorMethods", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "microsoftAuthenticatorMethods" + ] + } + } + }, + { + "name": "{microsoftAuthenticatorAuthenticationMethod-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/microsoftAuthenticatorMethods/{microsoftAuthenticatorAuthenticationMethod-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "microsoftAuthenticatorMethods", + "{microsoftAuthenticatorAuthenticationMethod-id}" + ] + } + } + }, + { + "name": "{microsoftAuthenticatorAuthenticationMethod-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/microsoftAuthenticatorMethods/{microsoftAuthenticatorAuthenticationMethod-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "microsoftAuthenticatorMethods", + "{microsoftAuthenticatorAuthenticationMethod-id}" + ] + } + } + }, + { + "name": "{microsoftAuthenticatorAuthenticationMethod-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/microsoftAuthenticatorMethods/{microsoftAuthenticatorAuthenticationMethod-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "microsoftAuthenticatorMethods", + "{microsoftAuthenticatorAuthenticationMethod-id}" + ] + } + } + }, + { + "name": "device-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/microsoftAuthenticatorMethods/{microsoftAuthenticatorAuthenticationMethod-id}/device", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "microsoftAuthenticatorMethods", + "{microsoftAuthenticatorAuthenticationMethod-id}", + "device" + ] + } + } + }, + { + "name": "device-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/microsoftAuthenticatorMethods/{microsoftAuthenticatorAuthenticationMethod-id}/device", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "microsoftAuthenticatorMethods", + "{microsoftAuthenticatorAuthenticationMethod-id}", + "device" + ] + } + } + }, + { + "name": "device-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/microsoftAuthenticatorMethods/{microsoftAuthenticatorAuthenticationMethod-id}/device", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "microsoftAuthenticatorMethods", + "{microsoftAuthenticatorAuthenticationMethod-id}", + "device" + ] + } + } + }, + { + "name": "windowsHelloForBusinessMethods-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/windowsHelloForBusinessMethods", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "windowsHelloForBusinessMethods" + ] + } + } + }, + { + "name": "windowsHelloForBusinessMethods-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/windowsHelloForBusinessMethods", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "windowsHelloForBusinessMethods" + ] + } + } + }, + { + "name": "{windowsHelloForBusinessAuthenticationMethod-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/windowsHelloForBusinessMethods/{windowsHelloForBusinessAuthenticationMethod-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "windowsHelloForBusinessMethods", + "{windowsHelloForBusinessAuthenticationMethod-id}" + ] + } + } + }, + { + "name": "{windowsHelloForBusinessAuthenticationMethod-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/windowsHelloForBusinessMethods/{windowsHelloForBusinessAuthenticationMethod-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "windowsHelloForBusinessMethods", + "{windowsHelloForBusinessAuthenticationMethod-id}" + ] + } + } + }, + { + "name": "{windowsHelloForBusinessAuthenticationMethod-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/windowsHelloForBusinessMethods/{windowsHelloForBusinessAuthenticationMethod-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "windowsHelloForBusinessMethods", + "{windowsHelloForBusinessAuthenticationMethod-id}" + ] + } + } + }, + { + "name": "device-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/windowsHelloForBusinessMethods/{windowsHelloForBusinessAuthenticationMethod-id}/device", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "windowsHelloForBusinessMethods", + "{windowsHelloForBusinessAuthenticationMethod-id}", + "device" + ] + } + } + }, + { + "name": "device-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/windowsHelloForBusinessMethods/{windowsHelloForBusinessAuthenticationMethod-id}/device", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "windowsHelloForBusinessMethods", + "{windowsHelloForBusinessAuthenticationMethod-id}", + "device" + ] + } + } + }, + { + "name": "device-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/authentication/windowsHelloForBusinessMethods/{windowsHelloForBusinessAuthenticationMethod-id}/device", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "authentication", + "windowsHelloForBusinessMethods", + "{windowsHelloForBusinessAuthenticationMethod-id}", + "device" + ] + } + } + }, + { + "name": "calendar-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar" + ] + } + } + }, + { + "name": "calendar-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar" + ] + } + } + }, + { + "name": "calendar-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar" + ] + } + } + }, + { + "name": "calendarPermissions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarPermissions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarPermissions" + ] + } + } + }, + { + "name": "calendarPermissions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarPermissions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarPermissions" + ] + } + } + }, + { + "name": "{calendarPermission-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarPermissions/{calendarPermission-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarPermissions", + "{calendarPermission-id}" + ] + } + } + }, + { + "name": "{calendarPermission-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarPermissions/{calendarPermission-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarPermissions", + "{calendarPermission-id}" + ] + } + } + }, + { + "name": "{calendarPermission-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarPermissions/{calendarPermission-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarPermissions", + "{calendarPermission-id}" + ] + } + } + }, + { + "name": "calendarView-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView" + ] + } + } + }, + { + "name": "calendarView-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView" + ] + } + } + }, + { + "name": "{event-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}" + ] + } + } + }, + { + "name": "attachments-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "attachments" + ] + } + } + }, + { + "name": "attachments-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "attachments" + ] + } + } + }, + { + "name": "{attachment-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/attachments/{attachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "attachments", + "{attachment-id}" + ] + } + } + }, + { + "name": "{attachment-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/attachments/{attachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "attachments", + "{attachment-id}" + ] + } + } + }, + { + "name": "{attachment-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/attachments/{attachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "attachments", + "{attachment-id}" + ] + } + } + }, + { + "name": "calendar-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "calendar" + ] + } + } + }, + { + "name": "calendar-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "calendar" + ] + } + } + }, + { + "name": "calendar-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "calendar" + ] + } + } + }, + { + "name": "extensions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "extensions" + ] + } + } + }, + { + "name": "extensions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "extensions" + ] + } + } + }, + { + "name": "{extension-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "{extension-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "{extension-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "instances-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/instances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "instances" + ] + } + } + }, + { + "name": "instances-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/instances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "instances" + ] + } + } + }, + { + "name": "{event-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/instances/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "instances", + "{event-id1}" + ] + } + } + }, + { + "name": "{event-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/instances/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "instances", + "{event-id1}" + ] + } + } + }, + { + "name": "{event-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/instances/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "instances", + "{event-id1}" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/calendarView/{event-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "calendarView", + "{event-id}", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "events-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/events", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "events" + ] + } + } + }, + { + "name": "events-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/events", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "events" + ] + } + } + }, + { + "name": "{event-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/events/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "events", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/events/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "events", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/events/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "events", + "{event-id}" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendar/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendar", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "calendarGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups" + ] + } + } + }, + { + "name": "calendarGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups" + ] + } + } + }, + { + "name": "{calendarGroup-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}" + ] + } + } + }, + { + "name": "{calendarGroup-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}" + ] + } + } + }, + { + "name": "{calendarGroup-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}" + ] + } + } + }, + { + "name": "calendars-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars" + ] + } + } + }, + { + "name": "calendars-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars" + ] + } + } + }, + { + "name": "{calendar-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}" + ] + } + } + }, + { + "name": "{calendar-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}" + ] + } + } + }, + { + "name": "{calendar-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}" + ] + } + } + }, + { + "name": "calendarPermissions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarPermissions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarPermissions" + ] + } + } + }, + { + "name": "calendarPermissions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarPermissions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarPermissions" + ] + } + } + }, + { + "name": "{calendarPermission-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarPermissions/{calendarPermission-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarPermissions", + "{calendarPermission-id}" + ] + } + } + }, + { + "name": "{calendarPermission-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarPermissions/{calendarPermission-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarPermissions", + "{calendarPermission-id}" + ] + } + } + }, + { + "name": "{calendarPermission-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarPermissions/{calendarPermission-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarPermissions", + "{calendarPermission-id}" + ] + } + } + }, + { + "name": "calendarView-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView" + ] + } + } + }, + { + "name": "calendarView-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView" + ] + } + } + }, + { + "name": "{event-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}" + ] + } + } + }, + { + "name": "attachments-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "attachments" + ] + } + } + }, + { + "name": "attachments-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "attachments" + ] + } + } + }, + { + "name": "{attachment-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/attachments/{attachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "attachments", + "{attachment-id}" + ] + } + } + }, + { + "name": "{attachment-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/attachments/{attachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "attachments", + "{attachment-id}" + ] + } + } + }, + { + "name": "{attachment-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/attachments/{attachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "attachments", + "{attachment-id}" + ] + } + } + }, + { + "name": "calendar-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "calendar" + ] + } + } + }, + { + "name": "calendar-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "calendar" + ] + } + } + }, + { + "name": "calendar-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "calendar" + ] + } + } + }, + { + "name": "extensions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "extensions" + ] + } + } + }, + { + "name": "extensions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "extensions" + ] + } + } + }, + { + "name": "{extension-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "{extension-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "{extension-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "instances-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/instances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "instances" + ] + } + } + }, + { + "name": "instances-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/instances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "instances" + ] + } + } + }, + { + "name": "{event-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/instances/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "instances", + "{event-id1}" + ] + } + } + }, + { + "name": "{event-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/instances/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "instances", + "{event-id1}" + ] + } + } + }, + { + "name": "{event-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/instances/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "instances", + "{event-id1}" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/calendarView/{event-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "events-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/events", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "events" + ] + } + } + }, + { + "name": "events-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/events", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "events" + ] + } + } + }, + { + "name": "{event-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/events/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "events", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/events/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "events", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/events/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "events", + "{event-id}" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarGroups/{calendarGroup-id}/calendars/{calendar-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarGroups", + "{calendarGroup-id}", + "calendars", + "{calendar-id}", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "calendars-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars" + ] + } + } + }, + { + "name": "calendars-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars" + ] + } + } + }, + { + "name": "{calendar-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}" + ] + } + } + }, + { + "name": "{calendar-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}" + ] + } + } + }, + { + "name": "{calendar-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}" + ] + } + } + }, + { + "name": "calendarPermissions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarPermissions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarPermissions" + ] + } + } + }, + { + "name": "calendarPermissions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarPermissions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarPermissions" + ] + } + } + }, + { + "name": "{calendarPermission-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarPermissions/{calendarPermission-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarPermissions", + "{calendarPermission-id}" + ] + } + } + }, + { + "name": "{calendarPermission-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarPermissions/{calendarPermission-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarPermissions", + "{calendarPermission-id}" + ] + } + } + }, + { + "name": "{calendarPermission-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarPermissions/{calendarPermission-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarPermissions", + "{calendarPermission-id}" + ] + } + } + }, + { + "name": "calendarView-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView" + ] + } + } + }, + { + "name": "calendarView-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView" + ] + } + } + }, + { + "name": "{event-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}" + ] + } + } + }, + { + "name": "attachments-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "attachments" + ] + } + } + }, + { + "name": "attachments-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "attachments" + ] + } + } + }, + { + "name": "{attachment-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/attachments/{attachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "attachments", + "{attachment-id}" + ] + } + } + }, + { + "name": "{attachment-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/attachments/{attachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "attachments", + "{attachment-id}" + ] + } + } + }, + { + "name": "{attachment-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/attachments/{attachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "attachments", + "{attachment-id}" + ] + } + } + }, + { + "name": "calendar-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "calendar" + ] + } + } + }, + { + "name": "calendar-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "calendar" + ] + } + } + }, + { + "name": "calendar-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "calendar" + ] + } + } + }, + { + "name": "extensions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "extensions" + ] + } + } + }, + { + "name": "extensions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "extensions" + ] + } + } + }, + { + "name": "{extension-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "{extension-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "{extension-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "instances-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/instances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "instances" + ] + } + } + }, + { + "name": "instances-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/instances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "instances" + ] + } + } + }, + { + "name": "{event-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/instances/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "instances", + "{event-id1}" + ] + } + } + }, + { + "name": "{event-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/instances/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "instances", + "{event-id1}" + ] + } + } + }, + { + "name": "{event-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/instances/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "instances", + "{event-id1}" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/calendarView/{event-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "calendarView", + "{event-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "events-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/events", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "events" + ] + } + } + }, + { + "name": "events-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/events", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "events" + ] + } + } + }, + { + "name": "{event-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/events/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "events", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/events/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "events", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/events/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "events", + "{event-id}" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{multiValueLegacyExtendedProperty-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/multiValueExtendedProperties/{multiValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "multiValueExtendedProperties", + "{multiValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "{singleValueLegacyExtendedProperty-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendars/{calendar-id}/singleValueExtendedProperties/{singleValueLegacyExtendedProperty-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendars", + "{calendar-id}", + "singleValueExtendedProperties", + "{singleValueLegacyExtendedProperty-id}" + ] + } + } + }, + { + "name": "calendarView-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView" + ] + } + } + }, + { + "name": "calendarView-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView" + ] + } + } + }, + { + "name": "{event-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}" + ] + } + } + }, + { + "name": "attachments-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "attachments" + ] + } + } + }, + { + "name": "attachments-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "attachments" + ] + } + } + }, + { + "name": "{attachment-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/attachments/{attachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "attachments", + "{attachment-id}" + ] + } + } + }, + { + "name": "{attachment-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/attachments/{attachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "attachments", + "{attachment-id}" + ] + } + } + }, + { + "name": "{attachment-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/attachments/{attachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "attachments", + "{attachment-id}" + ] + } + } + }, + { + "name": "calendar-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar" + ] + } + } + }, + { + "name": "calendar-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar" + ] + } + } + }, + { + "name": "calendar-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar" + ] + } + } + }, + { + "name": "calendarPermissions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/calendarPermissions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "calendarPermissions" + ] + } + } + }, + { + "name": "calendarPermissions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/calendarPermissions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "calendarPermissions" + ] + } + } + }, + { + "name": "{calendarPermission-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/calendarPermissions/{calendarPermission-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "calendarPermissions", + "{calendarPermission-id}" + ] + } + } + }, + { + "name": "{calendarPermission-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/calendarPermissions/{calendarPermission-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "calendarPermissions", + "{calendarPermission-id}" + ] + } + } + }, + { + "name": "{calendarPermission-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/calendarPermissions/{calendarPermission-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "calendarPermissions", + "{calendarPermission-id}" + ] + } + } + }, + { + "name": "calendarView-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/calendarView", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "calendarView" + ] + } + } + }, + { + "name": "calendarView-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/calendarView", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "calendarView" + ] + } + } + }, + { + "name": "{event-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/calendarView/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "calendarView", + "{event-id1}" + ] + } + } + }, + { + "name": "{event-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/calendarView/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "calendarView", + "{event-id1}" + ] + } + } + }, + { + "name": "{event-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/calendarView/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "calendarView", + "{event-id1}" + ] + } + } + }, + { + "name": "events-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/events", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "events" + ] + } + } + }, + { + "name": "events-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/events", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "events" + ] + } + } + }, + { + "name": "{event-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/events/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "events", + "{event-id1}" + ] + } + } + }, + { + "name": "{event-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/events/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "events", + "{event-id1}" + ] + } + } + }, + { + "name": "{event-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/events/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "events", + "{event-id1}" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/calendar/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "calendar", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "extensions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "extensions" + ] + } + } + }, + { + "name": "extensions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "extensions" + ] + } + } + }, + { + "name": "{extension-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "{extension-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "{extension-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "instances-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/instances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "instances" + ] + } + } + }, + { + "name": "instances-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/instances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "instances" + ] + } + } + }, + { + "name": "{event-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/instances/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "instances", + "{event-id1}" + ] + } + } + }, + { + "name": "{event-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/instances/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "instances", + "{event-id1}" + ] + } + } + }, + { + "name": "{event-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/instances/{event-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "instances", + "{event-id1}" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/calendarView/{event-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "calendarView", + "{event-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "chats-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/chats", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "chats" + ] + } + } + }, + { + "name": "chats-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/chats", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "chats" + ] + } + } + }, + { + "name": "{chat-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/chats/{chat-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "chats", + "{chat-id}" + ] + } + } + }, + { + "name": "{chat-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/chats/{chat-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "chats", + "{chat-id}" + ] + } + } + }, + { + "name": "{chat-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/chats/{chat-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "chats", + "{chat-id}" + ] + } + } + }, + { + "name": "contactFolders-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders" + ] + } + } + }, + { + "name": "contactFolders-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders" + ] + } + } + }, + { + "name": "{contactFolder-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}" + ] + } + } + }, + { + "name": "{contactFolder-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}" + ] + } + } + }, + { + "name": "{contactFolder-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}" + ] + } + } + }, + { + "name": "childFolders-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/childFolders", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "childFolders" + ] + } + } + }, + { + "name": "childFolders-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/childFolders", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "childFolders" + ] + } + } + }, + { + "name": "{contactFolder-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/childFolders/{contactFolder-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "childFolders", + "{contactFolder-id1}" + ] + } + } + }, + { + "name": "{contactFolder-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/childFolders/{contactFolder-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "childFolders", + "{contactFolder-id1}" + ] + } + } + }, + { + "name": "{contactFolder-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/childFolders/{contactFolder-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "childFolders", + "{contactFolder-id1}" + ] + } + } + }, + { + "name": "contacts-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts" + ] + } + } + }, + { + "name": "contacts-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts" + ] + } + } + }, + { + "name": "{contact-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts/{contact-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts", + "{contact-id}" + ] + } + } + }, + { + "name": "{contact-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts/{contact-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts", + "{contact-id}" + ] + } + } + }, + { + "name": "{contact-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts/{contact-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts", + "{contact-id}" + ] + } + } + }, + { + "name": "extensions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts/{contact-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts", + "{contact-id}", + "extensions" + ] + } + } + }, + { + "name": "extensions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts/{contact-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts", + "{contact-id}", + "extensions" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts/{contact-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts", + "{contact-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts/{contact-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts", + "{contact-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "photo-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts/{contact-id}/photo", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts", + "{contact-id}", + "photo" + ] + } + } + }, + { + "name": "photo-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts/{contact-id}/photo", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts", + "{contact-id}", + "photo" + ] + } + } + }, + { + "name": "photo-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts/{contact-id}/photo", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts", + "{contact-id}", + "photo" + ] + } + } + }, + { + "name": "$value-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts/{contact-id}/photo/$value", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts", + "{contact-id}", + "photo", + "$value" + ] + } + } + }, + { + "name": "$value-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts/{contact-id}/photo/$value", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts", + "{contact-id}", + "photo", + "$value" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts/{contact-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts", + "{contact-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/contacts/{contact-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "contacts", + "{contact-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contactFolders/{contactFolder-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contactFolders", + "{contactFolder-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "contacts-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts" + ] + } + } + }, + { + "name": "contacts-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts" + ] + } + } + }, + { + "name": "{contact-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts/{contact-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts", + "{contact-id}" + ] + } + } + }, + { + "name": "{contact-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts/{contact-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts", + "{contact-id}" + ] + } + } + }, + { + "name": "{contact-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts/{contact-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts", + "{contact-id}" + ] + } + } + }, + { + "name": "extensions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts/{contact-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts", + "{contact-id}", + "extensions" + ] + } + } + }, + { + "name": "extensions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts/{contact-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts", + "{contact-id}", + "extensions" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts/{contact-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts", + "{contact-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts/{contact-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts", + "{contact-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "photo-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts/{contact-id}/photo", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts", + "{contact-id}", + "photo" + ] + } + } + }, + { + "name": "photo-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts/{contact-id}/photo", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts", + "{contact-id}", + "photo" + ] + } + } + }, + { + "name": "photo-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts/{contact-id}/photo", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts", + "{contact-id}", + "photo" + ] + } + } + }, + { + "name": "$value-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts/{contact-id}/photo/$value", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts", + "{contact-id}", + "photo", + "$value" + ] + } + } + }, + { + "name": "$value-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts/{contact-id}/photo/$value", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts", + "{contact-id}", + "photo", + "$value" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts/{contact-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts", + "{contact-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/contacts/{contact-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "contacts", + "{contact-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "createdObjects-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/createdObjects", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "createdObjects" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/createdObjects/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "createdObjects", + "$ref" + ] + } + } + }, + { + "name": "$ref-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/createdObjects/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "createdObjects", + "$ref" + ] + } + } + }, + { + "name": "deviceManagementTroubleshootingEvents-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/deviceManagementTroubleshootingEvents", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "deviceManagementTroubleshootingEvents" + ] + } + } + }, + { + "name": "deviceManagementTroubleshootingEvents-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/deviceManagementTroubleshootingEvents", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "deviceManagementTroubleshootingEvents" + ] + } + } + }, + { + "name": "{deviceManagementTroubleshootingEvent-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/deviceManagementTroubleshootingEvents/{deviceManagementTroubleshootingEvent-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "deviceManagementTroubleshootingEvents", + "{deviceManagementTroubleshootingEvent-id}" + ] + } + } + }, + { + "name": "{deviceManagementTroubleshootingEvent-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/deviceManagementTroubleshootingEvents/{deviceManagementTroubleshootingEvent-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "deviceManagementTroubleshootingEvents", + "{deviceManagementTroubleshootingEvent-id}" + ] + } + } + }, + { + "name": "{deviceManagementTroubleshootingEvent-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/deviceManagementTroubleshootingEvents/{deviceManagementTroubleshootingEvent-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "deviceManagementTroubleshootingEvents", + "{deviceManagementTroubleshootingEvent-id}" + ] + } + } + }, + { + "name": "directReports-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/directReports", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "directReports" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/directReports/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "directReports", + "$ref" + ] + } + } + }, + { + "name": "$ref-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/directReports/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "directReports", + "$ref" + ] + } + } + }, + { + "name": "drive-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/drive", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "drive" + ] + } + } + }, + { + "name": "drive-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/drive", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "drive" + ] + } + } + }, + { + "name": "drive-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/drive", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "drive" + ] + } + } + }, + { + "name": "drives-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/drives", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "drives" + ] + } + } + }, + { + "name": "drives-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/drives", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "drives" + ] + } + } + }, + { + "name": "{drive-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/drives/{drive-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "drives", + "{drive-id}" + ] + } + } + }, + { + "name": "{drive-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/drives/{drive-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "drives", + "{drive-id}" + ] + } + } + }, + { + "name": "{drive-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/drives/{drive-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "drives", + "{drive-id}" + ] + } + } + }, + { + "name": "events-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/events", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "events" + ] + } + } + }, + { + "name": "events-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/events", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "events" + ] + } + } + }, + { + "name": "{event-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/events/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "events", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/events/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "events", + "{event-id}" + ] + } + } + }, + { + "name": "{event-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/events/{event-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "events", + "{event-id}" + ] + } + } + }, + { + "name": "extensions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "extensions" + ] + } + } + }, + { + "name": "extensions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "extensions" + ] + } + } + }, + { + "name": "{extension-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "{extension-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "{extension-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "followedSites-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/followedSites", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "followedSites" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/followedSites/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "followedSites", + "$ref" + ] + } + } + }, + { + "name": "$ref-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/followedSites/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "followedSites", + "$ref" + ] + } + } + }, + { + "name": "inferenceClassification-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/inferenceClassification", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "inferenceClassification" + ] + } + } + }, + { + "name": "inferenceClassification-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/inferenceClassification", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "inferenceClassification" + ] + } + } + }, + { + "name": "inferenceClassification-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/inferenceClassification", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "inferenceClassification" + ] + } + } + }, + { + "name": "overrides-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/inferenceClassification/overrides", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "inferenceClassification", + "overrides" + ] + } + } + }, + { + "name": "overrides-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/inferenceClassification/overrides", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "inferenceClassification", + "overrides" + ] + } + } + }, + { + "name": "{inferenceClassificationOverride-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/inferenceClassification/overrides/{inferenceClassificationOverride-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "inferenceClassification", + "overrides", + "{inferenceClassificationOverride-id}" + ] + } + } + }, + { + "name": "{inferenceClassificationOverride-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/inferenceClassification/overrides/{inferenceClassificationOverride-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "inferenceClassification", + "overrides", + "{inferenceClassificationOverride-id}" + ] + } + } + }, + { + "name": "{inferenceClassificationOverride-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/inferenceClassification/overrides/{inferenceClassificationOverride-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "inferenceClassification", + "overrides", + "{inferenceClassificationOverride-id}" + ] + } + } + }, + { + "name": "insights-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights" + ] + } + } + }, + { + "name": "insights-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights" + ] + } + } + }, + { + "name": "insights-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights" + ] + } + } + }, + { + "name": "shared-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/shared", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "shared" + ] + } + } + }, + { + "name": "shared-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/shared", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "shared" + ] + } + } + }, + { + "name": "{sharedInsight-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/shared/{sharedInsight-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "shared", + "{sharedInsight-id}" + ] + } + } + }, + { + "name": "{sharedInsight-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/shared/{sharedInsight-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "shared", + "{sharedInsight-id}" + ] + } + } + }, + { + "name": "{sharedInsight-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/shared/{sharedInsight-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "shared", + "{sharedInsight-id}" + ] + } + } + }, + { + "name": "lastSharedMethod-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/shared/{sharedInsight-id}/lastSharedMethod", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "shared", + "{sharedInsight-id}", + "lastSharedMethod" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/shared/{sharedInsight-id}/lastSharedMethod/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "shared", + "{sharedInsight-id}", + "lastSharedMethod", + "$ref" + ] + } + } + }, + { + "name": "$ref-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/shared/{sharedInsight-id}/lastSharedMethod/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "shared", + "{sharedInsight-id}", + "lastSharedMethod", + "$ref" + ] + } + } + }, + { + "name": "$ref-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/shared/{sharedInsight-id}/lastSharedMethod/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "shared", + "{sharedInsight-id}", + "lastSharedMethod", + "$ref" + ] + } + } + }, + { + "name": "resource-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/shared/{sharedInsight-id}/resource", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "shared", + "{sharedInsight-id}", + "resource" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/shared/{sharedInsight-id}/resource/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "shared", + "{sharedInsight-id}", + "resource", + "$ref" + ] + } + } + }, + { + "name": "$ref-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/shared/{sharedInsight-id}/resource/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "shared", + "{sharedInsight-id}", + "resource", + "$ref" + ] + } + } + }, + { + "name": "$ref-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/shared/{sharedInsight-id}/resource/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "shared", + "{sharedInsight-id}", + "resource", + "$ref" + ] + } + } + }, + { + "name": "trending-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/trending", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "trending" + ] + } + } + }, + { + "name": "trending-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/trending", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "trending" + ] + } + } + }, + { + "name": "{trending-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/trending/{trending-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "trending", + "{trending-id}" + ] + } + } + }, + { + "name": "{trending-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/trending/{trending-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "trending", + "{trending-id}" + ] + } + } + }, + { + "name": "{trending-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/trending/{trending-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "trending", + "{trending-id}" + ] + } + } + }, + { + "name": "resource-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/trending/{trending-id}/resource", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "trending", + "{trending-id}", + "resource" + ] + } + } + }, + { + "name": "used-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/used", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "used" + ] + } + } + }, + { + "name": "used-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/used", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "used" + ] + } + } + }, + { + "name": "{usedInsight-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/used/{usedInsight-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "used", + "{usedInsight-id}" + ] + } + } + }, + { + "name": "{usedInsight-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/used/{usedInsight-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "used", + "{usedInsight-id}" + ] + } + } + }, + { + "name": "{usedInsight-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/used/{usedInsight-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "used", + "{usedInsight-id}" + ] + } + } + }, + { + "name": "resource-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/insights/used/{usedInsight-id}/resource", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "insights", + "used", + "{usedInsight-id}", + "resource" + ] + } + } + }, + { + "name": "joinedTeams-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/joinedTeams", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "joinedTeams" + ] + } + } + }, + { + "name": "joinedTeams-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/joinedTeams", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "joinedTeams" + ] + } + } + }, + { + "name": "{team-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/joinedTeams/{team-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "joinedTeams", + "{team-id}" + ] + } + } + }, + { + "name": "{team-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/joinedTeams/{team-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "joinedTeams", + "{team-id}" + ] + } + } + }, + { + "name": "{team-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/joinedTeams/{team-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "joinedTeams", + "{team-id}" + ] + } + } + }, + { + "name": "licenseDetails-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/licenseDetails", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "licenseDetails" + ] + } + } + }, + { + "name": "licenseDetails-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/licenseDetails", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "licenseDetails" + ] + } + } + }, + { + "name": "{licenseDetails-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/licenseDetails/{licenseDetails-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "licenseDetails", + "{licenseDetails-id}" + ] + } + } + }, + { + "name": "{licenseDetails-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/licenseDetails/{licenseDetails-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "licenseDetails", + "{licenseDetails-id}" + ] + } + } + }, + { + "name": "{licenseDetails-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/licenseDetails/{licenseDetails-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "licenseDetails", + "{licenseDetails-id}" + ] + } + } + }, + { + "name": "mailFolders-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders" + ] + } + } + }, + { + "name": "mailFolders-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders" + ] + } + } + }, + { + "name": "{mailFolder-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}" + ] + } + } + }, + { + "name": "{mailFolder-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}" + ] + } + } + }, + { + "name": "{mailFolder-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}" + ] + } + } + }, + { + "name": "childFolders-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/childFolders", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "childFolders" + ] + } + } + }, + { + "name": "childFolders-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/childFolders", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "childFolders" + ] + } + } + }, + { + "name": "{mailFolder-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "childFolders", + "{mailFolder-id1}" + ] + } + } + }, + { + "name": "{mailFolder-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "childFolders", + "{mailFolder-id1}" + ] + } + } + }, + { + "name": "{mailFolder-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/childFolders/{mailFolder-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "childFolders", + "{mailFolder-id1}" + ] + } + } + }, + { + "name": "messageRules-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messageRules", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messageRules" + ] + } + } + }, + { + "name": "messageRules-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messageRules", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messageRules" + ] + } + } + }, + { + "name": "{messageRule-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messageRules/{messageRule-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messageRules", + "{messageRule-id}" + ] + } + } + }, + { + "name": "{messageRule-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messageRules/{messageRule-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messageRules", + "{messageRule-id}" + ] + } + } + }, + { + "name": "{messageRule-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messageRules/{messageRule-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messageRules", + "{messageRule-id}" + ] + } + } + }, + { + "name": "messages-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages" + ] + } + } + }, + { + "name": "messages-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages" + ] + } + } + }, + { + "name": "{message-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages", + "{message-id}" + ] + } + } + }, + { + "name": "{message-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages", + "{message-id}" + ] + } + } + }, + { + "name": "{message-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages", + "{message-id}" + ] + } + } + }, + { + "name": "$value-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/$value", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages", + "{message-id}", + "$value" + ] + } + } + }, + { + "name": "$value-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/$value", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages", + "{message-id}", + "$value" + ] + } + } + }, + { + "name": "attachments-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages", + "{message-id}", + "attachments" + ] + } + } + }, + { + "name": "attachments-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages", + "{message-id}", + "attachments" + ] + } + } + }, + { + "name": "extensions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages", + "{message-id}", + "extensions" + ] + } + } + }, + { + "name": "extensions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages", + "{message-id}", + "extensions" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages", + "{message-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages", + "{message-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages", + "{message-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/messages/{message-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "messages", + "{message-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/mailFolders/{mailFolder-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "mailFolders", + "{mailFolder-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "managedAppRegistrations-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedAppRegistrations", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedAppRegistrations" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedAppRegistrations/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedAppRegistrations", + "$ref" + ] + } + } + }, + { + "name": "$ref-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedAppRegistrations/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedAppRegistrations", + "$ref" + ] + } + } + }, + { + "name": "managedDevices-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices" + ] + } + } + }, + { + "name": "managedDevices-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices" + ] + } + } + }, + { + "name": "{managedDevice-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}" + ] + } + } + }, + { + "name": "{managedDevice-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}" + ] + } + } + }, + { + "name": "{managedDevice-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}" + ] + } + } + }, + { + "name": "deviceCategory-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}/deviceCategory", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}", + "deviceCategory" + ] + } + } + }, + { + "name": "deviceCategory-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}/deviceCategory", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}", + "deviceCategory" + ] + } + } + }, + { + "name": "deviceCategory-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}/deviceCategory", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}", + "deviceCategory" + ] + } + } + }, + { + "name": "deviceCompliancePolicyStates-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}/deviceCompliancePolicyStates", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}", + "deviceCompliancePolicyStates" + ] + } + } + }, + { + "name": "deviceCompliancePolicyStates-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}/deviceCompliancePolicyStates", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}", + "deviceCompliancePolicyStates" + ] + } + } + }, + { + "name": "{deviceCompliancePolicyState-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}/deviceCompliancePolicyStates/{deviceCompliancePolicyState-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}", + "deviceCompliancePolicyStates", + "{deviceCompliancePolicyState-id}" + ] + } + } + }, + { + "name": "{deviceCompliancePolicyState-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}/deviceCompliancePolicyStates/{deviceCompliancePolicyState-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}", + "deviceCompliancePolicyStates", + "{deviceCompliancePolicyState-id}" + ] + } + } + }, + { + "name": "{deviceCompliancePolicyState-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}/deviceCompliancePolicyStates/{deviceCompliancePolicyState-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}", + "deviceCompliancePolicyStates", + "{deviceCompliancePolicyState-id}" + ] + } + } + }, + { + "name": "deviceConfigurationStates-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}/deviceConfigurationStates", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}", + "deviceConfigurationStates" + ] + } + } + }, + { + "name": "deviceConfigurationStates-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}/deviceConfigurationStates", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}", + "deviceConfigurationStates" + ] + } + } + }, + { + "name": "{deviceConfigurationState-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}/deviceConfigurationStates/{deviceConfigurationState-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}", + "deviceConfigurationStates", + "{deviceConfigurationState-id}" + ] + } + } + }, + { + "name": "{deviceConfigurationState-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}/deviceConfigurationStates/{deviceConfigurationState-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}", + "deviceConfigurationStates", + "{deviceConfigurationState-id}" + ] + } + } + }, + { + "name": "{deviceConfigurationState-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/managedDevices/{managedDevice-id}/deviceConfigurationStates/{deviceConfigurationState-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "managedDevices", + "{managedDevice-id}", + "deviceConfigurationStates", + "{deviceConfigurationState-id}" + ] + } + } + }, + { + "name": "manager-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/manager", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "manager" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/manager/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "manager", + "$ref" + ] + } + } + }, + { + "name": "$ref-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/manager/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "manager", + "$ref" + ] + } + } + }, + { + "name": "$ref-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/manager/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "manager", + "$ref" + ] + } + } + }, + { + "name": "memberOf-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/memberOf", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "memberOf" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/memberOf/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "memberOf", + "$ref" + ] + } + } + }, + { + "name": "$ref-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/memberOf/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "memberOf", + "$ref" + ] + } + } + }, + { + "name": "messages-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages" + ] + } + } + }, + { + "name": "messages-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages" + ] + } + } + }, + { + "name": "{message-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages", + "{message-id}" + ] + } + } + }, + { + "name": "{message-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages", + "{message-id}" + ] + } + } + }, + { + "name": "{message-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages", + "{message-id}" + ] + } + } + }, + { + "name": "$value-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}/$value", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages", + "{message-id}", + "$value" + ] + } + } + }, + { + "name": "$value-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}/$value", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages", + "{message-id}", + "$value" + ] + } + } + }, + { + "name": "attachments-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages", + "{message-id}", + "attachments" + ] + } + } + }, + { + "name": "attachments-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages", + "{message-id}", + "attachments" + ] + } + } + }, + { + "name": "extensions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages", + "{message-id}", + "extensions" + ] + } + } + }, + { + "name": "extensions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages", + "{message-id}", + "extensions" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages", + "{message-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "multiValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}/multiValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages", + "{message-id}", + "multiValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages", + "{message-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "singleValueExtendedProperties-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/messages/{message-id}/singleValueExtendedProperties", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "messages", + "{message-id}", + "singleValueExtendedProperties" + ] + } + } + }, + { + "name": "oauth2PermissionGrants-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/oauth2PermissionGrants", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "oauth2PermissionGrants" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/oauth2PermissionGrants/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "oauth2PermissionGrants", + "$ref" + ] + } + } + }, + { + "name": "$ref-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/oauth2PermissionGrants/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "oauth2PermissionGrants", + "$ref" + ] + } + } + }, + { + "name": "onenote-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote" + ] + } + } + }, + { + "name": "onenote-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote" + ] + } + } + }, + { + "name": "onenote-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote" + ] + } + } + }, + { + "name": "notebooks-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks" + ] + } + } + }, + { + "name": "notebooks-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks" + ] + } + } + }, + { + "name": "{notebook-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}" + ] + } + } + }, + { + "name": "{notebook-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}" + ] + } + } + }, + { + "name": "{notebook-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups" + ] + } + } + }, + { + "name": "{sectionGroup-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "{sectionGroup-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "{sectionGroup-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections" + ] + } + } + }, + { + "name": "{onenoteSection-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "{onenoteSection-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "{onenoteSection-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "pages-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages" + ] + } + } + }, + { + "name": "pages-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages" + ] + } + } + }, + { + "name": "{onenotePage-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "{onenotePage-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "{onenotePage-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "content-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "content" + ] + } + } + }, + { + "name": "content-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "content" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentSection-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "parentSection-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "parentSection-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections" + ] + } + } + }, + { + "name": "{onenoteSection-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "{onenoteSection-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "{onenoteSection-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "pages-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/pages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "pages" + ] + } + } + }, + { + "name": "pages-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/pages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "pages" + ] + } + } + }, + { + "name": "{onenotePage-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "{onenotePage-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "{onenotePage-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "content-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "content" + ] + } + } + }, + { + "name": "content-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "content" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentSection-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "parentSection-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "parentSection-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentNotebook" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentSectionGroup" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sectionGroups" + ] + } + } + }, + { + "name": "{sectionGroup-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "{sectionGroup-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "{sectionGroup-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sections" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks/{notebook-id}/sections/{onenoteSection-id}/parentSectionGroup/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "notebooks", + "{notebook-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "operations-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/operations", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "operations" + ] + } + } + }, + { + "name": "operations-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/operations", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "operations" + ] + } + } + }, + { + "name": "{onenoteOperation-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/operations/{onenoteOperation-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "operations", + "{onenoteOperation-id}" + ] + } + } + }, + { + "name": "{onenoteOperation-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/operations/{onenoteOperation-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "operations", + "{onenoteOperation-id}" + ] + } + } + }, + { + "name": "{onenoteOperation-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/operations/{onenoteOperation-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "operations", + "{onenoteOperation-id}" + ] + } + } + }, + { + "name": "pages-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages" + ] + } + } + }, + { + "name": "pages-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages" + ] + } + } + }, + { + "name": "{onenotePage-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "{onenotePage-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "{onenotePage-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "content-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "content" + ] + } + } + }, + { + "name": "content-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "content" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups" + ] + } + } + }, + { + "name": "{sectionGroup-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "{sectionGroup-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "{sectionGroup-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections" + ] + } + } + }, + { + "name": "{onenoteSection-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "{onenoteSection-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "{onenoteSection-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "pages-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages" + ] + } + } + }, + { + "name": "pages-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages" + ] + } + } + }, + { + "name": "{onenotePage-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id1}" + ] + } + } + }, + { + "name": "{onenotePage-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id1}" + ] + } + } + }, + { + "name": "{onenotePage-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id1}" + ] + } + } + }, + { + "name": "content-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id1}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id1}", + "content" + ] + } + } + }, + { + "name": "content-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id1}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id1}", + "content" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections" + ] + } + } + }, + { + "name": "{onenoteSection-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "{onenoteSection-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "{onenoteSection-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "pages-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/pages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages" + ] + } + } + }, + { + "name": "pages-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/pages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages" + ] + } + } + }, + { + "name": "{onenotePage-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id1}" + ] + } + } + }, + { + "name": "{onenotePage-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id1}" + ] + } + } + }, + { + "name": "{onenotePage-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id1}" + ] + } + } + }, + { + "name": "content-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id1}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id1}", + "content" + ] + } + } + }, + { + "name": "content-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id1}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id1}", + "content" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentNotebook" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentSectionGroup" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sectionGroups" + ] + } + } + }, + { + "name": "{sectionGroup-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "{sectionGroup-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "{sectionGroup-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sections" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id}/parentSectionGroup/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "parentSection-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "parentSection-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "parentSection-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "pages-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/pages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "pages" + ] + } + } + }, + { + "name": "pages-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/pages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "pages" + ] + } + } + }, + { + "name": "{onenotePage-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/pages/{onenotePage-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "pages", + "{onenotePage-id1}" + ] + } + } + }, + { + "name": "{onenotePage-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/pages/{onenotePage-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "pages", + "{onenotePage-id1}" + ] + } + } + }, + { + "name": "{onenotePage-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/pages/{onenotePage-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "pages", + "{onenotePage-id1}" + ] + } + } + }, + { + "name": "content-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/pages/{onenotePage-id1}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "pages", + "{onenotePage-id1}", + "content" + ] + } + } + }, + { + "name": "content-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/pages/{onenotePage-id1}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "pages", + "{onenotePage-id1}", + "content" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups" + ] + } + } + }, + { + "name": "{sectionGroup-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "{sectionGroup-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "{sectionGroup-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections" + ] + } + } + }, + { + "name": "{onenoteSection-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "{onenoteSection-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "{onenoteSection-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentNotebook/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentNotebook", + "sections" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup", + "parentNotebook" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup/parentNotebook/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup", + "parentNotebook", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup/parentNotebook/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup", + "parentNotebook", + "sectionGroups" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup/parentNotebook/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup", + "parentNotebook", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup/parentNotebook/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup", + "parentNotebook", + "sections" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup", + "parentSectionGroup" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup", + "sectionGroups" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/pages/{onenotePage-id}/parentSection/parentSectionGroup/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "pages", + "{onenotePage-id}", + "parentSection", + "parentSectionGroup", + "sections" + ] + } + } + }, + { + "name": "resources-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/resources", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "resources" + ] + } + } + }, + { + "name": "resources-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/resources", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "resources" + ] + } + } + }, + { + "name": "{onenoteResource-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/resources/{onenoteResource-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "resources", + "{onenoteResource-id}" + ] + } + } + }, + { + "name": "{onenoteResource-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/resources/{onenoteResource-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "resources", + "{onenoteResource-id}" + ] + } + } + }, + { + "name": "{onenoteResource-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/resources/{onenoteResource-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "resources", + "{onenoteResource-id}" + ] + } + } + }, + { + "name": "content-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/resources/{onenoteResource-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "resources", + "{onenoteResource-id}", + "content" + ] + } + } + }, + { + "name": "content-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/resources/{onenoteResource-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "resources", + "{onenoteResource-id}", + "content" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups" + ] + } + } + }, + { + "name": "{sectionGroup-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "{sectionGroup-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "{sectionGroup-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "{onenotePage-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "{onenotePage-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "{onenotePage-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "content-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "content" + ] + } + } + }, + { + "name": "content-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "content" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentSection-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "parentSection-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "parentSection-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentNotebook/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sections" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "{sectionGroup-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id1}" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sectionGroups/{sectionGroup-id}/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sectionGroups", + "{sectionGroup-id}", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections" + ] + } + } + }, + { + "name": "{onenoteSection-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "{onenoteSection-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "{onenoteSection-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}" + ] + } + } + }, + { + "name": "pages-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages" + ] + } + } + }, + { + "name": "pages-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages" + ] + } + } + }, + { + "name": "{onenotePage-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "{onenotePage-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "{onenotePage-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}" + ] + } + } + }, + { + "name": "content-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "content" + ] + } + } + }, + { + "name": "content-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "content" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sectionGroups" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentNotebook/sectionGroups/{sectionGroup-id}/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentNotebook", + "sectionGroups", + "{sectionGroup-id}", + "sections" + ] + } + } + }, + { + "name": "parentSection-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "parentSection-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "parentSection-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/pages/{onenotePage-id}/parentSection", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "pages", + "{onenotePage-id}", + "parentSection" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentNotebook" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentNotebook/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentNotebook", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentNotebook/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentNotebook", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentNotebook/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentNotebook", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentNotebook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentNotebook" + ] + } + } + }, + { + "name": "parentNotebook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup/parentNotebook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentNotebook" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup/parentNotebook/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentNotebook", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup/parentNotebook/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentNotebook", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "{onenoteSection-id1}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup/parentNotebook/sections/{onenoteSection-id1}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentNotebook", + "sections", + "{onenoteSection-id1}" + ] + } + } + }, + { + "name": "parentSectionGroup-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentSectionGroup" + ] + } + } + }, + { + "name": "parentSectionGroup-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup/parentSectionGroup", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "parentSectionGroup" + ] + } + } + }, + { + "name": "sectionGroups-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sectionGroups" + ] + } + } + }, + { + "name": "sectionGroups-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup/sectionGroups", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sectionGroups" + ] + } + } + }, + { + "name": "sections-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sections" + ] + } + } + }, + { + "name": "sections-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onenote/sections/{onenoteSection-id}/parentSectionGroup/sections", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onenote", + "sections", + "{onenoteSection-id}", + "parentSectionGroup", + "sections" + ] + } + } + }, + { + "name": "onlineMeetings-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onlineMeetings", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onlineMeetings" + ] + } + } + }, + { + "name": "onlineMeetings-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onlineMeetings", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onlineMeetings" + ] + } + } + }, + { + "name": "{onlineMeeting-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onlineMeetings/{onlineMeeting-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onlineMeetings", + "{onlineMeeting-id}" + ] + } + } + }, + { + "name": "{onlineMeeting-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onlineMeetings/{onlineMeeting-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onlineMeetings", + "{onlineMeeting-id}" + ] + } + } + }, + { + "name": "{onlineMeeting-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onlineMeetings/{onlineMeeting-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onlineMeetings", + "{onlineMeeting-id}" + ] + } + } + }, + { + "name": "attendeeReport-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onlineMeetings/{onlineMeeting-id}/attendeeReport", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onlineMeetings", + "{onlineMeeting-id}", + "attendeeReport" + ] + } + } + }, + { + "name": "attendeeReport-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/onlineMeetings/{onlineMeeting-id}/attendeeReport", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "onlineMeetings", + "{onlineMeeting-id}", + "attendeeReport" + ] + } + } + }, + { + "name": "outlook-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/outlook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "outlook" + ] + } + } + }, + { + "name": "outlook-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/outlook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "outlook" + ] + } + } + }, + { + "name": "outlook-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/outlook", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "outlook" + ] + } + } + }, + { + "name": "masterCategories-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/outlook/masterCategories", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "outlook", + "masterCategories" + ] + } + } + }, + { + "name": "masterCategories-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/outlook/masterCategories", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "outlook", + "masterCategories" + ] + } + } + }, + { + "name": "{outlookCategory-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/outlook/masterCategories/{outlookCategory-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "outlook", + "masterCategories", + "{outlookCategory-id}" + ] + } + } + }, + { + "name": "{outlookCategory-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/outlook/masterCategories/{outlookCategory-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "outlook", + "masterCategories", + "{outlookCategory-id}" + ] + } + } + }, + { + "name": "{outlookCategory-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/outlook/masterCategories/{outlookCategory-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "outlook", + "masterCategories", + "{outlookCategory-id}" + ] + } + } + }, + { + "name": "ownedDevices-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/ownedDevices", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "ownedDevices" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/ownedDevices/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "ownedDevices", + "$ref" + ] + } + } + }, + { + "name": "$ref-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/ownedDevices/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "ownedDevices", + "$ref" + ] + } + } + }, + { + "name": "ownedObjects-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/ownedObjects", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "ownedObjects" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/ownedObjects/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "ownedObjects", + "$ref" + ] + } + } + }, + { + "name": "$ref-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/ownedObjects/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "ownedObjects", + "$ref" + ] + } + } + }, + { + "name": "people-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/people", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "people" + ] + } + } + }, + { + "name": "people-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/people", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "people" + ] + } + } + }, + { + "name": "{person-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/people/{person-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "people", + "{person-id}" + ] + } + } + }, + { + "name": "{person-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/people/{person-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "people", + "{person-id}" + ] + } + } + }, + { + "name": "{person-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/people/{person-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "people", + "{person-id}" + ] + } + } + }, + { + "name": "photo-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/photo", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "photo" + ] + } + } + }, + { + "name": "photo-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/photo", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "photo" + ] + } + } + }, + { + "name": "photo-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/photo", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "photo" + ] + } + } + }, + { + "name": "$value-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/photo/$value", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "photo", + "$value" + ] + } + } + }, + { + "name": "$value-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/photo/$value", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "photo", + "$value" + ] + } + } + }, + { + "name": "photos-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/photos", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "photos" + ] + } + } + }, + { + "name": "photos-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/photos", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "photos" + ] + } + } + }, + { + "name": "{profilePhoto-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/photos/{profilePhoto-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "photos", + "{profilePhoto-id}" + ] + } + } + }, + { + "name": "{profilePhoto-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/photos/{profilePhoto-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "photos", + "{profilePhoto-id}" + ] + } + } + }, + { + "name": "{profilePhoto-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/photos/{profilePhoto-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "photos", + "{profilePhoto-id}" + ] + } + } + }, + { + "name": "$value-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/photos/{profilePhoto-id}/$value", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "photos", + "{profilePhoto-id}", + "$value" + ] + } + } + }, + { + "name": "$value-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/photos/{profilePhoto-id}/$value", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "photos", + "{profilePhoto-id}", + "$value" + ] + } + } + }, + { + "name": "planner-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner" + ] + } + } + }, + { + "name": "planner-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner" + ] + } + } + }, + { + "name": "planner-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner" + ] + } + } + }, + { + "name": "plans-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans" + ] + } + } + }, + { + "name": "plans-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans" + ] + } + } + }, + { + "name": "{plannerPlan-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}" + ] + } + } + }, + { + "name": "{plannerPlan-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}" + ] + } + } + }, + { + "name": "{plannerPlan-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}" + ] + } + } + }, + { + "name": "buckets-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets" + ] + } + } + }, + { + "name": "buckets-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets" + ] + } + } + }, + { + "name": "{plannerBucket-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}" + ] + } + } + }, + { + "name": "{plannerBucket-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}" + ] + } + } + }, + { + "name": "{plannerBucket-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}" + ] + } + } + }, + { + "name": "tasks-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks" + ] + } + } + }, + { + "name": "tasks-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks" + ] + } + } + }, + { + "name": "{plannerTask-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}" + ] + } + } + }, + { + "name": "{plannerTask-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}" + ] + } + } + }, + { + "name": "{plannerTask-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}" + ] + } + } + }, + { + "name": "assignedToTaskBoardFormat-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/assignedToTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}", + "assignedToTaskBoardFormat" + ] + } + } + }, + { + "name": "assignedToTaskBoardFormat-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/assignedToTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}", + "assignedToTaskBoardFormat" + ] + } + } + }, + { + "name": "assignedToTaskBoardFormat-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/assignedToTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}", + "assignedToTaskBoardFormat" + ] + } + } + }, + { + "name": "bucketTaskBoardFormat-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/bucketTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}", + "bucketTaskBoardFormat" + ] + } + } + }, + { + "name": "bucketTaskBoardFormat-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/bucketTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}", + "bucketTaskBoardFormat" + ] + } + } + }, + { + "name": "bucketTaskBoardFormat-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/bucketTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}", + "bucketTaskBoardFormat" + ] + } + } + }, + { + "name": "details-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/details", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}", + "details" + ] + } + } + }, + { + "name": "details-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/details", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}", + "details" + ] + } + } + }, + { + "name": "details-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/details", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}", + "details" + ] + } + } + }, + { + "name": "progressTaskBoardFormat-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/progressTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}", + "progressTaskBoardFormat" + ] + } + } + }, + { + "name": "progressTaskBoardFormat-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/progressTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}", + "progressTaskBoardFormat" + ] + } + } + }, + { + "name": "progressTaskBoardFormat-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/buckets/{plannerBucket-id}/tasks/{plannerTask-id}/progressTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "buckets", + "{plannerBucket-id}", + "tasks", + "{plannerTask-id}", + "progressTaskBoardFormat" + ] + } + } + }, + { + "name": "details-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/details", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "details" + ] + } + } + }, + { + "name": "details-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/details", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "details" + ] + } + } + }, + { + "name": "details-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/details", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "details" + ] + } + } + }, + { + "name": "tasks-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks" + ] + } + } + }, + { + "name": "tasks-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks" + ] + } + } + }, + { + "name": "{plannerTask-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}" + ] + } + } + }, + { + "name": "{plannerTask-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}" + ] + } + } + }, + { + "name": "{plannerTask-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}" + ] + } + } + }, + { + "name": "assignedToTaskBoardFormat-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/assignedToTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}", + "assignedToTaskBoardFormat" + ] + } + } + }, + { + "name": "assignedToTaskBoardFormat-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/assignedToTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}", + "assignedToTaskBoardFormat" + ] + } + } + }, + { + "name": "assignedToTaskBoardFormat-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/assignedToTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}", + "assignedToTaskBoardFormat" + ] + } + } + }, + { + "name": "bucketTaskBoardFormat-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/bucketTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}", + "bucketTaskBoardFormat" + ] + } + } + }, + { + "name": "bucketTaskBoardFormat-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/bucketTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}", + "bucketTaskBoardFormat" + ] + } + } + }, + { + "name": "bucketTaskBoardFormat-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/bucketTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}", + "bucketTaskBoardFormat" + ] + } + } + }, + { + "name": "details-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/details", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}", + "details" + ] + } + } + }, + { + "name": "details-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/details", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}", + "details" + ] + } + } + }, + { + "name": "details-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/details", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}", + "details" + ] + } + } + }, + { + "name": "progressTaskBoardFormat-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/progressTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}", + "progressTaskBoardFormat" + ] + } + } + }, + { + "name": "progressTaskBoardFormat-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/progressTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}", + "progressTaskBoardFormat" + ] + } + } + }, + { + "name": "progressTaskBoardFormat-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/plans/{plannerPlan-id}/tasks/{plannerTask-id}/progressTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "plans", + "{plannerPlan-id}", + "tasks", + "{plannerTask-id}", + "progressTaskBoardFormat" + ] + } + } + }, + { + "name": "tasks-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks" + ] + } + } + }, + { + "name": "tasks-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks" + ] + } + } + }, + { + "name": "{plannerTask-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}" + ] + } + } + }, + { + "name": "{plannerTask-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}" + ] + } + } + }, + { + "name": "{plannerTask-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}" + ] + } + } + }, + { + "name": "assignedToTaskBoardFormat-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}/assignedToTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}", + "assignedToTaskBoardFormat" + ] + } + } + }, + { + "name": "assignedToTaskBoardFormat-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}/assignedToTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}", + "assignedToTaskBoardFormat" + ] + } + } + }, + { + "name": "assignedToTaskBoardFormat-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}/assignedToTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}", + "assignedToTaskBoardFormat" + ] + } + } + }, + { + "name": "bucketTaskBoardFormat-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}/bucketTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}", + "bucketTaskBoardFormat" + ] + } + } + }, + { + "name": "bucketTaskBoardFormat-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}/bucketTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}", + "bucketTaskBoardFormat" + ] + } + } + }, + { + "name": "bucketTaskBoardFormat-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}/bucketTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}", + "bucketTaskBoardFormat" + ] + } + } + }, + { + "name": "details-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}/details", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}", + "details" + ] + } + } + }, + { + "name": "details-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}/details", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}", + "details" + ] + } + } + }, + { + "name": "details-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}/details", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}", + "details" + ] + } + } + }, + { + "name": "progressTaskBoardFormat-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}/progressTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}", + "progressTaskBoardFormat" + ] + } + } + }, + { + "name": "progressTaskBoardFormat-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}/progressTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}", + "progressTaskBoardFormat" + ] + } + } + }, + { + "name": "progressTaskBoardFormat-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/planner/tasks/{plannerTask-id}/progressTaskBoardFormat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "planner", + "tasks", + "{plannerTask-id}", + "progressTaskBoardFormat" + ] + } + } + }, + { + "name": "presence-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/presence", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "presence" + ] + } + } + }, + { + "name": "presence-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/presence", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "presence" + ] + } + } + }, + { + "name": "presence-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/presence", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "presence" + ] + } + } + }, + { + "name": "registeredDevices-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/registeredDevices", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "registeredDevices" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/registeredDevices/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "registeredDevices", + "$ref" + ] + } + } + }, + { + "name": "$ref-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/registeredDevices/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "registeredDevices", + "$ref" + ] + } + } + }, + { + "name": "scopedRoleMemberOf-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/scopedRoleMemberOf", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "scopedRoleMemberOf" + ] + } + } + }, + { + "name": "scopedRoleMemberOf-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/scopedRoleMemberOf", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "scopedRoleMemberOf" + ] + } + } + }, + { + "name": "{scopedRoleMembership-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/scopedRoleMemberOf/{scopedRoleMembership-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "scopedRoleMemberOf", + "{scopedRoleMembership-id}" + ] + } + } + }, + { + "name": "{scopedRoleMembership-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/scopedRoleMemberOf/{scopedRoleMembership-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "scopedRoleMemberOf", + "{scopedRoleMembership-id}" + ] + } + } + }, + { + "name": "{scopedRoleMembership-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/scopedRoleMemberOf/{scopedRoleMembership-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "scopedRoleMemberOf", + "{scopedRoleMembership-id}" + ] + } + } + }, + { + "name": "settings-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/settings", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "settings" + ] + } + } + }, + { + "name": "settings-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/settings", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "settings" + ] + } + } + }, + { + "name": "settings-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/settings", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "settings" + ] + } + } + }, + { + "name": "shiftPreferences-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/settings/shiftPreferences", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "settings", + "shiftPreferences" + ] + } + } + }, + { + "name": "shiftPreferences-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/settings/shiftPreferences", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "settings", + "shiftPreferences" + ] + } + } + }, + { + "name": "shiftPreferences-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/settings/shiftPreferences", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "settings", + "shiftPreferences" + ] + } + } + }, + { + "name": "teamwork-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/teamwork", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "teamwork" + ] + } + } + }, + { + "name": "teamwork-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/teamwork", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "teamwork" + ] + } + } + }, + { + "name": "teamwork-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/teamwork", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "teamwork" + ] + } + } + }, + { + "name": "installedApps-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/teamwork/installedApps", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "teamwork", + "installedApps" + ] + } + } + }, + { + "name": "installedApps-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/teamwork/installedApps", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "teamwork", + "installedApps" + ] + } + } + }, + { + "name": "{userScopeTeamsAppInstallation-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/teamwork/installedApps/{userScopeTeamsAppInstallation-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "teamwork", + "installedApps", + "{userScopeTeamsAppInstallation-id}" + ] + } + } + }, + { + "name": "{userScopeTeamsAppInstallation-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/teamwork/installedApps/{userScopeTeamsAppInstallation-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "teamwork", + "installedApps", + "{userScopeTeamsAppInstallation-id}" + ] + } + } + }, + { + "name": "{userScopeTeamsAppInstallation-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/teamwork/installedApps/{userScopeTeamsAppInstallation-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "teamwork", + "installedApps", + "{userScopeTeamsAppInstallation-id}" + ] + } + } + }, + { + "name": "chat-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/teamwork/installedApps/{userScopeTeamsAppInstallation-id}/chat", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "teamwork", + "installedApps", + "{userScopeTeamsAppInstallation-id}", + "chat" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/teamwork/installedApps/{userScopeTeamsAppInstallation-id}/chat/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "teamwork", + "installedApps", + "{userScopeTeamsAppInstallation-id}", + "chat", + "$ref" + ] + } + } + }, + { + "name": "$ref-PUT", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/teamwork/installedApps/{userScopeTeamsAppInstallation-id}/chat/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "teamwork", + "installedApps", + "{userScopeTeamsAppInstallation-id}", + "chat", + "$ref" + ] + } + } + }, + { + "name": "$ref-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/teamwork/installedApps/{userScopeTeamsAppInstallation-id}/chat/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "teamwork", + "installedApps", + "{userScopeTeamsAppInstallation-id}", + "chat", + "$ref" + ] + } + } + }, + { + "name": "todo-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo" + ] + } + } + }, + { + "name": "todo-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo" + ] + } + } + }, + { + "name": "todo-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo" + ] + } + } + }, + { + "name": "lists-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists" + ] + } + } + }, + { + "name": "lists-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists" + ] + } + } + }, + { + "name": "{todoTaskList-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}" + ] + } + } + }, + { + "name": "{todoTaskList-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}" + ] + } + } + }, + { + "name": "{todoTaskList-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}" + ] + } + } + }, + { + "name": "extensions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "extensions" + ] + } + } + }, + { + "name": "extensions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "extensions" + ] + } + } + }, + { + "name": "tasks-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks" + ] + } + } + }, + { + "name": "tasks-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks" + ] + } + } + }, + { + "name": "{todoTask-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks", + "{todoTask-id}" + ] + } + } + }, + { + "name": "{todoTask-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks", + "{todoTask-id}" + ] + } + } + }, + { + "name": "{todoTask-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks", + "{todoTask-id}" + ] + } + } + }, + { + "name": "extensions-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks", + "{todoTask-id}", + "extensions" + ] + } + } + }, + { + "name": "extensions-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}/extensions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks", + "{todoTask-id}", + "extensions" + ] + } + } + }, + { + "name": "{extension-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks", + "{todoTask-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "{extension-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks", + "{todoTask-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "{extension-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}/extensions/{extension-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks", + "{todoTask-id}", + "extensions", + "{extension-id}" + ] + } + } + }, + { + "name": "linkedResources-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}/linkedResources", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks", + "{todoTask-id}", + "linkedResources" + ] + } + } + }, + { + "name": "linkedResources-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}/linkedResources", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks", + "{todoTask-id}", + "linkedResources" + ] + } + } + }, + { + "name": "{linkedResource-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}/linkedResources/{linkedResource-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks", + "{todoTask-id}", + "linkedResources", + "{linkedResource-id}" + ] + } + } + }, + { + "name": "{linkedResource-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}/linkedResources/{linkedResource-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks", + "{todoTask-id}", + "linkedResources", + "{linkedResource-id}" + ] + } + } + }, + { + "name": "{linkedResource-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}/linkedResources/{linkedResource-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "todo", + "lists", + "{todoTaskList-id}", + "tasks", + "{todoTask-id}", + "linkedResources", + "{linkedResource-id}" + ] + } + } + }, + { + "name": "transitiveMemberOf-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/transitiveMemberOf", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "transitiveMemberOf" + ] + } + } + }, + { + "name": "$ref-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/transitiveMemberOf/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "transitiveMemberOf", + "$ref" + ] + } + } + }, + { + "name": "$ref-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}/transitiveMemberOf/$ref", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}", + "transitiveMemberOf", + "$ref" + ] + } + } + } + ] +} \ No newline at end of file From 639466c2bb379cb26f993f395bca91342553f608 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 15 Dec 2021 00:49:08 +0300 Subject: [PATCH 044/752] Add server object --- .../UtilityFiles/OpenApiDocumentMock.cs | 737 ++++++++++++++++++ 1 file changed, 737 insertions(+) create mode 100644 test/Microsoft.OpenApi.Tests/UtilityFiles/OpenApiDocumentMock.cs diff --git a/test/Microsoft.OpenApi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Tests/UtilityFiles/OpenApiDocumentMock.cs new file mode 100644 index 000000000..d21fccb9a --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -0,0 +1,737 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System.Collections.Generic; +using System.Security.Policy; +using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Interfaces; +using Microsoft.OpenApi.Models; + +namespace Microsoft.OpenApi.Tests.UtilityFiles +{ + /// + /// Mock class that creates a sample OpenAPI document. + /// + public static class OpenApiDocumentMock + { + /// + /// Creates an OpenAPI document. + /// + /// Instance of an OpenApi document + public static OpenApiDocument CreateOpenApiDocument() + { + var applicationJsonMediaType = "application/json"; + + var document = new OpenApiDocument() + { + Info = new OpenApiInfo() + { + Title = "People", + Version = "v1.0" + }, + Servers = new List + { + new OpenApiServer + { + Url = "https://graph.microsoft.com/v1.0" + } + }, + Paths = new OpenApiPaths() + { + ["/"] = new OpenApiPathItem() // root path + { + Operations = new Dictionary + { + { + OperationType.Get, new OpenApiOperation + { + OperationId = "graphService.GetGraphService", + Responses = new OpenApiResponses() + { + { + "200",new OpenApiResponse() + { + Description = "OK" + } + } + } + } + } + } + }, + ["/reports/microsoft.graph.getTeamsUserActivityCounts(period={period})"] = new OpenApiPathItem() + { + Operations = new Dictionary + { + { + OperationType.Get, new OpenApiOperation + { + Tags = new List + { + { + new OpenApiTag() + { + Name = "reports.Functions" + } + } + }, + OperationId = "reports.getTeamsUserActivityCounts", + Summary = "Invoke function getTeamsUserActivityUserCounts", + Parameters = new List + { + { + new OpenApiParameter() + { + Name = "period", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema() + { + Type = "string" + } + } + } + }, + Responses = new OpenApiResponses() + { + { + "200", new OpenApiResponse() + { + Description = "Success", + Content = new Dictionary + { + { + applicationJsonMediaType, + new OpenApiMediaType + { + Schema = new OpenApiSchema + { + Type = "array" + } + } + } + } + } + } + } + } + } + } + }, + ["/reports/microsoft.graph.getTeamsUserActivityUserDetail(date={date})"] = new OpenApiPathItem() + { + Operations = new Dictionary + { + { + OperationType.Get, new OpenApiOperation + { + Tags = new List + { + { + new OpenApiTag() + { + Name = "reports.Functions" + } + } + }, + OperationId = "reports.getTeamsUserActivityUserDetail-a3f1", + Summary = "Invoke function getTeamsUserActivityUserDetail", + Parameters = new List + { + { + new OpenApiParameter() + { + Name = "period", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema() + { + Type = "string" + } + } + } + }, + Responses = new OpenApiResponses() + { + { + "200", new OpenApiResponse() + { + Description = "Success", + Content = new Dictionary + { + { + applicationJsonMediaType, + new OpenApiMediaType + { + Schema = new OpenApiSchema + { + Type = "array" + } + } + } + } + } + } + } + } + } + } + }, + ["/users"] = new OpenApiPathItem() + { + Operations = new Dictionary + { + { + OperationType.Get, new OpenApiOperation + { + Tags = new List + { + { + new OpenApiTag() + { + Name = "users.user" + } + } + }, + OperationId = "users.user.ListUser", + Summary = "Get entities from users", + Responses = new OpenApiResponses() + { + { + "200", new OpenApiResponse() + { + Description = "Retrieved entities", + Content = new Dictionary + { + { + applicationJsonMediaType, + new OpenApiMediaType + { + Schema = new OpenApiSchema + { + Title = "Collection of user", + Type = "object", + Properties = new Dictionary + { + { + "value", + new OpenApiSchema + { + Type = "array", + Items = new OpenApiSchema + { + Reference = new OpenApiReference + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.user" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + ["/users/{user-id}"] = new OpenApiPathItem() + { + Operations = new Dictionary + { + { + OperationType.Get, new OpenApiOperation + { + Tags = new List + { + { + new OpenApiTag() + { + Name = "users.user" + } + } + }, + OperationId = "users.user.GetUser", + Summary = "Get entity from users by key", + Responses = new OpenApiResponses() + { + { + "200", new OpenApiResponse() + { + Description = "Retrieved entity", + Content = new Dictionary + { + { + applicationJsonMediaType, + new OpenApiMediaType + { + Schema = new OpenApiSchema + { + Reference = new OpenApiReference + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.user" + } + } + } + } + } + } + } + } + } + }, + { + OperationType.Patch, new OpenApiOperation + { + Tags = new List + { + { + new OpenApiTag() + { + Name = "users.user" + } + } + }, + OperationId = "users.user.UpdateUser", + Summary = "Update entity in users", + Responses = new OpenApiResponses() + { + { + "204", new OpenApiResponse() + { + Description = "Success" + } + } + } + } + } + } + }, + ["/users/{user-id}/messages/{message-id}"] = new OpenApiPathItem() + { + Operations = new Dictionary + { + { + OperationType.Get, new OpenApiOperation + { + Tags = new List + { + { + new OpenApiTag() + { + Name = "users.message" + } + } + }, + OperationId = "users.GetMessages", + Summary = "Get messages from users", + Description = "The messages in a mailbox or folder. Read-only. Nullable.", + Parameters = new List + { + new OpenApiParameter() + { + Name = "$select", + In = ParameterLocation.Query, + Required = true, + Description = "Select properties to be returned", + Schema = new OpenApiSchema() + { + Type = "array" + } + // missing explode parameter + } + }, + Responses = new OpenApiResponses() + { + { + "200", new OpenApiResponse() + { + Description = "Retrieved navigation property", + Content = new Dictionary + { + { + applicationJsonMediaType, + new OpenApiMediaType + { + Schema = new OpenApiSchema + { + Reference = new OpenApiReference + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.message" + } + } + } + } + } + } + } + } + } + } + } + }, + ["/administrativeUnits/{administrativeUnit-id}/microsoft.graph.restore"] = new OpenApiPathItem() + { + Operations = new Dictionary + { + { + OperationType.Post, new OpenApiOperation + { + Tags = new List + { + { + new OpenApiTag() + { + Name = "administrativeUnits.Actions" + } + } + }, + OperationId = "administrativeUnits.restore", + Summary = "Invoke action restore", + Parameters = new List + { + { + new OpenApiParameter() + { + Name = "administrativeUnit-id", + In = ParameterLocation.Path, + Required = true, + Description = "key: id of administrativeUnit", + Schema = new OpenApiSchema() + { + Type = "string" + } + } + } + }, + Responses = new OpenApiResponses() + { + { + "200", new OpenApiResponse() + { + Description = "Success", + Content = new Dictionary + { + { + applicationJsonMediaType, + new OpenApiMediaType + { + Schema = new OpenApiSchema + { + AnyOf = new List + { + new OpenApiSchema + { + Type = "string" + } + }, + Nullable = true + } + } + } + } + } + } + } + } + } + } + }, + ["/applications/{application-id}/logo"] = new OpenApiPathItem() + { + Operations = new Dictionary + { + { + OperationType.Put, new OpenApiOperation + { + Tags = new List + { + { + new OpenApiTag() + { + Name = "applications.application" + } + } + }, + OperationId = "applications.application.UpdateLogo", + Summary = "Update media content for application in applications", + Responses = new OpenApiResponses() + { + { + "204", new OpenApiResponse() + { + Description = "Success" + } + } + } + } + } + } + }, + ["/security/hostSecurityProfiles"] = new OpenApiPathItem() + { + Operations = new Dictionary + { + { + OperationType.Get, new OpenApiOperation + { + Tags = new List + { + { + new OpenApiTag() + { + Name = "security.hostSecurityProfile" + } + } + }, + OperationId = "security.ListHostSecurityProfiles", + Summary = "Get hostSecurityProfiles from security", + Responses = new OpenApiResponses() + { + { + "200", new OpenApiResponse() + { + Description = "Retrieved navigation property", + Content = new Dictionary + { + { + applicationJsonMediaType, + new OpenApiMediaType + { + Schema = new OpenApiSchema + { + Title = "Collection of hostSecurityProfile", + Type = "object", + Properties = new Dictionary + { + { + "value", + new OpenApiSchema + { + Type = "array", + Items = new OpenApiSchema + { + Reference = new OpenApiReference + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.networkInterface" + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + ["/communications/calls/{call-id}/microsoft.graph.keepAlive"] = new OpenApiPathItem() + { + Operations = new Dictionary + { + { + OperationType.Post, new OpenApiOperation + { + Tags = new List + { + { + new OpenApiTag() + { + Name = "communications.Actions" + } + } + }, + OperationId = "communications.calls.call.keepAlive", + Summary = "Invoke action keepAlive", + Parameters = new List + { + new OpenApiParameter() + { + Name = "call-id", + In = ParameterLocation.Path, + Description = "key: id of call", + Required = true, + Schema = new OpenApiSchema() + { + Type = "string" + }, + Extensions = new Dictionary + { + { + "x-ms-docs-key-type", new OpenApiString("call") + } + } + } + }, + Responses = new OpenApiResponses() + { + { + "204", new OpenApiResponse() + { + Description = "Success" + } + } + }, + Extensions = new Dictionary + { + { + "x-ms-docs-operation-type", new OpenApiString("action") + } + } + } + } + } + }, + ["/groups/{group-id}/events/{event-id}/calendar/events/microsoft.graph.delta"] = new OpenApiPathItem() + { + Operations = new Dictionary + { + { + OperationType.Get, new OpenApiOperation + { + Tags = new List + { + new OpenApiTag() + { + Name = "groups.Functions" + } + }, + OperationId = "groups.group.events.event.calendar.events.delta", + Summary = "Invoke function delta", + Parameters = new List + { + new OpenApiParameter() + { + Name = "group-id", + In = ParameterLocation.Path, + Description = "key: id of group", + Required = true, + Schema = new OpenApiSchema() + { + Type = "string" + }, + Extensions = new Dictionary + { + { + "x-ms-docs-key-type", new OpenApiString("group") + } + } + }, + new OpenApiParameter() + { + Name = "event-id", + In = ParameterLocation.Path, + Description = "key: id of event", + Required = true, + Schema = new OpenApiSchema() + { + Type = "string" + }, + Extensions = new Dictionary + { + { + "x-ms-docs-key-type", new OpenApiString("event") + } + } + } + }, + Responses = new OpenApiResponses() + { + { + "200", new OpenApiResponse() + { + Description = "Success", + Content = new Dictionary + { + { + applicationJsonMediaType, + new OpenApiMediaType + { + Schema = new OpenApiSchema + { + Type = "array", + Reference = new OpenApiReference + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.event" + } + } + } + } + } + } + } + }, + Extensions = new Dictionary + { + { + "x-ms-docs-operation-type", new OpenApiString("function") + } + } + } + } + } + }, + ["/applications/{application-id}/createdOnBehalfOf/$ref"] = new OpenApiPathItem() + { + Operations = new Dictionary + { + { + OperationType.Get, new OpenApiOperation + { + Tags = new List + { + new OpenApiTag() + { + Name = "applications.directoryObject" + } + }, + OperationId = "applications.GetRefCreatedOnBehalfOf", + Summary = "Get ref of createdOnBehalfOf from applications" + } + } + } + } + }, + Components = new OpenApiComponents + { + Schemas = new Dictionary + { + { + "microsoft.graph.networkInterface", new OpenApiSchema + { + Title = "networkInterface", + Type = "object", + Properties = new Dictionary + { + { + "description", new OpenApiSchema + { + Type = "string", + Description = "Description of the NIC (e.g. Ethernet adapter, Wireless LAN adapter Local Area Connection <#>, etc.).", + Nullable = true + } + } + } + } + } + } + } + }; + return document; + } + } +} From 78f56fe3e181f45b90f4041bbe356a2d46860f9e Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 15 Dec 2021 00:50:16 +0300 Subject: [PATCH 045/752] Add unit tests for slicing based on postman collection --- .../Services/OpenApiFilterServiceTests.cs | 41 ++++++++++++++++++- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs index ab65ed744..4d6a25964 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs @@ -2,9 +2,10 @@ // Licensed under the MIT license. using System; +using System.IO; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; -using OpenAPIService.Test; +using Microsoft.OpenApi.Tests.UtilityFiles; using Xunit; namespace Microsoft.OpenApi.Tests.Services @@ -42,12 +43,48 @@ public void ReturnFilteredOpenApiDocumentBasedOnOperationIdsAndTags(string opera Assert.Equal(expectedPathCount, subsetOpenApiDocument.Paths.Count); } + [Fact] + public void ReturnFilteredOpenApiDocumentBasedOnPostmanCollection() + { + // Arrange + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver2.json"); + var fileInput = new FileInfo(filePath); + var stream = fileInput.OpenRead(); + + // Act + var requestUrls = OpenApiFilterService.ParseJsonCollectionFile(stream); + var predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: _openApiDocumentMock); + var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(_openApiDocumentMock, predicate); + + // Assert + Assert.NotNull(subsetOpenApiDocument); + Assert.NotEmpty(subsetOpenApiDocument.Paths); + Assert.Equal(3, subsetOpenApiDocument.Paths.Count); + } + + [Fact] + public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument() + { + // Arrange + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver1.json"); + var fileInput = new FileInfo(filePath); + var stream = fileInput.OpenRead(); + + // Act + var requestUrls = OpenApiFilterService.ParseJsonCollectionFile(stream); + + // Assert + var message = Assert.Throws(() => + OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: _openApiDocumentMock)).Message; + Assert.Equal("The urls in the postman collection supplied could not be found.", message); + } + [Fact] public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidArgumentsArePassed() { // Act and Assert var message1 = Assert.Throws(() => OpenApiFilterService.CreatePredicate(null, null)).Message; - Assert.Equal("Either operationId(s) or tag(s) need to be specified.", message1); + Assert.Equal("Either operationId(s),tag(s) or postman collection need to be specified.", message1); var message2 = Assert.Throws(() => OpenApiFilterService.CreatePredicate("users.user.ListUser", "users.user")).Message; Assert.Equal("Cannot specify both operationIds and tags at the same time.", message2); From a09bf2d3fd238e32bdb9c2561ca970414cc1d0f2 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 11 Jan 2022 16:44:28 +0300 Subject: [PATCH 046/752] Move the json document parsing logic to OpenApiService --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 36 +++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 49636d80b..c60d1acc2 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -2,11 +2,13 @@ // Licensed under the MIT license. using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Net.Http; using System.Text; +using System.Text.Json; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Readers; @@ -72,7 +74,7 @@ public static void ProcessOpenApiDocument( if (!string.IsNullOrEmpty(filterByCollection)) { var fileStream = GetStream(filterByCollection); - var requestUrls = OpenApiFilterService.ParseJsonCollectionFile(fileStream); + var requestUrls = ParseJsonCollectionFile(fileStream); predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source:document); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } @@ -133,6 +135,38 @@ private static Stream GetStream(string input) return stream; } + /// + /// Takes in a file stream, parses the stream into a JsonDocument and gets a list of paths and Http methods + /// + /// A file stream. + /// A dictionary of request urls and http methods from a collection. + private static Dictionary> ParseJsonCollectionFile(Stream stream) + { + var requestUrls = new Dictionary>(); + + // Convert file to JsonDocument + using var document = JsonDocument.Parse(stream); + var root = document.RootElement; + var itemElement = root.GetProperty("item"); + foreach (var requestObject in itemElement.EnumerateArray().Select(item => item.GetProperty("request"))) + { + // Fetch list of methods and urls from collection, store them in a dictionary + var path = requestObject.GetProperty("url").GetProperty("raw").ToString(); + var method = requestObject.GetProperty("method").ToString(); + + if (!requestUrls.ContainsKey(path)) + { + requestUrls.Add(path, new List { method }); + } + else + { + requestUrls[path].Add(method); + } + } + + return requestUrls; + } + internal static void ValidateOpenApiDocument(string input) { if (input == null) From 728a36f18b47e221029973893a20de004459b680 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Fri, 14 Jan 2022 09:20:11 +0300 Subject: [PATCH 047/752] Add public class access modifier --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index c60d1acc2..8cf5bb60e 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -18,7 +18,7 @@ namespace Microsoft.OpenApi.Hidi { - static class OpenApiService + public static class OpenApiService { public static void ProcessOpenApiDocument( string input, @@ -140,7 +140,7 @@ private static Stream GetStream(string input) /// /// A file stream. /// A dictionary of request urls and http methods from a collection. - private static Dictionary> ParseJsonCollectionFile(Stream stream) + public static Dictionary> ParseJsonCollectionFile(Stream stream) { var requestUrls = new Dictionary>(); From c11eae50dc40e7d6befc1b75a48c3e9b2e2b685b Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Fri, 14 Jan 2022 09:22:27 +0300 Subject: [PATCH 048/752] Refactor tests --- .../Services/OpenApiFilterServiceTests.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs index 4d6a25964..f470b8577 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs @@ -3,6 +3,7 @@ using System; using System.IO; +using Microsoft.OpenApi.Hidi; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Tests.UtilityFiles; @@ -52,7 +53,7 @@ public void ReturnFilteredOpenApiDocumentBasedOnPostmanCollection() var stream = fileInput.OpenRead(); // Act - var requestUrls = OpenApiFilterService.ParseJsonCollectionFile(stream); + var requestUrls = OpenApiService.ParseJsonCollectionFile(stream); var predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: _openApiDocumentMock); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(_openApiDocumentMock, predicate); @@ -71,12 +72,12 @@ public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument() var stream = fileInput.OpenRead(); // Act - var requestUrls = OpenApiFilterService.ParseJsonCollectionFile(stream); + var requestUrls = OpenApiService.ParseJsonCollectionFile(stream); // Assert var message = Assert.Throws(() => OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: _openApiDocumentMock)).Message; - Assert.Equal("The urls in the postman collection supplied could not be found.", message); + Assert.Equal("The urls in the Postman collection supplied could not be found.", message); } [Fact] @@ -84,7 +85,7 @@ public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidArguments { // Act and Assert var message1 = Assert.Throws(() => OpenApiFilterService.CreatePredicate(null, null)).Message; - Assert.Equal("Either operationId(s),tag(s) or postman collection need to be specified.", message1); + Assert.Equal("Either operationId(s),tag(s) or Postman collection need to be specified.", message1); var message2 = Assert.Throws(() => OpenApiFilterService.CreatePredicate("users.user.ListUser", "users.user")).Message; Assert.Equal("Cannot specify both operationIds and tags at the same time.", message2); From 85140ec1d4037a8694e1eb76d07f54fb5199af25 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 19 Jan 2022 07:11:00 +0300 Subject: [PATCH 049/752] Update input parameter description --- src/Microsoft.OpenApi.Hidi/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 533878a0d..812b7d58b 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -23,7 +23,7 @@ static async Task Main(string[] args) var transformCommand = new Command("transform") { - new Option("--input", "Input OpenAPI description file path or URL", typeof(string) ), + new Option("--input", "Input OpenAPI description, JSON or CSDL file path or URL", typeof(string) ), new Option("--output","Output OpenAPI description file", typeof(FileInfo), arity: ArgumentArity.ZeroOrOne), new Option("--version", "OpenAPI specification version", typeof(OpenApiSpecVersion)), new Option("--format", "File format",typeof(OpenApiFormat) ), From ada75325d7f2191b98c8c6dbf3ab4113c17339de Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 19 Jan 2022 07:12:54 +0300 Subject: [PATCH 050/752] Add OData conversion libraries --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b13c9dc18..ea9ee08d1 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -10,6 +10,8 @@ + + From ba7af9330844c2ec6893321d387030004b5a0cc3 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 19 Jan 2022 07:13:06 +0300 Subject: [PATCH 051/752] Add necessary usings --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 486666568..5e02e8fc4 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -7,8 +7,12 @@ using System.Net; using System.Net.Http; using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; +using Microsoft.OData.Edm.Csdl; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.OData; using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Validations; From c66ebe04a21c56252ad6a16a0346314041f4b545 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 19 Jan 2022 07:13:58 +0300 Subject: [PATCH 052/752] Add method for CSDL to OpenAPI conversion --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 43 ++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 5e02e8fc4..e4b7c90cc 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -106,6 +106,49 @@ public static void ProcessOpenApiDocument( textWriter.Flush(); } + /// + /// Converts CSDL to OpenAPI + /// + /// The CSDL stream. + /// An OpenAPI document. + public static OpenApiDocument ConvertCsdlToOpenApi(Stream csdl) + { + using var reader = new StreamReader(csdl); + var csdlText = reader.ReadToEndAsync().GetAwaiter().GetResult(); + var edmModel = CsdlReader.Parse(XElement.Parse(csdlText).CreateReader()); + + var settings = new OpenApiConvertSettings() + { + EnableKeyAsSegment = true, + EnableOperationId = true, + PrefixEntityTypeNameBeforeKey = true, + TagDepth = 2, + EnablePagination = true, + EnableDiscriminatorValue = false, + EnableDerivedTypesReferencesForRequestBody = false, + EnableDerivedTypesReferencesForResponses = false, + ShowRootPath = true, + ShowLinks = true + }; + OpenApiDocument document = edmModel.ConvertToOpenApi(settings); + + document = FixReferences(document); + + return document; + } + + public static OpenApiDocument FixReferences(OpenApiDocument document) + { + // This method is only needed because the output of ConvertToOpenApi isn't quite a valid OpenApiDocument instance. + // So we write it out, and read it back in again to fix it up. + + var sb = new StringBuilder(); + document.SerializeAsV3(new OpenApiYamlWriter(new StringWriter(sb))); + var doc = new OpenApiStringReader().Read(sb.ToString(), out _); + + return doc; + } + private static Stream GetStream(string input) { Stream stream; From c624a84a74f2c99a4613609991aca8fbd2b01274 Mon Sep 17 00:00:00 2001 From: Daniel Mbaluka Date: Mon, 6 Dec 2021 12:36:15 +0300 Subject: [PATCH 053/752] Use input file OpenApi format as the default output format --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 23 ++++++++++++++++---- src/Microsoft.OpenApi.Hidi/Program.cs | 2 +- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 8cf5bb60e..b426b1ae1 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -23,8 +23,8 @@ public static class OpenApiService public static void ProcessOpenApiDocument( string input, FileInfo output, - OpenApiSpecVersion version, - OpenApiFormat format, + OpenApiSpecVersion? version, + OpenApiFormat? format, string filterByOperationIds, string filterByTags, string filterByCollection, @@ -101,13 +101,16 @@ public static void ProcessOpenApiDocument( { ReferenceInline = inline ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences }; - IOpenApiWriter writer = format switch + + var openApiFormat = format ?? GetOpenApiFormat(input); + var openApiVersion = version ?? result.OpenApiDiagnostic.SpecificationVersion; + IOpenApiWriter writer = openApiFormat switch { OpenApiFormat.Json => new OpenApiJsonWriter(textWriter, settings), OpenApiFormat.Yaml => new OpenApiYamlWriter(textWriter, settings), _ => throw new ArgumentException("Unknown format"), }; - document.Serialize(writer, version); + document.Serialize(writer, openApiVersion); textWriter.Flush(); } @@ -198,5 +201,17 @@ internal static void ValidateOpenApiDocument(string input) Console.WriteLine(statsVisitor.GetStatisticsReport()); } + + private static OpenApiFormat GetOpenApiFormat(string input) + { + if (!input.StartsWith("http") && Path.GetExtension(input) == ".json") + { + return OpenApiFormat.Json; + } + else + { + return OpenApiFormat.Yaml; + } + } } } diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 099eb70df..b3752ef97 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -33,7 +33,7 @@ static async Task Main(string[] args) new Option("--filterByTags", "Filters OpenApiDocument by Tag(s) provided", typeof(string)), new Option("--filterByCollection", "Filters OpenApiDocument by Postman collection provided", typeof(string)) }; - transformCommand.Handler = CommandHandler.Create( + transformCommand.Handler = CommandHandler.Create( OpenApiService.ProcessOpenApiDocument); rootCommand.Add(transformCommand); From bce26cddc5d67fc88e6a4a600e7b45c856c8cd13 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 20 Jan 2022 18:45:57 +0300 Subject: [PATCH 054/752] Check input file for .xml extension --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index e4b7c90cc..bb66f4158 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -46,6 +46,13 @@ public static void ProcessOpenApiDocument( } var stream = GetStream(input); + OpenApiDocument document; + + if (input.Contains("xml")) + { + document = ConvertCsdlToOpenApi(stream); + } + var result = new OpenApiStreamReader(new OpenApiReaderSettings { ReferenceResolution = resolveExternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, @@ -53,9 +60,8 @@ public static void ProcessOpenApiDocument( } ).ReadAsync(stream).GetAwaiter().GetResult(); - OpenApiDocument document; document = result.OpenApiDocument; - + // Check if filter options are provided, then execute if (!string.IsNullOrEmpty(filterByOperationIds) && !string.IsNullOrEmpty(filterByTags)) { From 6f864db56b5696c85f270db929718db7aca7cb60 Mon Sep 17 00:00:00 2001 From: Daniel Mbaluka Date: Sat, 22 Jan 2022 04:52:15 +0300 Subject: [PATCH 055/752] replace verbose if statement with ternary operator --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index b426b1ae1..abef3617f 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -204,14 +204,7 @@ internal static void ValidateOpenApiDocument(string input) private static OpenApiFormat GetOpenApiFormat(string input) { - if (!input.StartsWith("http") && Path.GetExtension(input) == ".json") - { - return OpenApiFormat.Json; - } - else - { - return OpenApiFormat.Yaml; - } + return !input.StartsWith("http") && Path.GetExtension(input) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml; } } } From 170a9f28e9d3091ab9a114bfe3510e3ac2077ca2 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sat, 22 Jan 2022 21:30:18 -0500 Subject: [PATCH 056/752] Updated version to release new preview --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b13c9dc18..4db249c8f 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -6,7 +6,7 @@ true hidi ./../../artifacts - 0.5.0-preview + 0.5.0-preview2 From dc6eec792af3c2fbd0f3da83fc37741bd4503f80 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 24 Jan 2022 09:38:53 +0300 Subject: [PATCH 057/752] Align the input and output params with kiota --- src/Microsoft.OpenApi.Hidi/Program.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index b3752ef97..ed4daa4e7 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -21,10 +21,16 @@ static async Task Main(string[] args) }; validateCommand.Handler = CommandHandler.Create(OpenApiService.ValidateOpenApiDocument); + var descriptionOption = new Option("--openapi", "Input OpenAPI description file path or URL", typeof(string)); + descriptionOption.AddAlias("-d"); + + var outputOption = new Option("--output", "The output directory path for the generated file.", typeof(FileInfo), () => "./output", arity: ArgumentArity.ZeroOrOne); + outputOption.AddAlias("o"); + var transformCommand = new Command("transform") { - new Option("--input", "Input OpenAPI description file path or URL", typeof(string) ), - new Option("--output","Output OpenAPI description file", typeof(FileInfo), arity: ArgumentArity.ZeroOrOne), + descriptionOption, + outputOption, new Option("--version", "OpenAPI specification version", typeof(OpenApiSpecVersion)), new Option("--format", "File format",typeof(OpenApiFormat) ), new Option("--inline", "Inline $ref instances", typeof(bool) ), From 6627403bdc3bdc06ee6f341c7f40ff3d9270825c Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 24 Jan 2022 10:02:09 +0300 Subject: [PATCH 058/752] Add aliases --- src/Microsoft.OpenApi.Hidi/Program.cs | 38 +++++++++++++++++++++------ 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index ed4daa4e7..35a8cda22 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -21,23 +21,45 @@ static async Task Main(string[] args) }; validateCommand.Handler = CommandHandler.Create(OpenApiService.ValidateOpenApiDocument); + // transform command options var descriptionOption = new Option("--openapi", "Input OpenAPI description file path or URL", typeof(string)); descriptionOption.AddAlias("-d"); var outputOption = new Option("--output", "The output directory path for the generated file.", typeof(FileInfo), () => "./output", arity: ArgumentArity.ZeroOrOne); - outputOption.AddAlias("o"); + outputOption.AddAlias("-o"); + + var versionOption = new Option("--version", "OpenAPI specification version", typeof(OpenApiSpecVersion)); + versionOption.AddAlias("-v"); + + var formatOption = new Option("--format", "File format", typeof(OpenApiFormat)); + formatOption.AddAlias("-f"); +; + var inlineOption = new Option("--inline", "Inline $ref instances", typeof(bool)); + inlineOption.AddAlias("-i"); +; + var resolveExternalOption = new Option("--resolveExternal", "Resolve external $refs", typeof(bool)); + resolveExternalOption.AddAlias("-ex"); +; + var filterByOperationIdsOption = new Option("--filterByOperationIds", "Filters OpenApiDocument by OperationId(s) provided", typeof(string)); + filterByOperationIdsOption.AddAlias("-op"); +; + var filterByTagsOption = new Option("--filterByTags", "Filters OpenApiDocument by Tag(s) provided", typeof(string)); + filterByTagsOption.AddAlias("-t"); +; + var filterByCollectionOption = new Option("--filterByCollection", "Filters OpenApiDocument by Postman collection provided", typeof(string)); + filterByCollectionOption.AddAlias("-c"); var transformCommand = new Command("transform") { descriptionOption, outputOption, - new Option("--version", "OpenAPI specification version", typeof(OpenApiSpecVersion)), - new Option("--format", "File format",typeof(OpenApiFormat) ), - new Option("--inline", "Inline $ref instances", typeof(bool) ), - new Option("--resolveExternal","Resolve external $refs", typeof(bool)), - new Option("--filterByOperationIds", "Filters OpenApiDocument by OperationId(s) provided", typeof(string)), - new Option("--filterByTags", "Filters OpenApiDocument by Tag(s) provided", typeof(string)), - new Option("--filterByCollection", "Filters OpenApiDocument by Postman collection provided", typeof(string)) + versionOption, + formatOption, + inlineOption, + resolveExternalOption, + filterByOperationIdsOption, + filterByTagsOption, + filterByCollectionOption }; transformCommand.Handler = CommandHandler.Create( OpenApiService.ProcessOpenApiDocument); From d0b8eb50f77a62b2f80da140bb01a5fa272aa7c2 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 24 Jan 2022 10:41:57 +0300 Subject: [PATCH 059/752] Update the input command option for validate --- src/Microsoft.OpenApi.Hidi/Program.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 35a8cda22..c4e27e29b 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -14,14 +14,8 @@ static async Task Main(string[] args) { var rootCommand = new RootCommand() { }; - - var validateCommand = new Command("validate") - { - new Option("--input", "Input OpenAPI description file path or URL", typeof(string) ) - }; - validateCommand.Handler = CommandHandler.Create(OpenApiService.ValidateOpenApiDocument); - - // transform command options + + // command option parameters and aliases var descriptionOption = new Option("--openapi", "Input OpenAPI description file path or URL", typeof(string)); descriptionOption.AddAlias("-d"); @@ -49,6 +43,12 @@ static async Task Main(string[] args) var filterByCollectionOption = new Option("--filterByCollection", "Filters OpenApiDocument by Postman collection provided", typeof(string)); filterByCollectionOption.AddAlias("-c"); + var validateCommand = new Command("validate") + { + descriptionOption + }; + validateCommand.Handler = CommandHandler.Create(OpenApiService.ValidateOpenApiDocument); + var transformCommand = new Command("transform") { descriptionOption, From d06afdd737add8402436fd4fd3c5c60af60203b1 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 24 Jan 2022 10:53:27 +0300 Subject: [PATCH 060/752] Clean up code --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index abef3617f..3ce75ee17 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -21,7 +21,7 @@ namespace Microsoft.OpenApi.Hidi public static class OpenApiService { public static void ProcessOpenApiDocument( - string input, + string openapi, FileInfo output, OpenApiSpecVersion? version, OpenApiFormat? format, @@ -31,9 +31,9 @@ public static void ProcessOpenApiDocument( bool inline, bool resolveExternal) { - if (string.IsNullOrEmpty(input)) + if (string.IsNullOrEmpty(openapi)) { - throw new ArgumentNullException(nameof(input)); + throw new ArgumentNullException(nameof(openapi)); } if(output == null) { @@ -44,7 +44,7 @@ public static void ProcessOpenApiDocument( throw new IOException("The file you're writing to already exists. Please input a new output path."); } - var stream = GetStream(input); + var stream = GetStream(openapi); var result = new OpenApiStreamReader(new OpenApiReaderSettings { ReferenceResolution = resolveExternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, @@ -102,7 +102,7 @@ public static void ProcessOpenApiDocument( ReferenceInline = inline ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences }; - var openApiFormat = format ?? GetOpenApiFormat(input); + var openApiFormat = format ?? GetOpenApiFormat(openapi); var openApiVersion = version ?? result.OpenApiDiagnostic.SpecificationVersion; IOpenApiWriter writer = openApiFormat switch { @@ -115,10 +115,10 @@ public static void ProcessOpenApiDocument( textWriter.Flush(); } - private static Stream GetStream(string input) + private static Stream GetStream(string openapi) { Stream stream; - if (input.StartsWith("http")) + if (openapi.StartsWith("http")) { var httpClient = new HttpClient(new HttpClientHandler() { @@ -127,11 +127,11 @@ private static Stream GetStream(string input) { DefaultRequestVersion = HttpVersion.Version20 }; - stream = httpClient.GetStreamAsync(input).Result; + stream = httpClient.GetStreamAsync(openapi).Result; } else { - var fileInput = new FileInfo(input); + var fileInput = new FileInfo(openapi); stream = fileInput.OpenRead(); } @@ -170,14 +170,14 @@ public static Dictionary> ParseJsonCollectionFile(Stream st return requestUrls; } - internal static void ValidateOpenApiDocument(string input) + internal static void ValidateOpenApiDocument(string openapi) { - if (input == null) + if (openapi == null) { - throw new ArgumentNullException("input"); + throw new ArgumentNullException("openapi"); } - var stream = GetStream(input); + var stream = GetStream(openapi); OpenApiDocument document; @@ -202,9 +202,9 @@ internal static void ValidateOpenApiDocument(string input) Console.WriteLine(statsVisitor.GetStatisticsReport()); } - private static OpenApiFormat GetOpenApiFormat(string input) + private static OpenApiFormat GetOpenApiFormat(string openapi) { - return !input.StartsWith("http") && Path.GetExtension(input) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml; + return !openapi.StartsWith("http") && Path.GetExtension(openapi) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml; } } } From f8bf418c47983cb7e1b554370eac48a2fcd1ad6c Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 25 Jan 2022 09:57:38 +0300 Subject: [PATCH 061/752] Clean up code --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 23 ++++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 17920ea6d..3fbcde7fa 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -9,7 +9,6 @@ using System.Net.Http; using System.Text; using System.Text.Json; -using System.Threading.Tasks; using System.Xml.Linq; using Microsoft.OData.Edm.Csdl; using Microsoft.OpenApi.Extensions; @@ -49,21 +48,27 @@ public static void ProcessOpenApiDocument( } var stream = GetStream(input); + + ReadResult result = null; + OpenApiDocument document; - if (input.Contains("xml")) + if (input.Contains(".xml")) { document = ConvertCsdlToOpenApi(stream); } - - var result = new OpenApiStreamReader(new OpenApiReaderSettings + else { - ReferenceResolution = resolveExternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, - RuleSet = ValidationRuleSet.GetDefaultRuleSet() - } - ).ReadAsync(stream).GetAwaiter().GetResult(); + result = new OpenApiStreamReader(new OpenApiReaderSettings + { + ReferenceResolution = resolveExternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, + RuleSet = ValidationRuleSet.GetDefaultRuleSet() + } + ).ReadAsync(stream).GetAwaiter().GetResult(); - document = result.OpenApiDocument; + document = result.OpenApiDocument; + } + Func predicate; // Check if filter options are provided, then execute From 9ea74173b657918177b28bf6a1af7a188dc528a8 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 25 Jan 2022 16:25:05 +0300 Subject: [PATCH 062/752] Refactor code --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 3fbcde7fa..25faa1b28 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -67,6 +67,20 @@ public static void ProcessOpenApiDocument( ).ReadAsync(stream).GetAwaiter().GetResult(); document = result.OpenApiDocument; + + var context = result.OpenApiDiagnostic; + + if (context.Errors.Count > 0) + { + var errorReport = new StringBuilder(); + + foreach (var error in context.Errors) + { + errorReport.AppendLine(error.ToString()); + } + + throw new ArgumentException(string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())); + } } Func predicate; @@ -94,21 +108,7 @@ public static void ProcessOpenApiDocument( predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source:document); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } - - var context = result.OpenApiDiagnostic; - - if (context.Errors.Count > 0) - { - var errorReport = new StringBuilder(); - - foreach (var error in context.Errors) - { - errorReport.AppendLine(error.ToString()); - } - - throw new ArgumentException(string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())); - } - + using var outputStream = output?.Create(); var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; From 17c4ab4d73623772ad4e8e88eac0bb62a4d9e0d1 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 26 Jan 2022 10:37:03 +0300 Subject: [PATCH 063/752] Add check for .csdl files --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 25faa1b28..782f16e88 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -53,7 +53,7 @@ public static void ProcessOpenApiDocument( OpenApiDocument document; - if (input.Contains(".xml")) + if (input.Contains(".xml") || input.Contains(".csdl")) { document = ConvertCsdlToOpenApi(stream); } From ef2286a61f4c83f14a7da96250886b0a64dbe7ae Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 26 Jan 2022 10:37:54 +0300 Subject: [PATCH 064/752] Add a sample csdl file for testing and copy to output directory --- .../UtilityFiles/Todo.xml | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/Microsoft.OpenApi.Tests/UtilityFiles/Todo.xml diff --git a/test/Microsoft.OpenApi.Tests/UtilityFiles/Todo.xml b/test/Microsoft.OpenApi.Tests/UtilityFiles/Todo.xml new file mode 100644 index 000000000..b3b07debf --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/UtilityFiles/Todo.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + From e2ac4e4f237060923b5ee070996dcbbf756ff7a2 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 26 Jan 2022 10:38:17 +0300 Subject: [PATCH 065/752] Add csdl conversion tests --- .../Services/OpenApiCSDLConversionTests.cs | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 test/Microsoft.OpenApi.Tests/Services/OpenApiCSDLConversionTests.cs diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiCSDLConversionTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiCSDLConversionTests.cs new file mode 100644 index 000000000..969fe325c --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiCSDLConversionTests.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System; +using System.IO; +using Microsoft.OpenApi.Hidi; +using Microsoft.OpenApi.Services; +using Xunit; + +namespace Microsoft.OpenApi.Tests.Services +{ + public class OpenApiCSDLConversionTests + { + [Fact] + public void ReturnConvertedCSDLFile() + { + // Arrange + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml"); + var fileInput = new FileInfo(filePath); + var csdlStream = fileInput.OpenRead(); + + // Act + var openApiDoc = OpenApiService.ConvertCsdlToOpenApi(csdlStream); + var expectedPathCount = 5; + + // Assert + Assert.NotNull(openApiDoc); + Assert.NotEmpty(openApiDoc.Paths); + Assert.Equal(openApiDoc.Paths.Count, expectedPathCount); + } + + [Theory] + [InlineData("Todos.Todo.UpdateTodo",null, 1)] + [InlineData("Todos.Todo.ListTodo",null, 1)] + [InlineData(null, "Todos.Todo", 4)] + public void ReturnFilteredOpenApiDocumentBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount) + { + // Arrange + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml"); + var fileInput = new FileInfo(filePath); + var csdlStream = fileInput.OpenRead(); + + // Act + var openApiDoc = OpenApiService.ConvertCsdlToOpenApi(csdlStream); + var predicate = OpenApiFilterService.CreatePredicate(operationIds, tags); + var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(openApiDoc, predicate); + + // Assert + Assert.NotNull(subsetOpenApiDocument); + Assert.NotEmpty(subsetOpenApiDocument.Paths); + Assert.Equal(expectedPathCount, subsetOpenApiDocument.Paths.Count); + } + } +} From 2675c0662e808e53a5038fa4e6d5517ff71b0e7a Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 26 Jan 2022 10:51:27 +0300 Subject: [PATCH 066/752] Add xml documentation --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 782f16e88..8dcb0d22d 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -162,6 +162,11 @@ public static OpenApiDocument ConvertCsdlToOpenApi(Stream csdl) return document; } + /// + /// Fixes the references in the resulting OpenApiDocument. + /// + /// The converted OpenApiDocument. + /// A valid OpenApiDocument instance. public static OpenApiDocument FixReferences(OpenApiDocument document) { // This method is only needed because the output of ConvertToOpenApi isn't quite a valid OpenApiDocument instance. From 2cd5120b6e6bc674a4ff579c17aab6d69e15f418 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 27 Jan 2022 12:57:08 +0300 Subject: [PATCH 067/752] Use kebab case for multi-name params --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 24 ++++++++++---------- src/Microsoft.OpenApi.Hidi/Program.cs | 8 +++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 3ce75ee17..cad202fd9 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -25,11 +25,11 @@ public static void ProcessOpenApiDocument( FileInfo output, OpenApiSpecVersion? version, OpenApiFormat? format, - string filterByOperationIds, - string filterByTags, - string filterByCollection, + string filterbyoperationids, + string filterbytags, + string filterbycollection, bool inline, - bool resolveExternal) + bool resolveexternal) { if (string.IsNullOrEmpty(openapi)) { @@ -47,7 +47,7 @@ public static void ProcessOpenApiDocument( var stream = GetStream(openapi); var result = new OpenApiStreamReader(new OpenApiReaderSettings { - ReferenceResolution = resolveExternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, + ReferenceResolution = resolveexternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, RuleSet = ValidationRuleSet.GetDefaultRuleSet() } ).ReadAsync(stream).GetAwaiter().GetResult(); @@ -56,24 +56,24 @@ public static void ProcessOpenApiDocument( Func predicate; // Check if filter options are provided, then execute - if (!string.IsNullOrEmpty(filterByOperationIds) && !string.IsNullOrEmpty(filterByTags)) + if (!string.IsNullOrEmpty(filterbyoperationids) && !string.IsNullOrEmpty(filterbytags)) { throw new InvalidOperationException("Cannot filter by operationIds and tags at the same time."); } - if (!string.IsNullOrEmpty(filterByOperationIds)) + if (!string.IsNullOrEmpty(filterbyoperationids)) { - predicate = OpenApiFilterService.CreatePredicate(operationIds: filterByOperationIds); + predicate = OpenApiFilterService.CreatePredicate(operationIds: filterbyoperationids); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } - if (!string.IsNullOrEmpty(filterByTags)) + if (!string.IsNullOrEmpty(filterbytags)) { - predicate = OpenApiFilterService.CreatePredicate(tags: filterByTags); + predicate = OpenApiFilterService.CreatePredicate(tags: filterbytags); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } - if (!string.IsNullOrEmpty(filterByCollection)) + if (!string.IsNullOrEmpty(filterbycollection)) { - var fileStream = GetStream(filterByCollection); + var fileStream = GetStream(filterbycollection); var requestUrls = ParseJsonCollectionFile(fileStream); predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source:document); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index c4e27e29b..e5865d464 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -31,16 +31,16 @@ static async Task Main(string[] args) var inlineOption = new Option("--inline", "Inline $ref instances", typeof(bool)); inlineOption.AddAlias("-i"); ; - var resolveExternalOption = new Option("--resolveExternal", "Resolve external $refs", typeof(bool)); + var resolveExternalOption = new Option("--resolve-external", "Resolve external $refs", typeof(bool)); resolveExternalOption.AddAlias("-ex"); ; - var filterByOperationIdsOption = new Option("--filterByOperationIds", "Filters OpenApiDocument by OperationId(s) provided", typeof(string)); + var filterByOperationIdsOption = new Option("--filter-by-operationids", "Filters OpenApiDocument by OperationId(s) provided", typeof(string)); filterByOperationIdsOption.AddAlias("-op"); ; - var filterByTagsOption = new Option("--filterByTags", "Filters OpenApiDocument by Tag(s) provided", typeof(string)); + var filterByTagsOption = new Option("--filter-by-tags", "Filters OpenApiDocument by Tag(s) provided", typeof(string)); filterByTagsOption.AddAlias("-t"); ; - var filterByCollectionOption = new Option("--filterByCollection", "Filters OpenApiDocument by Postman collection provided", typeof(string)); + var filterByCollectionOption = new Option("--filter-by-collection", "Filters OpenApiDocument by Postman collection provided", typeof(string)); filterByCollectionOption.AddAlias("-c"); var validateCommand = new Command("validate") From 36a1013da2790cdcbeeff090ceff53d04a6ab369 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 27 Jan 2022 19:14:09 +0300 Subject: [PATCH 068/752] Add --csdl input param for converting csdl files --- src/Microsoft.OpenApi.Hidi/Program.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index e5865d464..77781a33f 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -19,6 +19,9 @@ static async Task Main(string[] args) var descriptionOption = new Option("--openapi", "Input OpenAPI description file path or URL", typeof(string)); descriptionOption.AddAlias("-d"); + var csdlOption = new Option("--csdl", "Input CSDL file path or URL", typeof(string)); + csdlOption.AddAlias("-cs"); + var outputOption = new Option("--output", "The output directory path for the generated file.", typeof(FileInfo), () => "./output", arity: ArgumentArity.ZeroOrOne); outputOption.AddAlias("-o"); @@ -52,6 +55,7 @@ static async Task Main(string[] args) var transformCommand = new Command("transform") { descriptionOption, + csdlOption, outputOption, versionOption, formatOption, @@ -61,7 +65,7 @@ static async Task Main(string[] args) filterByTagsOption, filterByCollectionOption }; - transformCommand.Handler = CommandHandler.Create( + transformCommand.Handler = CommandHandler.Create( OpenApiService.ProcessOpenApiDocument); rootCommand.Add(transformCommand); From 74caa3d071a8029e4ed0f7e95819b50ce460ba6a Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 27 Jan 2022 19:14:29 +0300 Subject: [PATCH 069/752] Refactor code --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 39 +++++++++++--------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 22f02cf57..653be79e4 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -25,6 +25,7 @@ public static class OpenApiService { public static void ProcessOpenApiDocument( string openapi, + string csdl, FileInfo output, OpenApiSpecVersion? version, OpenApiFormat? format, @@ -34,9 +35,9 @@ public static void ProcessOpenApiDocument( bool inline, bool resolveexternal) { - if (string.IsNullOrEmpty(openapi)) + if (string.IsNullOrEmpty(openapi) && string.IsNullOrEmpty(csdl)) { - throw new ArgumentNullException(nameof(openapi)); + throw new ArgumentNullException("Please input a file path"); } if(output == null) { @@ -47,21 +48,25 @@ public static void ProcessOpenApiDocument( throw new IOException("The file you're writing to already exists. Please input a new output path."); } - var stream = GetStream(input); - - ReadResult result = null; - + Stream stream; OpenApiDocument document; + OpenApiFormat openApiFormat; - if (input.Contains(".xml") || input.Contains(".csdl")) + if (!string.IsNullOrEmpty(csdl)) { - document = ConvertCsdlToOpenApi(stream); + // Default to yaml during csdl to OpenApi conversion + openApiFormat = format ?? GetOpenApiFormat(csdl); + + stream = GetStream(csdl); + document = ConvertCsdlToOpenApi(stream); } else { - result = new OpenApiStreamReader(new OpenApiReaderSettings + stream = GetStream(openapi); + + var result = new OpenApiStreamReader(new OpenApiReaderSettings { - ReferenceResolution = resolveExternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, + ReferenceResolution = resolveexternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, RuleSet = ValidationRuleSet.GetDefaultRuleSet() } ).ReadAsync(stream).GetAwaiter().GetResult(); @@ -81,8 +86,11 @@ public static void ProcessOpenApiDocument( throw new ArgumentException(string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())); } + + openApiFormat = format ?? GetOpenApiFormat(openapi); + version ??= result.OpenApiDiagnostic.SpecificationVersion; } - + Func predicate; // Check if filter options are provided, then execute @@ -100,7 +108,6 @@ public static void ProcessOpenApiDocument( predicate = OpenApiFilterService.CreatePredicate(tags: filterbytags); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } - if (!string.IsNullOrEmpty(filterbycollection)) { var fileStream = GetStream(filterbycollection); @@ -118,15 +125,13 @@ public static void ProcessOpenApiDocument( ReferenceInline = inline ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences }; - var openApiFormat = format ?? GetOpenApiFormat(openapi); - var openApiVersion = version ?? result.OpenApiDiagnostic.SpecificationVersion; IOpenApiWriter writer = openApiFormat switch { OpenApiFormat.Json => new OpenApiJsonWriter(textWriter, settings), OpenApiFormat.Yaml => new OpenApiYamlWriter(textWriter, settings), _ => throw new ArgumentException("Unknown format"), }; - document.Serialize(writer, openApiVersion); + document.Serialize(writer, (OpenApiSpecVersion)version); textWriter.Flush(); } @@ -139,7 +144,7 @@ public static void ProcessOpenApiDocument( public static OpenApiDocument ConvertCsdlToOpenApi(Stream csdl) { using var reader = new StreamReader(csdl); - var csdlText = reader.ReadToEndAsync().GetAwaiter().GetResult(); + var csdlText = reader.ReadToEndAsync().GetAwaiter().GetResult(); var edmModel = CsdlReader.Parse(XElement.Parse(csdlText).CreateReader()); var settings = new OpenApiConvertSettings() @@ -179,7 +184,7 @@ public static OpenApiDocument FixReferences(OpenApiDocument document) return doc; } - private static Stream GetStream(string input) + private static Stream GetStream(string openapi) { Stream stream; if (openapi.StartsWith("http")) From 44f60698e845b01aca2ee3c8ae838cf8b27a5b77 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 27 Jan 2022 19:17:02 +0300 Subject: [PATCH 070/752] Rename test file --- .../{OpenApiCSDLConversionTests.cs => OpenApiServiceTests.cs} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename test/Microsoft.OpenApi.Tests/Services/{OpenApiCSDLConversionTests.cs => OpenApiServiceTests.cs} (90%) diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiCSDLConversionTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs similarity index 90% rename from test/Microsoft.OpenApi.Tests/Services/OpenApiCSDLConversionTests.cs rename to test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs index 969fe325c..1b94a3557 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiCSDLConversionTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs @@ -9,7 +9,7 @@ namespace Microsoft.OpenApi.Tests.Services { - public class OpenApiCSDLConversionTests + public class OpenApiServiceTests { [Fact] public void ReturnConvertedCSDLFile() @@ -33,7 +33,7 @@ public void ReturnConvertedCSDLFile() [InlineData("Todos.Todo.UpdateTodo",null, 1)] [InlineData("Todos.Todo.ListTodo",null, 1)] [InlineData(null, "Todos.Todo", 4)] - public void ReturnFilteredOpenApiDocumentBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount) + public void ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount) { // Arrange var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml"); From 4791c2183d6dcbdc8ddec2f14d1ffb653c86ba74 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 27 Jan 2022 19:26:46 +0300 Subject: [PATCH 071/752] Refactor param to be more implicit --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 653be79e4..3013da5e9 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -184,10 +184,10 @@ public static OpenApiDocument FixReferences(OpenApiDocument document) return doc; } - private static Stream GetStream(string openapi) + private static Stream GetStream(string input) { Stream stream; - if (openapi.StartsWith("http")) + if (input.StartsWith("http")) { var httpClient = new HttpClient(new HttpClientHandler() { @@ -196,11 +196,11 @@ private static Stream GetStream(string openapi) { DefaultRequestVersion = HttpVersion.Version20 }; - stream = httpClient.GetStreamAsync(openapi).Result; + stream = httpClient.GetStreamAsync(input).Result; } else { - var fileInput = new FileInfo(openapi); + var fileInput = new FileInfo(input); stream = fileInput.OpenRead(); } From 9005e10704af12988a7fc6cb0866df51a7a77998 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 27 Jan 2022 19:33:36 +0300 Subject: [PATCH 072/752] Clean up code --- src/Microsoft.OpenApi.Hidi/Program.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index e5865d464..5dc4e3961 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -27,19 +27,19 @@ static async Task Main(string[] args) var formatOption = new Option("--format", "File format", typeof(OpenApiFormat)); formatOption.AddAlias("-f"); -; + var inlineOption = new Option("--inline", "Inline $ref instances", typeof(bool)); inlineOption.AddAlias("-i"); -; + var resolveExternalOption = new Option("--resolve-external", "Resolve external $refs", typeof(bool)); resolveExternalOption.AddAlias("-ex"); -; + var filterByOperationIdsOption = new Option("--filter-by-operationids", "Filters OpenApiDocument by OperationId(s) provided", typeof(string)); filterByOperationIdsOption.AddAlias("-op"); -; + var filterByTagsOption = new Option("--filter-by-tags", "Filters OpenApiDocument by Tag(s) provided", typeof(string)); filterByTagsOption.AddAlias("-t"); -; + var filterByCollectionOption = new Option("--filter-by-collection", "Filters OpenApiDocument by Postman collection provided", typeof(string)); filterByCollectionOption.AddAlias("-c"); From e8767ed62e954cd76c678b258b9668c1be263b4c Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 27 Jan 2022 19:33:57 +0300 Subject: [PATCH 073/752] Refactor param to be implicit --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index cad202fd9..a1fd8135d 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -115,10 +115,10 @@ public static void ProcessOpenApiDocument( textWriter.Flush(); } - private static Stream GetStream(string openapi) + private static Stream GetStream(string input) { Stream stream; - if (openapi.StartsWith("http")) + if (input.StartsWith("http")) { var httpClient = new HttpClient(new HttpClientHandler() { @@ -127,11 +127,11 @@ private static Stream GetStream(string openapi) { DefaultRequestVersion = HttpVersion.Version20 }; - stream = httpClient.GetStreamAsync(openapi).Result; + stream = httpClient.GetStreamAsync(input).Result; } else { - var fileInput = new FileInfo(openapi); + var fileInput = new FileInfo(input); stream = fileInput.OpenRead(); } From 7c7a1c14c977e9bca5f13483984212e5c4bbe561 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sat, 29 Jan 2022 17:12:59 -0500 Subject: [PATCH 074/752] Updated hidi parameters to control both local and remote inlining independently --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 12 +++++++----- src/Microsoft.OpenApi.Hidi/Program.cs | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index e381dd64f..05b44c9c6 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -26,11 +26,12 @@ public static void ProcessOpenApiDocument( FileInfo output, OpenApiSpecVersion? version, OpenApiFormat? format, + bool inlineExternal, + bool inlineLocal, string filterByOperationIds, string filterByTags, - string filterByCollection, - bool inline, - bool resolveExternal) + string filterByCollection + ) { if (string.IsNullOrEmpty(input)) { @@ -52,7 +53,7 @@ public static void ProcessOpenApiDocument( var result = new OpenApiStreamReader(new OpenApiReaderSettings { - ReferenceResolution = resolveExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, + ReferenceResolution = inlineExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, RuleSet = ValidationRuleSet.GetDefaultRuleSet(), BaseUrl = new Uri(inputUrl.AbsoluteUri) } @@ -105,7 +106,8 @@ public static void ProcessOpenApiDocument( var settings = new OpenApiWriterSettings() { - ReferenceInline = inline ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences + InlineLocalReferences = inlineLocal, + InlineExternalReferences = inlineExternal }; var openApiFormat = format ?? GetOpenApiFormat(input); diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 8bc54e2fc..c6f7eff44 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -28,13 +28,13 @@ static async Task Main(string[] args) new Option("--output","Output OpenAPI description file", typeof(FileInfo), arity: ArgumentArity.ZeroOrOne), new Option("--version", "OpenAPI specification version", typeof(OpenApiSpecVersion)), new Option("--format", "File format",typeof(OpenApiFormat) ), - new Option("--inline", "Inline $ref instances", typeof(bool) ), - new Option("--resolveExternal","Resolve external $refs", typeof(bool)), + new Option("--inlineExternal", "Inline external $ref instances", typeof(bool) ), + new Option("--inlineLocal", "Inline local $ref instances", typeof(bool) ), new Option("--filterByOperationIds", "Filters OpenApiDocument by OperationId(s) provided", typeof(string)), new Option("--filterByTags", "Filters OpenApiDocument by Tag(s) provided", typeof(string)), new Option("--filterByCollection", "Filters OpenApiDocument by Postman collection provided", typeof(string)) }; - transformCommand.Handler = CommandHandler.Create( + transformCommand.Handler = CommandHandler.Create( OpenApiService.ProcessOpenApiDocument); rootCommand.Add(transformCommand); From 5dadc104bec1b7d72184d9a73fb98f798cfb004c Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 1 Feb 2022 12:58:28 +0300 Subject: [PATCH 075/752] Add logging configurations --- src/Microsoft.OpenApi.Hidi/appsettings.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/Microsoft.OpenApi.Hidi/appsettings.json diff --git a/src/Microsoft.OpenApi.Hidi/appsettings.json b/src/Microsoft.OpenApi.Hidi/appsettings.json new file mode 100644 index 000000000..882248cf8 --- /dev/null +++ b/src/Microsoft.OpenApi.Hidi/appsettings.json @@ -0,0 +1,7 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug" + } + } +} \ No newline at end of file From 86d274ffc8a03fb55fdb52c628baf1026d98ca69 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 1 Feb 2022 12:59:15 +0300 Subject: [PATCH 076/752] Install packages --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 4db249c8f..c832225fd 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -10,6 +10,10 @@ + + + + From 6aaa5ae51b71e9d52f5db897761b8f35714292aa Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 1 Feb 2022 13:00:29 +0300 Subject: [PATCH 077/752] Add a loglevel command option for additional logging --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 203 ++++++++++++++----- src/Microsoft.OpenApi.Hidi/Program.cs | 16 +- 2 files changed, 164 insertions(+), 55 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index a1fd8135d..b85f68fcc 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -3,12 +3,15 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; using System.Net; using System.Net.Http; +using System.Security; using System.Text; using System.Text.Json; +using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Readers; @@ -18,91 +21,135 @@ namespace Microsoft.OpenApi.Hidi { - public static class OpenApiService + public class OpenApiService { public static void ProcessOpenApiDocument( string openapi, FileInfo output, OpenApiSpecVersion? version, OpenApiFormat? format, + LogLevel loglevel, string filterbyoperationids, string filterbytags, string filterbycollection, bool inline, bool resolveexternal) { - if (string.IsNullOrEmpty(openapi)) + var logger = ConfigureLoggerInstance(loglevel); + + try { - throw new ArgumentNullException(nameof(openapi)); + if (string.IsNullOrEmpty(openapi)) + { + throw new ArgumentNullException(nameof(openapi)); + } + } + catch (ArgumentNullException ex) + { + logger.LogError(ex.Message); + return; + } + try + { + if(output == null) + { + throw new ArgumentException(nameof(output)); + } } - if(output == null) + catch (ArgumentException ex) { - throw new ArgumentException(nameof(output)); + logger.LogError(ex.Message); + return; } - if (output.Exists) + try { - throw new IOException("The file you're writing to already exists. Please input a new output path."); + if (output.Exists) + { + throw new IOException("The file you're writing to already exists. Please input a new file path."); + } } + catch (IOException ex) + { + logger.LogError(ex.Message); + return; + } + + var stream = GetStream(openapi, logger); - var stream = GetStream(openapi); + // Parsing OpenAPI file + var stopwatch = new Stopwatch(); + stopwatch.Start(); + logger.LogTrace("Parsing OpenApi file"); var result = new OpenApiStreamReader(new OpenApiReaderSettings { ReferenceResolution = resolveexternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, RuleSet = ValidationRuleSet.GetDefaultRuleSet() } ).ReadAsync(stream).GetAwaiter().GetResult(); - var document = result.OpenApiDocument; + stopwatch.Stop(); + + var context = result.OpenApiDiagnostic; + if (context.Errors.Count > 0) + { + var errorReport = new StringBuilder(); + + foreach (var error in context.Errors) + { + errorReport.AppendLine(error.ToString()); + } + logger.LogError($"{stopwatch.ElapsedMilliseconds}ms: OpenApi Parsing errors {string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())}"); + } + else + { + logger.LogTrace("{timestamp}ms: Parsed OpenApi successfully. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count); + } + Func predicate; - // Check if filter options are provided, then execute + // Check if filter options are provided, then slice the OpenAPI document if (!string.IsNullOrEmpty(filterbyoperationids) && !string.IsNullOrEmpty(filterbytags)) { throw new InvalidOperationException("Cannot filter by operationIds and tags at the same time."); } if (!string.IsNullOrEmpty(filterbyoperationids)) { + logger.LogTrace("Creating predicate based on the operationIds supplied."); predicate = OpenApiFilterService.CreatePredicate(operationIds: filterbyoperationids); + + logger.LogTrace("Creating subset OpenApi document."); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } if (!string.IsNullOrEmpty(filterbytags)) { + logger.LogTrace("Creating predicate based on the tags supplied."); predicate = OpenApiFilterService.CreatePredicate(tags: filterbytags); - document = OpenApiFilterService.CreateFilteredDocument(document, predicate); - } - if (!string.IsNullOrEmpty(filterbycollection)) - { - var fileStream = GetStream(filterbycollection); - var requestUrls = ParseJsonCollectionFile(fileStream); - predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source:document); + logger.LogTrace("Creating subset OpenApi document."); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } - - var context = result.OpenApiDiagnostic; - - if (context.Errors.Count > 0) + if (!string.IsNullOrEmpty(filterbycollection)) { - var errorReport = new StringBuilder(); + var fileStream = GetStream(filterbycollection, logger); + var requestUrls = ParseJsonCollectionFile(fileStream, logger); - foreach (var error in context.Errors) - { - errorReport.AppendLine(error.ToString()); - } + logger.LogTrace("Creating predicate based on the paths and Http methods defined in the Postman collection."); + predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source:document); - throw new ArgumentException(string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())); + logger.LogTrace("Creating subset OpenApi document."); + document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } - + + logger.LogTrace("Creating a new file"); using var outputStream = output?.Create(); - - var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; + var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; var settings = new OpenApiWriterSettings() { ReferenceInline = inline ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences }; - var openApiFormat = format ?? GetOpenApiFormat(openapi); + var openApiFormat = format ?? GetOpenApiFormat(openapi, logger); var openApiVersion = version ?? result.OpenApiDiagnostic.SpecificationVersion; IOpenApiWriter writer = openApiFormat switch { @@ -110,31 +157,64 @@ public static void ProcessOpenApiDocument( OpenApiFormat.Yaml => new OpenApiYamlWriter(textWriter, settings), _ => throw new ArgumentException("Unknown format"), }; + + logger.LogTrace("Serializing to OpenApi document using the provided spec version and writer"); + + stopwatch.Start(); document.Serialize(writer, openApiVersion); + stopwatch.Stop(); + + logger.LogTrace($"Finished serializing in {stopwatch.ElapsedMilliseconds}ms"); textWriter.Flush(); } - private static Stream GetStream(string input) + private static Stream GetStream(string input, ILogger logger) { + var stopwatch = new Stopwatch(); + stopwatch.Start(); + Stream stream; if (input.StartsWith("http")) { - var httpClient = new HttpClient(new HttpClientHandler() + try { - SslProtocols = System.Security.Authentication.SslProtocols.Tls12, - }) + var httpClient = new HttpClient(new HttpClientHandler() + { + SslProtocols = System.Security.Authentication.SslProtocols.Tls12, + }) + { + DefaultRequestVersion = HttpVersion.Version20 + }; + stream = httpClient.GetStreamAsync(input).Result; + } + catch (HttpRequestException ex) { - DefaultRequestVersion = HttpVersion.Version20 - }; - stream = httpClient.GetStreamAsync(input).Result; + logger.LogError($"Could not download the file at {input}, reason{ex}"); + return null; + } } else { - var fileInput = new FileInfo(input); - stream = fileInput.OpenRead(); + try + { + var fileInput = new FileInfo(input); + stream = fileInput.OpenRead(); + } + catch (Exception ex) when (ex is FileNotFoundException || + ex is PathTooLongException || + ex is DirectoryNotFoundException || + ex is IOException || + ex is UnauthorizedAccessException || + ex is SecurityException || + ex is NotSupportedException) + { + logger.LogError($"Could not open the file at {input}, reason: {ex.Message}"); + return null; + } } - + stopwatch.Stop(); + logger.LogTrace("{timestamp}ms: Read file {input}", stopwatch.ElapsedMilliseconds, input); return stream; } @@ -143,11 +223,11 @@ private static Stream GetStream(string input) /// /// A file stream. /// A dictionary of request urls and http methods from a collection. - public static Dictionary> ParseJsonCollectionFile(Stream stream) + public static Dictionary> ParseJsonCollectionFile(Stream stream, ILogger logger) { var requestUrls = new Dictionary>(); - // Convert file to JsonDocument + logger.LogTrace("Parsing the json collection file into a JsonDocument"); using var document = JsonDocument.Parse(stream); var root = document.RootElement; var itemElement = root.GetProperty("item"); @@ -166,21 +246,21 @@ public static Dictionary> ParseJsonCollectionFile(Stream st requestUrls[path].Add(method); } } - + logger.LogTrace("Finished fetching the list of paths and Http methods defined in the Postman collection."); return requestUrls; } - internal static void ValidateOpenApiDocument(string openapi) + internal static void ValidateOpenApiDocument(string openapi, LogLevel loglevel) { - if (openapi == null) + if (string.IsNullOrEmpty(openapi)) { - throw new ArgumentNullException("openapi"); + throw new ArgumentNullException(nameof(openapi)); } - - var stream = GetStream(openapi); + var logger = ConfigureLoggerInstance(loglevel); + var stream = GetStream(openapi, logger); OpenApiDocument document; - + logger.LogTrace("Parsing the OpenApi file"); document = new OpenApiStreamReader(new OpenApiReaderSettings { RuleSet = ValidationRuleSet.GetDefaultRuleSet() @@ -199,12 +279,33 @@ internal static void ValidateOpenApiDocument(string openapi) var walker = new OpenApiWalker(statsVisitor); walker.Walk(document); + logger.LogTrace("Finished walking through the OpenApi document. Generating a statistics report.."); Console.WriteLine(statsVisitor.GetStatisticsReport()); } - private static OpenApiFormat GetOpenApiFormat(string openapi) + private static OpenApiFormat GetOpenApiFormat(string openapi, ILogger logger) { + logger.LogTrace("Getting the OpenApi format"); return !openapi.StartsWith("http") && Path.GetExtension(openapi) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml; } + + private static ILogger ConfigureLoggerInstance(LogLevel loglevel) + { + // Configure logger options + #if DEBUG + loglevel = loglevel > LogLevel.Debug ? LogLevel.Debug : loglevel; + #endif + + var logger = LoggerFactory.Create((builder) => { + builder + .AddConsole() + #if DEBUG + .AddDebug() + #endif + .SetMinimumLevel(loglevel); + }).CreateLogger(); + + return logger; + } } } diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 5dc4e3961..2f6f8f272 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -5,6 +5,7 @@ using System.CommandLine.Invocation; using System.IO; using System.Threading.Tasks; +using Microsoft.Extensions.Logging; namespace Microsoft.OpenApi.Hidi { @@ -27,7 +28,10 @@ static async Task Main(string[] args) var formatOption = new Option("--format", "File format", typeof(OpenApiFormat)); formatOption.AddAlias("-f"); - + + var logLevelOption = new Option("--loglevel", "The log level to use when logging messages to the main output.", typeof(LogLevel), () => LogLevel.Warning); + logLevelOption.AddAlias("-ll"); + var inlineOption = new Option("--inline", "Inline $ref instances", typeof(bool)); inlineOption.AddAlias("-i"); @@ -45,9 +49,11 @@ static async Task Main(string[] args) var validateCommand = new Command("validate") { - descriptionOption + descriptionOption, + logLevelOption }; - validateCommand.Handler = CommandHandler.Create(OpenApiService.ValidateOpenApiDocument); + + validateCommand.Handler = CommandHandler.Create(OpenApiService.ValidateOpenApiDocument); var transformCommand = new Command("transform") { @@ -55,13 +61,15 @@ static async Task Main(string[] args) outputOption, versionOption, formatOption, + logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption }; - transformCommand.Handler = CommandHandler.Create( + + transformCommand.Handler = CommandHandler.Create( OpenApiService.ProcessOpenApiDocument); rootCommand.Add(transformCommand); From cbf86d3fed049363dc15ef3ca9bd9e1b13468ab3 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 1 Feb 2022 13:00:50 +0300 Subject: [PATCH 078/752] Configure a mock logger for testing --- .../Services/OpenApiFilterServiceTests.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs index f470b8577..78f8ec048 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs @@ -3,10 +3,12 @@ using System; using System.IO; +using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Hidi; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Tests.UtilityFiles; +using Moq; using Xunit; namespace Microsoft.OpenApi.Tests.Services @@ -14,10 +16,14 @@ namespace Microsoft.OpenApi.Tests.Services public class OpenApiFilterServiceTests { private readonly OpenApiDocument _openApiDocumentMock; + private readonly Mock> _mockLogger; + private readonly ILogger _logger; public OpenApiFilterServiceTests() { _openApiDocumentMock = OpenApiDocumentMock.CreateOpenApiDocument(); + _mockLogger = new Mock>(); + _logger = _mockLogger.Object; } [Theory] @@ -53,7 +59,7 @@ public void ReturnFilteredOpenApiDocumentBasedOnPostmanCollection() var stream = fileInput.OpenRead(); // Act - var requestUrls = OpenApiService.ParseJsonCollectionFile(stream); + var requestUrls = OpenApiService.ParseJsonCollectionFile(stream, _logger); var predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: _openApiDocumentMock); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(_openApiDocumentMock, predicate); @@ -72,7 +78,7 @@ public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument() var stream = fileInput.OpenRead(); // Act - var requestUrls = OpenApiService.ParseJsonCollectionFile(stream); + var requestUrls = OpenApiService.ParseJsonCollectionFile(stream, _logger); // Assert var message = Assert.Throws(() => From 8f79df222130b0d46492e694d1b91cc641627922 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 1 Feb 2022 18:14:42 +0300 Subject: [PATCH 079/752] Resolve PR feedback --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index b85f68fcc..d1dea081a 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -11,6 +11,7 @@ using System.Security; using System.Text; using System.Text.Json; +using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; @@ -23,7 +24,7 @@ namespace Microsoft.OpenApi.Hidi { public class OpenApiService { - public static void ProcessOpenApiDocument( + public static async void ProcessOpenApiDocument( string openapi, FileInfo output, OpenApiSpecVersion? version, @@ -74,7 +75,7 @@ public static void ProcessOpenApiDocument( return; } - var stream = GetStream(openapi, logger); + var stream = await GetStream(openapi, logger); // Parsing OpenAPI file var stopwatch = new Stopwatch(); @@ -130,7 +131,7 @@ public static void ProcessOpenApiDocument( } if (!string.IsNullOrEmpty(filterbycollection)) { - var fileStream = GetStream(filterbycollection, logger); + var fileStream = await GetStream(filterbycollection, logger); var requestUrls = ParseJsonCollectionFile(fileStream, logger); logger.LogTrace("Creating predicate based on the paths and Http methods defined in the Postman collection."); @@ -169,7 +170,7 @@ public static void ProcessOpenApiDocument( textWriter.Flush(); } - private static Stream GetStream(string input, ILogger logger) + private static async Task GetStream(string input, ILogger logger) { var stopwatch = new Stopwatch(); stopwatch.Start(); @@ -179,14 +180,15 @@ private static Stream GetStream(string input, ILogger logger) { try { - var httpClient = new HttpClient(new HttpClientHandler() + using var httpClientHandler = new HttpClientHandler() { SslProtocols = System.Security.Authentication.SslProtocols.Tls12, - }) + }; + using var httpClient = new HttpClient(httpClientHandler) { DefaultRequestVersion = HttpVersion.Version20 }; - stream = httpClient.GetStreamAsync(input).Result; + stream = await httpClient.GetStreamAsync(input); } catch (HttpRequestException ex) { @@ -250,14 +252,14 @@ public static Dictionary> ParseJsonCollectionFile(Stream st return requestUrls; } - internal static void ValidateOpenApiDocument(string openapi, LogLevel loglevel) + internal static async void ValidateOpenApiDocument(string openapi, LogLevel loglevel) { if (string.IsNullOrEmpty(openapi)) { throw new ArgumentNullException(nameof(openapi)); } var logger = ConfigureLoggerInstance(loglevel); - var stream = GetStream(openapi, logger); + var stream = await GetStream(openapi, logger); OpenApiDocument document; logger.LogTrace("Parsing the OpenApi file"); From 24c570107904923452d092c0486913c2efd614fb Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 2 Feb 2022 14:18:51 +0300 Subject: [PATCH 080/752] Upgrades to System.Commandline beta2 --- .../Microsoft.OpenApi.Hidi.csproj | 3 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 7 +-- src/Microsoft.OpenApi.Hidi/Program.cs | 45 +++++++++---------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c832225fd..ea617ae94 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -3,6 +3,7 @@ Exe netcoreapp3.1 + 9.0 true hidi ./../../artifacts @@ -14,7 +15,7 @@ - + diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index d1dea081a..3c9fdb7d5 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -30,11 +30,12 @@ public static async void ProcessOpenApiDocument( OpenApiSpecVersion? version, OpenApiFormat? format, LogLevel loglevel, + bool inline, + bool resolveexternal, string filterbyoperationids, string filterbytags, - string filterbycollection, - bool inline, - bool resolveexternal) + string filterbycollection + ) { var logger = ConfigureLoggerInstance(loglevel); diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 2f6f8f272..841c710e5 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System.CommandLine; -using System.CommandLine.Invocation; using System.IO; using System.Threading.Tasks; using Microsoft.Extensions.Logging; @@ -15,45 +14,45 @@ static async Task Main(string[] args) { var rootCommand = new RootCommand() { }; - + // command option parameters and aliases - var descriptionOption = new Option("--openapi", "Input OpenAPI description file path or URL", typeof(string)); + var descriptionOption = new Option("--openapi", "Input OpenAPI description file path or URL"); descriptionOption.AddAlias("-d"); - var outputOption = new Option("--output", "The output directory path for the generated file.", typeof(FileInfo), () => "./output", arity: ArgumentArity.ZeroOrOne); + var outputOption = new Option("--output", () => new FileInfo("./output"), "The output directory path for the generated file.") { Arity = ArgumentArity.ZeroOrOne }; outputOption.AddAlias("-o"); - var versionOption = new Option("--version", "OpenAPI specification version", typeof(OpenApiSpecVersion)); + var versionOption = new Option("--version", "OpenAPI specification version"); versionOption.AddAlias("-v"); - var formatOption = new Option("--format", "File format", typeof(OpenApiFormat)); + var formatOption = new Option("--format", "File format"); formatOption.AddAlias("-f"); - var logLevelOption = new Option("--loglevel", "The log level to use when logging messages to the main output.", typeof(LogLevel), () => LogLevel.Warning); + var logLevelOption = new Option("--loglevel", () => LogLevel.Warning, "The log level to use when logging messages to the main output."); logLevelOption.AddAlias("-ll"); - var inlineOption = new Option("--inline", "Inline $ref instances", typeof(bool)); - inlineOption.AddAlias("-i"); - - var resolveExternalOption = new Option("--resolve-external", "Resolve external $refs", typeof(bool)); - resolveExternalOption.AddAlias("-ex"); - - var filterByOperationIdsOption = new Option("--filter-by-operationids", "Filters OpenApiDocument by OperationId(s) provided", typeof(string)); + var filterByOperationIdsOption = new Option("--filter-by-operationids", "Filters OpenApiDocument by OperationId(s) provided"); filterByOperationIdsOption.AddAlias("-op"); - var filterByTagsOption = new Option("--filter-by-tags", "Filters OpenApiDocument by Tag(s) provided", typeof(string)); + var filterByTagsOption = new Option("--filter-by-tags", "Filters OpenApiDocument by Tag(s) provided"); filterByTagsOption.AddAlias("-t"); - var filterByCollectionOption = new Option("--filter-by-collection", "Filters OpenApiDocument by Postman collection provided", typeof(string)); + var filterByCollectionOption = new Option("--filter-by-collection", "Filters OpenApiDocument by Postman collection provided"); filterByCollectionOption.AddAlias("-c"); + var inlineOption = new Option("--inline", "Inline $ref instances"); + inlineOption.AddAlias("-i"); + + var resolveExternalOption = new Option("--resolve-external", "Resolve external $refs"); + resolveExternalOption.AddAlias("-ex"); + var validateCommand = new Command("validate") { descriptionOption, logLevelOption }; - validateCommand.Handler = CommandHandler.Create(OpenApiService.ValidateOpenApiDocument); + validateCommand.SetHandler(OpenApiService.ValidateOpenApiDocument, descriptionOption, logLevelOption); var transformCommand = new Command("transform") { @@ -61,16 +60,16 @@ static async Task Main(string[] args) outputOption, versionOption, formatOption, - logLevelOption, - inlineOption, - resolveExternalOption, + logLevelOption, filterByOperationIdsOption, filterByTagsOption, - filterByCollectionOption + filterByCollectionOption, + inlineOption, + resolveExternalOption, }; - transformCommand.Handler = CommandHandler.Create( - OpenApiService.ProcessOpenApiDocument); + transformCommand.SetHandler ( + OpenApiService.ProcessOpenApiDocument, descriptionOption, outputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); From 97b21a56fff54442fef94a94623ff00fc0fa99e3 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Wed, 2 Feb 2022 08:16:12 -0500 Subject: [PATCH 081/752] Updated versions to preview3 --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index ea617ae94..9fe37bbc2 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -7,7 +7,7 @@ true hidi ./../../artifacts - 0.5.0-preview2 + 0.5.0-preview3 From 6dfa3b1cb8cb7a234c9dd6cafaadaa7f350232de Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 3 Feb 2022 17:04:34 +0300 Subject: [PATCH 082/752] Clean up code --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 10 +++++----- src/Microsoft.OpenApi.Hidi/Program.cs | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 19a4f28c5..5b0e5d15b 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -83,21 +83,21 @@ string filterbycollection Stream stream; OpenApiDocument document; OpenApiFormat openApiFormat; + var stopwatch = new Stopwatch(); if (!string.IsNullOrEmpty(csdl)) { // Default to yaml during csdl to OpenApi conversion - openApiFormat = format ?? GetOpenApiFormat(csdl); + openApiFormat = format ?? GetOpenApiFormat(csdl, logger); - stream = GetStream(csdl); + stream = await GetStream(csdl, logger); document = ConvertCsdlToOpenApi(stream); } else { - stream = GetStream(openapi, logger); + stream = await GetStream(openapi, logger); // Parsing OpenAPI file - var stopwatch = new Stopwatch(); stopwatch.Start(); logger.LogTrace("Parsing OpenApi file"); var result = new OpenApiStreamReader(new OpenApiReaderSettings @@ -126,7 +126,7 @@ string filterbycollection logger.LogTrace("{timestamp}ms: Parsed OpenApi successfully. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } - openApiFormat = format ?? GetOpenApiFormat(openapi); + openApiFormat = format ?? GetOpenApiFormat(openapi, logger); version ??= result.OpenApiDiagnostic.SpecificationVersion; } diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index df8d26fa1..95e6f63f2 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -19,7 +19,7 @@ static async Task Main(string[] args) var descriptionOption = new Option("--openapi", "Input OpenAPI description file path or URL"); descriptionOption.AddAlias("-d"); - var csdlOption = new Option("--csdl", "Input CSDL file path or URL", typeof(string)); + var csdlOption = new Option("--csdl", "Input CSDL file path or URL"); csdlOption.AddAlias("-cs"); var outputOption = new Option("--output", () => new FileInfo("./output"), "The output directory path for the generated file.") { Arity = ArgumentArity.ZeroOrOne }; @@ -72,8 +72,8 @@ static async Task Main(string[] args) resolveExternalOption, }; - transformCommand.SetHandler ( - OpenApiService.ProcessOpenApiDocument, descriptionOption, outputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); + transformCommand.SetHandler ( + OpenApiService.ProcessOpenApiDocument, descriptionOption, csdlOption, outputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); From e6f6e92d48c9470d78cf969a8386d7b786a67009 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Fri, 4 Feb 2022 10:25:41 +0300 Subject: [PATCH 083/752] Default to V3 of OpenApi during document serialization --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 5b0e5d15b..f10a6f8ac 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -87,8 +87,9 @@ string filterbycollection if (!string.IsNullOrEmpty(csdl)) { - // Default to yaml during csdl to OpenApi conversion + // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion openApiFormat = format ?? GetOpenApiFormat(csdl, logger); + version ??= OpenApiSpecVersion.OpenApi3_0; stream = await GetStream(csdl, logger); document = ConvertCsdlToOpenApi(stream); From f6e6f90cf168acbeba78e7fe699097a1ac5f34f4 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Fri, 4 Feb 2022 10:26:00 +0300 Subject: [PATCH 084/752] Clean up --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index f10a6f8ac..964329aaf 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -356,10 +356,10 @@ internal static async void ValidateOpenApiDocument(string openapi, LogLevel logl Console.WriteLine(statsVisitor.GetStatisticsReport()); } - private static OpenApiFormat GetOpenApiFormat(string openapi, ILogger logger) + private static OpenApiFormat GetOpenApiFormat(string input, ILogger logger) { logger.LogTrace("Getting the OpenApi format"); - return !openapi.StartsWith("http") && Path.GetExtension(openapi) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml; + return !input.StartsWith("http") && Path.GetExtension(input) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml; } private static ILogger ConfigureLoggerInstance(LogLevel loglevel) From b6dc6c9901ee900eb2d4622b0de62eb671026d19 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 7 Feb 2022 10:00:35 +0300 Subject: [PATCH 085/752] Update package version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 3e2b209b4..4b3054786 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -17,7 +17,7 @@ - + From 93af0640993b5528a5c50442c778160b468f9bb7 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 7 Feb 2022 17:23:47 +0300 Subject: [PATCH 086/752] Set Nuget properties to align with compliance guidelines during package publishing --- .../Microsoft.OpenApi.Hidi.csproj | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 9fe37bbc2..f9fd1e40d 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -3,11 +3,29 @@ Exe netcoreapp3.1 - 9.0 + 9.0 true + https://github.com/Microsoft/OpenAPI.NET + MIT + true + Microsoft + Microsoft + Microsoft.OpenApi.Hidi + Microsoft.OpenApi.Hidi hidi ./../../artifacts 0.5.0-preview3 + © Microsoft Corporation. All rights reserved. + OpenAPI .NET + https://github.com/Microsoft/OpenAPI.NET + +- Publish symbols. + + Microsoft.OpenApi.Hidi + Microsoft.OpenApi.Hidi + true + + true From c13db8e805a728b7e0f8850128238c39356ae015 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Tue, 8 Feb 2022 00:00:03 -0500 Subject: [PATCH 087/752] Updated version to preview4 --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index f9fd1e40d..a210a5c94 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -14,7 +14,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 0.5.0-preview3 + 0.5.0-preview4 © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET From fa5bc77ec25e103268864c725abfed67e18904de Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 8 Feb 2022 15:00:21 +0300 Subject: [PATCH 088/752] Add package icon and description --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index bd22e6361..70a39df3a 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -5,6 +5,7 @@ netcoreapp3.1 9.0 true + http://go.microsoft.com/fwlink/?LinkID=288890 https://github.com/Microsoft/OpenAPI.NET MIT true @@ -15,6 +16,7 @@ hidi ./../../artifacts 0.5.0-preview4 + OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET From be6cd2fe7e4b1c85b493faae811c846f753e0590 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sat, 12 Feb 2022 15:58:50 -0500 Subject: [PATCH 089/752] Fixed ValidateDocument method in hidi --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 70a39df3a..a4cb0aa1c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net5.0 9.0 true http://go.microsoft.com/fwlink/?LinkID=288890 diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 964329aaf..d7a4f4298 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -251,13 +251,13 @@ private static async Task GetStream(string input, ILogger logger) { try { - using var httpClientHandler = new HttpClientHandler() + var httpClientHandler = new HttpClientHandler() { SslProtocols = System.Security.Authentication.SslProtocols.Tls12, }; using var httpClient = new HttpClient(httpClientHandler) { - DefaultRequestVersion = HttpVersion.Version20 + DefaultRequestVersion = HttpVersion.Version20 }; stream = await httpClient.GetStreamAsync(input); } @@ -323,7 +323,7 @@ public static Dictionary> ParseJsonCollectionFile(Stream st return requestUrls; } - internal static async void ValidateOpenApiDocument(string openapi, LogLevel loglevel) + internal static async Task ValidateOpenApiDocument(string openapi, LogLevel loglevel) { if (string.IsNullOrEmpty(openapi)) { From d153a4aed0efc899b777a0fe87258c0b8fdc4a92 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 15 Feb 2022 18:28:47 +0300 Subject: [PATCH 090/752] Upgrade packages --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 70a39df3a..1a4131864 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -36,7 +36,7 @@ - + From 6428f235ebc10768a576ed06b0d80deccba7f0f4 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 16 Feb 2022 12:31:03 +0300 Subject: [PATCH 091/752] Update TFMs in project and workflow files --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 70a39df3a..95e61a394 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -2,7 +2,7 @@ Exe - netcoreapp3.1 + net6.0 9.0 true http://go.microsoft.com/fwlink/?LinkID=288890 From 40104e53f60a1704710c307516c79a6d7bb1d2fd Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sat, 19 Feb 2022 12:38:48 -0500 Subject: [PATCH 092/752] Added hostdocument to OpenApiReference --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 05b44c9c6..890327ddc 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -53,7 +53,7 @@ string filterByCollection var result = new OpenApiStreamReader(new OpenApiReaderSettings { - ReferenceResolution = inlineExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, + LoadExternalRefs = inlineExternal, RuleSet = ValidationRuleSet.GetDefaultRuleSet(), BaseUrl = new Uri(inputUrl.AbsoluteUri) } From 8e0879c9b93d8032f9b7d3e97aac99e08cb6d721 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sat, 19 Feb 2022 15:01:59 -0500 Subject: [PATCH 093/752] Missed these files --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 103 +------------------ src/Microsoft.OpenApi.Hidi/Program.cs | 22 ---- 2 files changed, 4 insertions(+), 121 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 7f51960d3..632042f38 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -34,14 +34,6 @@ public static async void ProcessOpenApiDocument( FileInfo output, OpenApiSpecVersion? version, OpenApiFormat? format, -<<<<<<< HEAD - bool inlineExternal, - bool inlineLocal, - string filterByOperationIds, - string filterByTags, - string filterByCollection - ) -======= LogLevel loglevel, bool inline, bool resolveexternal, @@ -49,7 +41,6 @@ string filterByCollection string filterbytags, string filterbycollection ) ->>>>>>> origin/vnext { var logger = ConfigureLoggerInstance(loglevel); @@ -95,18 +86,6 @@ string filterbycollection OpenApiFormat openApiFormat; var stopwatch = new Stopwatch(); -<<<<<<< HEAD - var inputUrl = GetInputUrl(input); - var stream = GetStream(inputUrl); - - OpenApiDocument document; - - var result = new OpenApiStreamReader(new OpenApiReaderSettings - { - LoadExternalRefs = inlineExternal, - RuleSet = ValidationRuleSet.GetDefaultRuleSet(), - BaseUrl = new Uri(inputUrl.AbsoluteUri) -======= if (!string.IsNullOrEmpty(csdl)) { // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion @@ -151,13 +130,8 @@ string filterbycollection openApiFormat = format ?? GetOpenApiFormat(openapi, logger); version ??= result.OpenApiDiagnostic.SpecificationVersion; ->>>>>>> origin/vnext } -<<<<<<< HEAD - document = result.OpenApiDocument; -======= ->>>>>>> origin/vnext Func predicate; // Check if filter options are provided, then slice the OpenAPI document @@ -178,15 +152,7 @@ string filterbycollection logger.LogTrace("Creating predicate based on the tags supplied."); predicate = OpenApiFilterService.CreatePredicate(tags: filterbytags); -<<<<<<< HEAD - if (!string.IsNullOrEmpty(filterByCollection)) - { - var fileStream = GetStream(GetInputUrl(filterByCollection)); - var requestUrls = ParseJsonCollectionFile(fileStream); - predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source:document); -======= logger.LogTrace("Creating subset OpenApi document."); ->>>>>>> origin/vnext document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } if (!string.IsNullOrEmpty(filterbycollection)) @@ -229,26 +195,6 @@ string filterbycollection textWriter.Flush(); } -<<<<<<< HEAD - private static Uri GetInputUrl(string input) - { - if (input.StartsWith("http")) - { - return new Uri(input); - } - else - { - return new Uri("file://" + Path.GetFullPath(input)); - } - } - - private static Stream GetStream(Uri input) - { - Stream stream; - if (input.Scheme == "http" || input.Scheme == "https") - { - var httpClient = new HttpClient(new HttpClientHandler() -======= /// /// Converts CSDL to OpenAPI /// @@ -303,10 +249,9 @@ private static async Task GetStream(string input, ILogger logger) stopwatch.Start(); Stream stream; - if (input.StartsWith("http")) + if (input.Scheme == "http" || input.Scheme == "https") { try ->>>>>>> origin/vnext { var httpClientHandler = new HttpClientHandler() { @@ -326,14 +271,6 @@ private static async Task GetStream(string input, ILogger logger) } else if (input.Scheme == "file") { -<<<<<<< HEAD - var fileInput = new FileInfo(input.AbsolutePath); - stream = fileInput.OpenRead(); - } - else - { - throw new ArgumentException("Unrecognized exception"); -======= try { var fileInput = new FileInfo(input); @@ -350,7 +287,6 @@ ex is SecurityException || logger.LogError($"Could not open the file at {input}, reason: {ex.Message}"); return null; } ->>>>>>> origin/vnext } stopwatch.Stop(); logger.LogTrace("{timestamp}ms: Read file {input}", stopwatch.ElapsedMilliseconds, input); @@ -389,31 +325,18 @@ public static Dictionary> ParseJsonCollectionFile(Stream st return requestUrls; } -<<<<<<< HEAD - internal static async Task ValidateOpenApiDocument(string input, bool resolveExternal) -======= internal static async Task ValidateOpenApiDocument(string openapi, LogLevel loglevel) ->>>>>>> origin/vnext { if (string.IsNullOrEmpty(openapi)) { throw new ArgumentNullException(nameof(openapi)); } -<<<<<<< HEAD - var inputUrl = GetInputUrl(input); - var stream = GetStream(GetInputUrl(input)); - - OpenApiDocument document; - - var result = await new OpenApiStreamReader(new OpenApiReaderSettings -======= var logger = ConfigureLoggerInstance(loglevel); var stream = await GetStream(openapi, logger); OpenApiDocument document; logger.LogTrace("Parsing the OpenApi file"); document = new OpenApiStreamReader(new OpenApiReaderSettings ->>>>>>> origin/vnext { ReferenceResolution = resolveExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, RuleSet = ValidationRuleSet.GetDefaultRuleSet(), @@ -432,30 +355,12 @@ internal static async Task ValidateOpenApiDocument(string openapi, LogLevel logl } } - if (document.Workspace == null) { - var statsVisitor = new StatsVisitor(); - var walker = new OpenApiWalker(statsVisitor); - walker.Walk(document); - Console.WriteLine(statsVisitor.GetStatisticsReport()); - } - else - { - foreach (var memberDocument in document.Workspace.Documents) - { - Console.WriteLine("Stats for " + memberDocument.Info.Title); - var statsVisitor = new StatsVisitor(); - var walker = new OpenApiWalker(statsVisitor); - walker.Walk(memberDocument); - Console.WriteLine(statsVisitor.GetStatisticsReport()); - } - } + var statsVisitor = new StatsVisitor(); + var walker = new OpenApiWalker(statsVisitor); + walker.Walk(document); -<<<<<<< HEAD - -======= logger.LogTrace("Finished walking through the OpenApi document. Generating a statistics report.."); Console.WriteLine(statsVisitor.GetStatisticsReport()); ->>>>>>> origin/vnext } private static OpenApiFormat GetOpenApiFormat(string input, ILogger logger) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index c078d7ba6..95e6f63f2 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -51,27 +51,6 @@ static async Task Main(string[] args) var validateCommand = new Command("validate") { -<<<<<<< HEAD - new Option("--input", "Input OpenAPI description file path or URL", typeof(string) ), - new Option("--resolveExternal","Resolve external $refs", typeof(bool)) - }; - validateCommand.Handler = CommandHandler.Create(OpenApiService.ValidateOpenApiDocument); - - var transformCommand = new Command("transform") - { - new Option("--input", "Input OpenAPI description file path or URL", typeof(string) ), - new Option("--output","Output OpenAPI description file", typeof(FileInfo), arity: ArgumentArity.ZeroOrOne), - new Option("--version", "OpenAPI specification version", typeof(OpenApiSpecVersion)), - new Option("--format", "File format",typeof(OpenApiFormat) ), - new Option("--inlineExternal", "Inline external $ref instances", typeof(bool) ), - new Option("--inlineLocal", "Inline local $ref instances", typeof(bool) ), - new Option("--filterByOperationIds", "Filters OpenApiDocument by OperationId(s) provided", typeof(string)), - new Option("--filterByTags", "Filters OpenApiDocument by Tag(s) provided", typeof(string)), - new Option("--filterByCollection", "Filters OpenApiDocument by Postman collection provided", typeof(string)) - }; - transformCommand.Handler = CommandHandler.Create( - OpenApiService.ProcessOpenApiDocument); -======= descriptionOption, logLevelOption }; @@ -95,7 +74,6 @@ static async Task Main(string[] args) transformCommand.SetHandler ( OpenApiService.ProcessOpenApiDocument, descriptionOption, csdlOption, outputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); ->>>>>>> origin/vnext rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); From b6f5928fc34c1adf353c02181fe7f4b3c1109863 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 21 Feb 2022 17:45:43 -0500 Subject: [PATCH 094/752] Updated referencable items to use GetEffective when inlining --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 20 ++++++++++---------- src/Microsoft.OpenApi.Hidi/Program.cs | 14 +++++++------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 632042f38..e813e72a4 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -28,15 +28,15 @@ namespace Microsoft.OpenApi.Hidi { public class OpenApiService { - public static async void ProcessOpenApiDocument( + public static async Task ProcessOpenApiDocument( string openapi, string csdl, FileInfo output, OpenApiSpecVersion? version, OpenApiFormat? format, LogLevel loglevel, - bool inline, - bool resolveexternal, + bool inlineLocal, + bool inlineExternal, string filterbyoperationids, string filterbytags, string filterbycollection @@ -104,8 +104,9 @@ string filterbycollection logger.LogTrace("Parsing OpenApi file"); var result = new OpenApiStreamReader(new OpenApiReaderSettings { - ReferenceResolution = resolveexternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, - RuleSet = ValidationRuleSet.GetDefaultRuleSet() + RuleSet = ValidationRuleSet.GetDefaultRuleSet(), + LoadExternalRefs = inlineExternal, + BaseUrl = openapi.StartsWith("http") ? new Uri(openapi) : new Uri("file:" + new FileInfo(openapi).DirectoryName + "\\") } ).ReadAsync(stream).GetAwaiter().GetResult(); @@ -249,7 +250,7 @@ private static async Task GetStream(string input, ILogger logger) stopwatch.Start(); Stream stream; - if (input.Scheme == "http" || input.Scheme == "https") + if (input.StartsWith("http")) { try { @@ -269,7 +270,7 @@ private static async Task GetStream(string input, ILogger logger) return null; } } - else if (input.Scheme == "file") + else { try { @@ -336,11 +337,10 @@ internal static async Task ValidateOpenApiDocument(string openapi, LogLevel logl OpenApiDocument document; logger.LogTrace("Parsing the OpenApi file"); - document = new OpenApiStreamReader(new OpenApiReaderSettings + var result = await new OpenApiStreamReader(new OpenApiReaderSettings { - ReferenceResolution = resolveExternal == true ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, RuleSet = ValidationRuleSet.GetDefaultRuleSet(), - BaseUrl = new Uri(inputUrl.AbsoluteUri) + BaseUrl = new Uri(openapi) } ).ReadAsync(stream); diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 95e6f63f2..309fa5360 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -43,11 +43,11 @@ static async Task Main(string[] args) var filterByCollectionOption = new Option("--filter-by-collection", "Filters OpenApiDocument by Postman collection provided"); filterByCollectionOption.AddAlias("-c"); - var inlineOption = new Option("--inline", "Inline $ref instances"); - inlineOption.AddAlias("-i"); + var inlineLocalOption = new Option("--inlineLocal", "Inline local $ref instances"); + inlineLocalOption.AddAlias("-il"); - var resolveExternalOption = new Option("--resolve-external", "Resolve external $refs"); - resolveExternalOption.AddAlias("-ex"); + var inlineExternalOption = new Option("--inlineExternal", "Inline external $ref instances"); + inlineExternalOption.AddAlias("-ie"); var validateCommand = new Command("validate") { @@ -68,12 +68,12 @@ static async Task Main(string[] args) filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption, - inlineOption, - resolveExternalOption, + inlineLocalOption, + inlineExternalOption }; transformCommand.SetHandler ( - OpenApiService.ProcessOpenApiDocument, descriptionOption, csdlOption, outputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); + OpenApiService.ProcessOpenApiDocument, descriptionOption, csdlOption, outputOption, versionOption, formatOption, logLevelOption, inlineLocalOption, inlineExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); From 0d0d56af59dcaf16ea739dec538c0ad75aee9037 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 21 Feb 2022 22:34:19 -0500 Subject: [PATCH 095/752] Removed redundant using --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index e813e72a4..fb785f9e1 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -12,7 +12,6 @@ using System.Text; using System.Threading.Tasks; using System.Text.Json; -using System.Threading.Tasks; using Microsoft.Extensions.Logging; using System.Xml.Linq; using Microsoft.OData.Edm.Csdl; From 61244f5730a8696759c95b0e4569379a489a60eb Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 28 Feb 2022 11:21:44 -0500 Subject: [PATCH 096/752] - upgrades odata conversion lib reference in hidi --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 6 +++--- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index ecd6f19f5..2c745fd70 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,13 +15,13 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 0.5.0-preview4 + 0.6.0-preview1 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET -- Publish symbols. +- Upgrades Microsoft.OpenApi.OData to 1.0.10-preview1 Microsoft.OpenApi.Hidi Microsoft.OpenApi.Hidi @@ -37,7 +37,7 @@ - + diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index d7a4f4298..730b8f894 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -206,8 +206,12 @@ public static OpenApiDocument ConvertCsdlToOpenApi(Stream csdl) var settings = new OpenApiConvertSettings() { + AddSingleQuotesForStringParameters = true, + AddEnumDescriptionExtension = true, + DeclarePathParametersOnPathItem = true, EnableKeyAsSegment = true, EnableOperationId = true, + ErrorResponsesAsDefault = false, PrefixEntityTypeNameBeforeKey = true, TagDepth = 2, EnablePagination = true, From 79d61db9bafbc928d798ddd6d782e3b5e343698a Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 28 Feb 2022 11:50:23 -0500 Subject: [PATCH 097/752] - fixes conversion tests and makes method async --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 6 +++--- .../Services/OpenApiServiceTests.cs | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 730b8f894..e04fa4f3c 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -92,7 +92,7 @@ string filterbycollection version ??= OpenApiSpecVersion.OpenApi3_0; stream = await GetStream(csdl, logger); - document = ConvertCsdlToOpenApi(stream); + document = await ConvertCsdlToOpenApi(stream); } else { @@ -198,10 +198,10 @@ string filterbycollection /// /// The CSDL stream. /// An OpenAPI document. - public static OpenApiDocument ConvertCsdlToOpenApi(Stream csdl) + public static async Task ConvertCsdlToOpenApi(Stream csdl) { using var reader = new StreamReader(csdl); - var csdlText = reader.ReadToEndAsync().GetAwaiter().GetResult(); + var csdlText = await reader.ReadToEndAsync(); var edmModel = CsdlReader.Parse(XElement.Parse(csdlText).CreateReader()); var settings = new OpenApiConvertSettings() diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs index 1b94a3557..1c9fd003b 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs @@ -3,6 +3,7 @@ using System; using System.IO; +using System.Threading.Tasks; using Microsoft.OpenApi.Hidi; using Microsoft.OpenApi.Services; using Xunit; @@ -12,7 +13,7 @@ namespace Microsoft.OpenApi.Tests.Services public class OpenApiServiceTests { [Fact] - public void ReturnConvertedCSDLFile() + public async Task ReturnConvertedCSDLFile() { // Arrange var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml"); @@ -20,20 +21,20 @@ public void ReturnConvertedCSDLFile() var csdlStream = fileInput.OpenRead(); // Act - var openApiDoc = OpenApiService.ConvertCsdlToOpenApi(csdlStream); - var expectedPathCount = 5; + var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream); + var expectedPathCount = 6; // Assert Assert.NotNull(openApiDoc); Assert.NotEmpty(openApiDoc.Paths); - Assert.Equal(openApiDoc.Paths.Count, expectedPathCount); + Assert.Equal(expectedPathCount, openApiDoc.Paths.Count); } [Theory] [InlineData("Todos.Todo.UpdateTodo",null, 1)] [InlineData("Todos.Todo.ListTodo",null, 1)] [InlineData(null, "Todos.Todo", 4)] - public void ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount) + public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount) { // Arrange var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml"); @@ -41,7 +42,7 @@ public void ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(stri var csdlStream = fileInput.OpenRead(); // Act - var openApiDoc = OpenApiService.ConvertCsdlToOpenApi(csdlStream); + var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream); var predicate = OpenApiFilterService.CreatePredicate(operationIds, tags); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(openApiDoc, predicate); From b0d94b16c92af8b16f26a972055cfd4f8486df2b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 28 Feb 2022 16:01:14 -0500 Subject: [PATCH 098/752] - fixes an issue where hidi would not process async --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 1 + src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 2c745fd70..cd8d14132 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -22,6 +22,7 @@ https://github.com/Microsoft/OpenAPI.NET - Upgrades Microsoft.OpenApi.OData to 1.0.10-preview1 +- Fixes an issue where hidi would not process async operations Microsoft.OpenApi.Hidi Microsoft.OpenApi.Hidi diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index e04fa4f3c..1f86e3c06 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -27,7 +27,7 @@ namespace Microsoft.OpenApi.Hidi { public class OpenApiService { - public static async void ProcessOpenApiDocument( + public static async Task ProcessOpenApiDocument( string openapi, string csdl, FileInfo output, From 47d34d2d9681b9af480c570e460ca704edf4dd05 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 28 Feb 2022 19:20:45 -0500 Subject: [PATCH 099/752] Updated versions to preview5 --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index cd8d14132..ff203cf5d 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 0.6.0-preview1 + 0.5.0-preview5 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From d0200ff9b8934dd3488e866e700af4eb3262840c Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 3 Mar 2022 18:58:39 +0300 Subject: [PATCH 100/752] Update cmd parameter to accept string values for OpenApi spec version --- src/Microsoft.OpenApi.Hidi/Program.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 95e6f63f2..4fed0cb44 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -25,7 +25,7 @@ static async Task Main(string[] args) var outputOption = new Option("--output", () => new FileInfo("./output"), "The output directory path for the generated file.") { Arity = ArgumentArity.ZeroOrOne }; outputOption.AddAlias("-o"); - var versionOption = new Option("--version", "OpenAPI specification version"); + var versionOption = new Option("--version", "OpenAPI specification version"); versionOption.AddAlias("-v"); var formatOption = new Option("--format", "File format"); @@ -72,7 +72,7 @@ static async Task Main(string[] args) resolveExternalOption, }; - transformCommand.SetHandler ( + transformCommand.SetHandler ( OpenApiService.ProcessOpenApiDocument, descriptionOption, csdlOption, outputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); rootCommand.Add(transformCommand); From b9b75608d35f7ae2d28fbc4267d91b5e3b398fd9 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 3 Mar 2022 19:00:54 +0300 Subject: [PATCH 101/752] Cast string to OpenApiSpecVersion enum value --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 12 ++++--- .../OpenApiSpecVersionExtension.cs | 31 +++++++++++++++++++ 2 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionExtension.cs diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 1f86e3c06..77ddd08c0 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -22,6 +22,7 @@ using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Validations; using Microsoft.OpenApi.Writers; +using static Microsoft.OpenApi.Hidi.OpenApiSpecVersionExtension; namespace Microsoft.OpenApi.Hidi { @@ -31,7 +32,7 @@ public static async Task ProcessOpenApiDocument( string openapi, string csdl, FileInfo output, - OpenApiSpecVersion? version, + string? version, OpenApiFormat? format, LogLevel loglevel, bool inline, @@ -83,13 +84,14 @@ string filterbycollection Stream stream; OpenApiDocument document; OpenApiFormat openApiFormat; + OpenApiSpecVersion? openApiVersion = null; var stopwatch = new Stopwatch(); if (!string.IsNullOrEmpty(csdl)) { // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion openApiFormat = format ?? GetOpenApiFormat(csdl, logger); - version ??= OpenApiSpecVersion.OpenApi3_0; + openApiVersion = version.TryParseOpenApiSpecVersion(); stream = await GetStream(csdl, logger); document = await ConvertCsdlToOpenApi(stream); @@ -128,7 +130,7 @@ string filterbycollection } openApiFormat = format ?? GetOpenApiFormat(openapi, logger); - version ??= result.OpenApiDiagnostic.SpecificationVersion; + openApiVersion ??= result.OpenApiDiagnostic.SpecificationVersion; } Func predicate; @@ -185,14 +187,14 @@ string filterbycollection logger.LogTrace("Serializing to OpenApi document using the provided spec version and writer"); stopwatch.Start(); - document.Serialize(writer, (OpenApiSpecVersion)version); + document.Serialize(writer, (OpenApiSpecVersion)openApiVersion); stopwatch.Stop(); logger.LogTrace($"Finished serializing in {stopwatch.ElapsedMilliseconds}ms"); textWriter.Flush(); } - + /// /// Converts CSDL to OpenAPI /// diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionExtension.cs b/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionExtension.cs new file mode 100644 index 000000000..9b877099e --- /dev/null +++ b/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionExtension.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System; +using System.Linq; + +namespace Microsoft.OpenApi.Hidi +{ + public static class OpenApiSpecVersionExtension + { + public static OpenApiSpecVersion TryParseOpenApiSpecVersion(this string value) + { + if (string.IsNullOrEmpty(value)) + { + throw new InvalidOperationException("Please provide a version"); + } + var res = value.Split('.', StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(); + + if (int.TryParse(res, out int result)) + { + + if (result >= 2 || result <= 3) + { + return (OpenApiSpecVersion)result; + } + } + + return OpenApiSpecVersion.OpenApi3_0; // default + } + } +} From 35514ece216191eab9d56e60640083766b3ac8cd Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 3 Mar 2022 13:09:29 -0500 Subject: [PATCH 102/752] - bumps reference to openapi.odata --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index ff203cf5d..e33f4777e 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From df797187e48b7fc092a74a9d30767f13efc3cbc9 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 7 Mar 2022 12:06:25 +0300 Subject: [PATCH 103/752] Refactor logic to accept a string as a regular param and rename the extension class --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 ++-- ...rsionExtension.cs => OpenApiSpecVersionHelper.cs} | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) rename src/Microsoft.OpenApi.Hidi/{OpenApiSpecVersionExtension.cs => OpenApiSpecVersionHelper.cs} (76%) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 77ddd08c0..952dc0b94 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -22,7 +22,7 @@ using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Validations; using Microsoft.OpenApi.Writers; -using static Microsoft.OpenApi.Hidi.OpenApiSpecVersionExtension; +using static Microsoft.OpenApi.Hidi.OpenApiSpecVersionHelper; namespace Microsoft.OpenApi.Hidi { @@ -91,7 +91,7 @@ string filterbycollection { // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion openApiFormat = format ?? GetOpenApiFormat(csdl, logger); - openApiVersion = version.TryParseOpenApiSpecVersion(); + openApiVersion = TryParseOpenApiSpecVersion(version); stream = await GetStream(csdl, logger); document = await ConvertCsdlToOpenApi(stream); diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionExtension.cs b/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs similarity index 76% rename from src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionExtension.cs rename to src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs index 9b877099e..a78255be2 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionExtension.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs @@ -6,24 +6,24 @@ namespace Microsoft.OpenApi.Hidi { - public static class OpenApiSpecVersionExtension + public static class OpenApiSpecVersionHelper { - public static OpenApiSpecVersion TryParseOpenApiSpecVersion(this string value) + public static OpenApiSpecVersion TryParseOpenApiSpecVersion(string value) { if (string.IsNullOrEmpty(value)) { throw new InvalidOperationException("Please provide a version"); } var res = value.Split('.', StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(); - + if (int.TryParse(res, out int result)) { - if (result >= 2 || result <= 3) + if (result >= 2 && result < 3) { - return (OpenApiSpecVersion)result; + return OpenApiSpecVersion.OpenApi2_0; } - } + } return OpenApiSpecVersion.OpenApi3_0; // default } From c356b1f5ec4448fb5d5c5ee34767ae2eb728423d Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 8 Mar 2022 14:55:49 +0300 Subject: [PATCH 104/752] Better error handling --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 58 ++++++++++++++------ src/Microsoft.OpenApi.Hidi/Program.cs | 5 +- 2 files changed, 43 insertions(+), 20 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 1f86e3c06..def1afb60 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -22,6 +22,7 @@ using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Validations; using Microsoft.OpenApi.Writers; +using System.Threading; namespace Microsoft.OpenApi.Hidi { @@ -38,7 +39,8 @@ public static async Task ProcessOpenApiDocument( bool resolveexternal, string filterbyoperationids, string filterbytags, - string filterbycollection + string filterbycollection, + CancellationToken cancellationToken ) { var logger = ConfigureLoggerInstance(loglevel); @@ -52,7 +54,11 @@ string filterbycollection } catch (ArgumentNullException ex) { - logger.LogError(ex.Message); +#if DEBUG + logger.LogCritical(ex, ex.Message); +#else + logger.LogCritical(ex.Message); +#endif return; } try @@ -64,19 +70,27 @@ string filterbycollection } catch (ArgumentException ex) { - logger.LogError(ex.Message); +#if DEBUG + logger.LogCritical(ex, ex.Message); +#else + logger.LogCritical(ex.Message); +#endif return; } try { if (output.Exists) { - throw new IOException("The file you're writing to already exists. Please input a new file path."); + throw new IOException($"The file {output} already exists. Please input a new file path."); } } catch (IOException ex) { - logger.LogError(ex.Message); +#if DEBUG + logger.LogCritical(ex, ex.Message); +#else + logger.LogCritical(ex.Message); +#endif return; } @@ -91,12 +105,12 @@ string filterbycollection openApiFormat = format ?? GetOpenApiFormat(csdl, logger); version ??= OpenApiSpecVersion.OpenApi3_0; - stream = await GetStream(csdl, logger); + stream = await GetStream(csdl, logger, cancellationToken); document = await ConvertCsdlToOpenApi(stream); } else { - stream = await GetStream(openapi, logger); + stream = await GetStream(openapi, logger, cancellationToken); // Parsing OpenAPI file stopwatch.Start(); @@ -156,7 +170,7 @@ string filterbycollection } if (!string.IsNullOrEmpty(filterbycollection)) { - var fileStream = await GetStream(filterbycollection, logger); + var fileStream = await GetStream(filterbycollection, logger, cancellationToken); var requestUrls = ParseJsonCollectionFile(fileStream, logger); logger.LogTrace("Creating predicate based on the paths and Http methods defined in the Postman collection."); @@ -245,7 +259,7 @@ public static OpenApiDocument FixReferences(OpenApiDocument document) return doc; } - private static async Task GetStream(string input, ILogger logger) + private static async Task GetStream(string input, ILogger logger, CancellationToken cancellationToken) { var stopwatch = new Stopwatch(); stopwatch.Start(); @@ -263,11 +277,15 @@ private static async Task GetStream(string input, ILogger logger) { DefaultRequestVersion = HttpVersion.Version20 }; - stream = await httpClient.GetStreamAsync(input); + stream = await httpClient.GetStreamAsync(input, cancellationToken); } catch (HttpRequestException ex) { - logger.LogError($"Could not download the file at {input}, reason{ex}"); +#if DEBUG + logger.LogCritical(ex, $"Could not download the file at {input}, reason: {ex.Message}"); +#else + logger.LogCritical($"Could not download the file at {input}, reason: {ex.Message}", input, ex.Message); +#endif return null; } } @@ -286,7 +304,11 @@ ex is UnauthorizedAccessException || ex is SecurityException || ex is NotSupportedException) { - logger.LogError($"Could not open the file at {input}, reason: {ex.Message}"); +#if DEBUG + logger.LogCritical(ex, $"Could not open the file at {input}, reason: {ex.Message}"); +#else + logger.LogCritical($"Could not open the file at {input}, reason: {ex.Message}"); +#endif return null; } } @@ -327,14 +349,14 @@ public static Dictionary> ParseJsonCollectionFile(Stream st return requestUrls; } - internal static async Task ValidateOpenApiDocument(string openapi, LogLevel loglevel) + internal static async Task ValidateOpenApiDocument(string openapi, LogLevel loglevel, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(openapi)) { throw new ArgumentNullException(nameof(openapi)); } var logger = ConfigureLoggerInstance(loglevel); - var stream = await GetStream(openapi, logger); + var stream = await GetStream(openapi, logger, cancellationToken); OpenApiDocument document; logger.LogTrace("Parsing the OpenApi file"); @@ -369,16 +391,16 @@ private static OpenApiFormat GetOpenApiFormat(string input, ILogger logger) private static ILogger ConfigureLoggerInstance(LogLevel loglevel) { // Configure logger options - #if DEBUG +#if DEBUG loglevel = loglevel > LogLevel.Debug ? LogLevel.Debug : loglevel; - #endif +#endif var logger = LoggerFactory.Create((builder) => { builder .AddConsole() - #if DEBUG +#if DEBUG .AddDebug() - #endif +#endif .SetMinimumLevel(loglevel); }).CreateLogger(); diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 95e6f63f2..f3d455e4a 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -3,6 +3,7 @@ using System.CommandLine; using System.IO; +using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; @@ -55,7 +56,7 @@ static async Task Main(string[] args) logLevelOption }; - validateCommand.SetHandler(OpenApiService.ValidateOpenApiDocument, descriptionOption, logLevelOption); + validateCommand.SetHandler(OpenApiService.ValidateOpenApiDocument, descriptionOption, logLevelOption); var transformCommand = new Command("transform") { @@ -72,7 +73,7 @@ static async Task Main(string[] args) resolveExternalOption, }; - transformCommand.SetHandler ( + transformCommand.SetHandler ( OpenApiService.ProcessOpenApiDocument, descriptionOption, csdlOption, outputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); rootCommand.Add(transformCommand); From c7dc0d676e27a50647a44b6fcbedd6de05d11121 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 8 Mar 2022 16:43:02 +0300 Subject: [PATCH 105/752] Remove string interpolation --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index def1afb60..7b94c4997 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -128,10 +128,13 @@ CancellationToken cancellationToken var context = result.OpenApiDiagnostic; if (context.Errors.Count > 0) { + logger.LogTrace("{timestamp}ms: Parsed OpenAPI with errors. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count); + var errorReport = new StringBuilder(); foreach (var error in context.Errors) { + logger.LogError("OpenApi Parsing error: {message}", error.ToString()); errorReport.AppendLine(error.ToString()); } logger.LogError($"{stopwatch.ElapsedMilliseconds}ms: OpenApi Parsing errors {string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())}"); @@ -282,9 +285,9 @@ private static async Task GetStream(string input, ILogger logger, Cancel catch (HttpRequestException ex) { #if DEBUG - logger.LogCritical(ex, $"Could not download the file at {input}, reason: {ex.Message}"); + logger.LogCritical(ex, "Could not download the file at {inputPath}, reason: {exMessage}", input, ex.Message); #else - logger.LogCritical($"Could not download the file at {input}, reason: {ex.Message}", input, ex.Message); + logger.LogCritical( "Could not download the file at {inputPath}, reason: {exMessage}", input, ex.Message); #endif return null; } @@ -305,9 +308,9 @@ ex is SecurityException || ex is NotSupportedException) { #if DEBUG - logger.LogCritical(ex, $"Could not open the file at {input}, reason: {ex.Message}"); + logger.LogCritical(ex, "Could not open the file at {inputPath}, reason: {exMessage}", input, ex.Message); #else - logger.LogCritical($"Could not open the file at {input}, reason: {ex.Message}"); + logger.LogCritical("Could not open the file at {inputPath}, reason: {exMessage}", input, ex.Message); #endif return null; } From 3174b8e8065fadb4382854deb18b5b50495cc8d7 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 8 Mar 2022 16:54:37 +0300 Subject: [PATCH 106/752] Add a try catch block to catch any exceptions thrown during document validation --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 56 ++++++++++++-------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 7b94c4997..64c228387 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -354,35 +354,49 @@ public static Dictionary> ParseJsonCollectionFile(Stream st internal static async Task ValidateOpenApiDocument(string openapi, LogLevel loglevel, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(openapi)) - { - throw new ArgumentNullException(nameof(openapi)); - } var logger = ConfigureLoggerInstance(loglevel); - var stream = await GetStream(openapi, logger, cancellationToken); - OpenApiDocument document; - logger.LogTrace("Parsing the OpenApi file"); - document = new OpenApiStreamReader(new OpenApiReaderSettings + try { - RuleSet = ValidationRuleSet.GetDefaultRuleSet() - } - ).Read(stream, out var context); + if (string.IsNullOrEmpty(openapi)) + { + throw new ArgumentNullException(nameof(openapi)); + } + var stream = await GetStream(openapi, logger, cancellationToken); - if (context.Errors.Count != 0) - { - foreach (var error in context.Errors) + OpenApiDocument document; + logger.LogTrace("Parsing the OpenApi file"); + document = new OpenApiStreamReader(new OpenApiReaderSettings { - Console.WriteLine(error.ToString()); + RuleSet = ValidationRuleSet.GetDefaultRuleSet() + } + ).Read(stream, out var context); + + if (context.Errors.Count != 0) + { + foreach (var error in context.Errors) + { + logger.LogError("OpenApi Parsing error: {message}", error.ToString()); + Console.WriteLine(error.ToString()); + } } - } - var statsVisitor = new StatsVisitor(); - var walker = new OpenApiWalker(statsVisitor); - walker.Walk(document); + var statsVisitor = new StatsVisitor(); + var walker = new OpenApiWalker(statsVisitor); + walker.Walk(document); + + logger.LogTrace("Finished walking through the OpenApi document. Generating a statistics report.."); + Console.WriteLine(statsVisitor.GetStatisticsReport()); + } + catch(Exception ex) + { +#if DEBUG + logger.LogCritical(ex, ex.Message); +#else + logger.LogCritical(ex.Message); +#endif + } - logger.LogTrace("Finished walking through the OpenApi document. Generating a statistics report.."); - Console.WriteLine(statsVisitor.GetStatisticsReport()); } private static OpenApiFormat GetOpenApiFormat(string input, ILogger logger) From 6aba425a7b559047110c5e6d1e256c9d35f2051a Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 8 Mar 2022 17:49:47 +0300 Subject: [PATCH 107/752] Clean up code --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 30 ++------------------ 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 64c228387..09ad21d90 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -49,42 +49,18 @@ CancellationToken cancellationToken { if (string.IsNullOrEmpty(openapi) && string.IsNullOrEmpty(csdl)) { - throw new ArgumentNullException("Please input a file path"); + throw new ArgumentException("Please input a file path"); } - } - catch (ArgumentNullException ex) - { -#if DEBUG - logger.LogCritical(ex, ex.Message); -#else - logger.LogCritical(ex.Message); -#endif - return; - } - try - { if(output == null) { - throw new ArgumentException(nameof(output)); + throw new ArgumentNullException(nameof(output)); } - } - catch (ArgumentException ex) - { -#if DEBUG - logger.LogCritical(ex, ex.Message); -#else - logger.LogCritical(ex.Message); -#endif - return; - } - try - { if (output.Exists) { throw new IOException($"The file {output} already exists. Please input a new file path."); } } - catch (IOException ex) + catch (Exception ex) { #if DEBUG logger.LogCritical(ex, ex.Message); From 2d8bd0fbc9993de52d5601f1dcb5801ce0a55d3c Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 8 Mar 2022 20:47:58 +0300 Subject: [PATCH 108/752] Add a --clean-output parameter for overwriting existing files --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 5 +++++ src/Microsoft.OpenApi.Hidi/Program.cs | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 1f86e3c06..9e50debf2 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -31,6 +31,7 @@ public static async Task ProcessOpenApiDocument( string openapi, string csdl, FileInfo output, + bool cleanoutput, OpenApiSpecVersion? version, OpenApiFormat? format, LogLevel loglevel, @@ -69,6 +70,10 @@ string filterbycollection } try { + if (cleanoutput) + { + output.Delete(); + } if (output.Exists) { throw new IOException("The file you're writing to already exists. Please input a new file path."); diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 95e6f63f2..960031ded 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -25,6 +25,9 @@ static async Task Main(string[] args) var outputOption = new Option("--output", () => new FileInfo("./output"), "The output directory path for the generated file.") { Arity = ArgumentArity.ZeroOrOne }; outputOption.AddAlias("-o"); + var cleanOutputOption = new Option("--clean-output", "Overwrite an existing file"); + cleanOutputOption.AddAlias("-co"); + var versionOption = new Option("--version", "OpenAPI specification version"); versionOption.AddAlias("-v"); @@ -62,6 +65,7 @@ static async Task Main(string[] args) descriptionOption, csdlOption, outputOption, + cleanOutputOption, versionOption, formatOption, logLevelOption, @@ -72,8 +76,8 @@ static async Task Main(string[] args) resolveExternalOption, }; - transformCommand.SetHandler ( - OpenApiService.ProcessOpenApiDocument, descriptionOption, csdlOption, outputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); + transformCommand.SetHandler ( + OpenApiService.ProcessOpenApiDocument, descriptionOption, csdlOption, outputOption, cleanOutputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); From 6fae4210dc7e24b5ac366b19b8e5efabf73fa0b9 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 8 Mar 2022 21:03:34 +0300 Subject: [PATCH 109/752] Add an exit statement and use logger to log errors to the console --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 09ad21d90..ec53b615f 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -353,7 +353,6 @@ internal static async Task ValidateOpenApiDocument(string openapi, LogLevel logl foreach (var error in context.Errors) { logger.LogError("OpenApi Parsing error: {message}", error.ToString()); - Console.WriteLine(error.ToString()); } } @@ -362,7 +361,7 @@ internal static async Task ValidateOpenApiDocument(string openapi, LogLevel logl walker.Walk(document); logger.LogTrace("Finished walking through the OpenApi document. Generating a statistics report.."); - Console.WriteLine(statsVisitor.GetStatisticsReport()); + logger.LogInformation(statsVisitor.GetStatisticsReport()); } catch(Exception ex) { @@ -371,6 +370,7 @@ internal static async Task ValidateOpenApiDocument(string openapi, LogLevel logl #else logger.LogCritical(ex.Message); #endif + return; } } From 18f2ef465afb0ec85814c072dc2309d32cff6fa9 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 8 Mar 2022 21:32:17 +0300 Subject: [PATCH 110/752] Clean up code to bubble up exceptions to the global catch block --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 216 +++++++++---------- 1 file changed, 103 insertions(+), 113 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index ec53b615f..11fe6decc 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -59,131 +59,131 @@ CancellationToken cancellationToken { throw new IOException($"The file {output} already exists. Please input a new file path."); } - } - catch (Exception ex) - { -#if DEBUG - logger.LogCritical(ex, ex.Message); -#else - logger.LogCritical(ex.Message); -#endif - return; - } - Stream stream; - OpenApiDocument document; - OpenApiFormat openApiFormat; - var stopwatch = new Stopwatch(); - - if (!string.IsNullOrEmpty(csdl)) - { - // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion - openApiFormat = format ?? GetOpenApiFormat(csdl, logger); - version ??= OpenApiSpecVersion.OpenApi3_0; - - stream = await GetStream(csdl, logger, cancellationToken); - document = await ConvertCsdlToOpenApi(stream); - } - else - { - stream = await GetStream(openapi, logger, cancellationToken); + Stream stream; + OpenApiDocument document; + OpenApiFormat openApiFormat; + var stopwatch = new Stopwatch(); - // Parsing OpenAPI file - stopwatch.Start(); - logger.LogTrace("Parsing OpenApi file"); - var result = new OpenApiStreamReader(new OpenApiReaderSettings + if (!string.IsNullOrEmpty(csdl)) { - ReferenceResolution = resolveexternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, - RuleSet = ValidationRuleSet.GetDefaultRuleSet() + // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion + openApiFormat = format ?? GetOpenApiFormat(csdl, logger); + version ??= OpenApiSpecVersion.OpenApi3_0; + + stream = await GetStream(csdl, logger, cancellationToken); + document = await ConvertCsdlToOpenApi(stream); } - ).ReadAsync(stream).GetAwaiter().GetResult(); + else + { + stream = await GetStream(openapi, logger, cancellationToken); - document = result.OpenApiDocument; - stopwatch.Stop(); + // Parsing OpenAPI file + stopwatch.Start(); + logger.LogTrace("Parsing OpenApi file"); + var result = new OpenApiStreamReader(new OpenApiReaderSettings + { + ReferenceResolution = resolveexternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, + RuleSet = ValidationRuleSet.GetDefaultRuleSet() + } + ).ReadAsync(stream).GetAwaiter().GetResult(); - var context = result.OpenApiDiagnostic; - if (context.Errors.Count > 0) - { - logger.LogTrace("{timestamp}ms: Parsed OpenAPI with errors. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count); + document = result.OpenApiDocument; + stopwatch.Stop(); - var errorReport = new StringBuilder(); + var context = result.OpenApiDiagnostic; + if (context.Errors.Count > 0) + { + logger.LogTrace("{timestamp}ms: Parsed OpenAPI with errors. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count); - foreach (var error in context.Errors) + var errorReport = new StringBuilder(); + + foreach (var error in context.Errors) + { + logger.LogError("OpenApi Parsing error: {message}", error.ToString()); + errorReport.AppendLine(error.ToString()); + } + logger.LogError($"{stopwatch.ElapsedMilliseconds}ms: OpenApi Parsing errors {string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())}"); + } + else { - logger.LogError("OpenApi Parsing error: {message}", error.ToString()); - errorReport.AppendLine(error.ToString()); + logger.LogTrace("{timestamp}ms: Parsed OpenApi successfully. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } - logger.LogError($"{stopwatch.ElapsedMilliseconds}ms: OpenApi Parsing errors {string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())}"); + + openApiFormat = format ?? GetOpenApiFormat(openapi, logger); + version ??= result.OpenApiDiagnostic.SpecificationVersion; } - else + + Func predicate; + + // Check if filter options are provided, then slice the OpenAPI document + if (!string.IsNullOrEmpty(filterbyoperationids) && !string.IsNullOrEmpty(filterbytags)) { - logger.LogTrace("{timestamp}ms: Parsed OpenApi successfully. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count); + throw new InvalidOperationException("Cannot filter by operationIds and tags at the same time."); } + if (!string.IsNullOrEmpty(filterbyoperationids)) + { + logger.LogTrace("Creating predicate based on the operationIds supplied."); + predicate = OpenApiFilterService.CreatePredicate(operationIds: filterbyoperationids); - openApiFormat = format ?? GetOpenApiFormat(openapi, logger); - version ??= result.OpenApiDiagnostic.SpecificationVersion; - } - - Func predicate; + logger.LogTrace("Creating subset OpenApi document."); + document = OpenApiFilterService.CreateFilteredDocument(document, predicate); + } + if (!string.IsNullOrEmpty(filterbytags)) + { + logger.LogTrace("Creating predicate based on the tags supplied."); + predicate = OpenApiFilterService.CreatePredicate(tags: filterbytags); - // Check if filter options are provided, then slice the OpenAPI document - if (!string.IsNullOrEmpty(filterbyoperationids) && !string.IsNullOrEmpty(filterbytags)) - { - throw new InvalidOperationException("Cannot filter by operationIds and tags at the same time."); - } - if (!string.IsNullOrEmpty(filterbyoperationids)) - { - logger.LogTrace("Creating predicate based on the operationIds supplied."); - predicate = OpenApiFilterService.CreatePredicate(operationIds: filterbyoperationids); + logger.LogTrace("Creating subset OpenApi document."); + document = OpenApiFilterService.CreateFilteredDocument(document, predicate); + } + if (!string.IsNullOrEmpty(filterbycollection)) + { + var fileStream = await GetStream(filterbycollection, logger, cancellationToken); + var requestUrls = ParseJsonCollectionFile(fileStream, logger); - logger.LogTrace("Creating subset OpenApi document."); - document = OpenApiFilterService.CreateFilteredDocument(document, predicate); - } - if (!string.IsNullOrEmpty(filterbytags)) - { - logger.LogTrace("Creating predicate based on the tags supplied."); - predicate = OpenApiFilterService.CreatePredicate(tags: filterbytags); + logger.LogTrace("Creating predicate based on the paths and Http methods defined in the Postman collection."); + predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: document); - logger.LogTrace("Creating subset OpenApi document."); - document = OpenApiFilterService.CreateFilteredDocument(document, predicate); - } - if (!string.IsNullOrEmpty(filterbycollection)) - { - var fileStream = await GetStream(filterbycollection, logger, cancellationToken); - var requestUrls = ParseJsonCollectionFile(fileStream, logger); + logger.LogTrace("Creating subset OpenApi document."); + document = OpenApiFilterService.CreateFilteredDocument(document, predicate); + } - logger.LogTrace("Creating predicate based on the paths and Http methods defined in the Postman collection."); - predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source:document); + logger.LogTrace("Creating a new file"); + using var outputStream = output?.Create(); + var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; - logger.LogTrace("Creating subset OpenApi document."); - document = OpenApiFilterService.CreateFilteredDocument(document, predicate); - } - - logger.LogTrace("Creating a new file"); - using var outputStream = output?.Create(); - var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; + var settings = new OpenApiWriterSettings() + { + ReferenceInline = inline ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences + }; - var settings = new OpenApiWriterSettings() - { - ReferenceInline = inline ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences - }; + IOpenApiWriter writer = openApiFormat switch + { + OpenApiFormat.Json => new OpenApiJsonWriter(textWriter, settings), + OpenApiFormat.Yaml => new OpenApiYamlWriter(textWriter, settings), + _ => throw new ArgumentException("Unknown format"), + }; - IOpenApiWriter writer = openApiFormat switch - { - OpenApiFormat.Json => new OpenApiJsonWriter(textWriter, settings), - OpenApiFormat.Yaml => new OpenApiYamlWriter(textWriter, settings), - _ => throw new ArgumentException("Unknown format"), - }; + logger.LogTrace("Serializing to OpenApi document using the provided spec version and writer"); - logger.LogTrace("Serializing to OpenApi document using the provided spec version and writer"); - - stopwatch.Start(); - document.Serialize(writer, (OpenApiSpecVersion)version); - stopwatch.Stop(); + stopwatch.Start(); + document.Serialize(writer, (OpenApiSpecVersion)version); + stopwatch.Stop(); - logger.LogTrace($"Finished serializing in {stopwatch.ElapsedMilliseconds}ms"); + logger.LogTrace($"Finished serializing in {stopwatch.ElapsedMilliseconds}ms"); - textWriter.Flush(); + textWriter.Flush(); + } + catch (Exception ex) + { +#if DEBUG + logger.LogCritical(ex, ex.Message); +#else + logger.LogCritical(ex.Message); +#endif + return; + } } /// @@ -260,12 +260,7 @@ private static async Task GetStream(string input, ILogger logger, Cancel } catch (HttpRequestException ex) { -#if DEBUG - logger.LogCritical(ex, "Could not download the file at {inputPath}, reason: {exMessage}", input, ex.Message); -#else - logger.LogCritical( "Could not download the file at {inputPath}, reason: {exMessage}", input, ex.Message); -#endif - return null; + throw new InvalidOperationException($"Could not download the file at {input}", ex); } } else @@ -283,12 +278,7 @@ ex is UnauthorizedAccessException || ex is SecurityException || ex is NotSupportedException) { -#if DEBUG - logger.LogCritical(ex, "Could not open the file at {inputPath}, reason: {exMessage}", input, ex.Message); -#else - logger.LogCritical("Could not open the file at {inputPath}, reason: {exMessage}", input, ex.Message); -#endif - return null; + throw new InvalidOperationException($"Could not open the file at {input}", ex); } } stopwatch.Stop(); From e37465c9e00a04fa25c45f825b9d280e97ba96b4 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 8 Mar 2022 22:21:04 +0300 Subject: [PATCH 111/752] Add exit codes for process termination handling --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 11fe6decc..2cf1b01ad 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -28,7 +28,7 @@ namespace Microsoft.OpenApi.Hidi { public class OpenApiService { - public static async Task ProcessOpenApiDocument( + public static async Task ProcessOpenApiDocument( string openapi, string csdl, FileInfo output, @@ -174,6 +174,8 @@ CancellationToken cancellationToken logger.LogTrace($"Finished serializing in {stopwatch.ElapsedMilliseconds}ms"); textWriter.Flush(); + + return 0; } catch (Exception ex) { @@ -182,7 +184,7 @@ CancellationToken cancellationToken #else logger.LogCritical(ex.Message); #endif - return; + return 1; } } @@ -318,7 +320,7 @@ public static Dictionary> ParseJsonCollectionFile(Stream st return requestUrls; } - internal static async Task ValidateOpenApiDocument(string openapi, LogLevel loglevel, CancellationToken cancellationToken) + internal static async Task ValidateOpenApiDocument(string openapi, LogLevel loglevel, CancellationToken cancellationToken) { var logger = ConfigureLoggerInstance(loglevel); @@ -352,6 +354,8 @@ internal static async Task ValidateOpenApiDocument(string openapi, LogLevel logl logger.LogTrace("Finished walking through the OpenApi document. Generating a statistics report.."); logger.LogInformation(statsVisitor.GetStatisticsReport()); + + return 0; } catch(Exception ex) { @@ -360,7 +364,7 @@ internal static async Task ValidateOpenApiDocument(string openapi, LogLevel logl #else logger.LogCritical(ex.Message); #endif - return; + return 1; } } From 4e2ef30e45710d63b0499a7af4e2ea5ebe71dfdf Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Wed, 9 Mar 2022 00:16:49 -0500 Subject: [PATCH 112/752] f --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 8f1fa2c43..ba8b84e0e 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -64,14 +64,15 @@ CancellationToken cancellationToken Stream stream; OpenApiDocument document; OpenApiFormat openApiFormat; + OpenApiSpecVersion openApiVersion; var stopwatch = new Stopwatch(); if (!string.IsNullOrEmpty(csdl)) { // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion openApiFormat = format ?? GetOpenApiFormat(csdl, logger); - version ??= OpenApiSpecVersion.OpenApi3_0; - + openApiVersion = version == null ? OpenApiSpecVersion.OpenApi3_0 : TryParseOpenApiSpecVersion(version); + stream = await GetStream(csdl, logger, cancellationToken); document = await ConvertCsdlToOpenApi(stream); } @@ -112,7 +113,7 @@ CancellationToken cancellationToken } openApiFormat = format ?? GetOpenApiFormat(openapi, logger); - version ??= result.OpenApiDiagnostic.SpecificationVersion; + openApiVersion = version == null ? TryParseOpenApiSpecVersion(version) : result.OpenApiDiagnostic.SpecificationVersion; } Func predicate; @@ -127,14 +128,14 @@ CancellationToken cancellationToken logger.LogTrace("Creating predicate based on the operationIds supplied."); predicate = OpenApiFilterService.CreatePredicate(operationIds: filterbyoperationids); -\ logger.LogTrace("Creating subset OpenApi document."); + logger.LogTrace("Creating subset OpenApi document."); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } if (!string.IsNullOrEmpty(filterbytags)) { logger.LogTrace("Creating predicate based on the tags supplied."); predicate = OpenApiFilterService.CreatePredicate(tags: filterbytags); -\ + logger.LogTrace("Creating subset OpenApi document."); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); } @@ -169,7 +170,7 @@ CancellationToken cancellationToken logger.LogTrace("Serializing to OpenApi document using the provided spec version and writer"); stopwatch.Start(); - document.Serialize(writer, (OpenApiSpecVersion)version); + document.Serialize(writer, openApiVersion); stopwatch.Stop(); logger.LogTrace($"Finished serializing in {stopwatch.ElapsedMilliseconds}ms"); From efd21c83ece1ca7794efae5f567ed81cdeeaa07f Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 9 Mar 2022 08:38:55 +0300 Subject: [PATCH 113/752] Add a condition for ensuring the output file path exists before cleaning it --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index a961a0e8f..e96317943 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -56,7 +56,7 @@ CancellationToken cancellationToken { throw new ArgumentNullException(nameof(output)); } - if (cleanoutput) + if (cleanoutput && output.Exists) { output.Delete(); } From ba303fca80751c4d90c504edc80a7c73ccb9eb22 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 9 Mar 2022 09:07:50 +0300 Subject: [PATCH 114/752] Package updates --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index e33f4777e..2e52659ea 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -32,7 +32,7 @@ - + From 2f7cf7fb27ad1f11f0fc20924f9faf02bf78a72c Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 9 Mar 2022 09:10:09 +0300 Subject: [PATCH 115/752] Bump up system.commandline --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 2e52659ea..e1809f275 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -36,7 +36,7 @@ - + From 9db7c43b9117bf66763bfd56bacd37632d714fd2 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 9 Mar 2022 09:33:17 +0300 Subject: [PATCH 116/752] Code cleanup --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index e1809f275..d9a958db9 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -32,8 +32,8 @@ - - + + From 7191c66dbcbff5c5bf40b8f99cab6615d680cc3e Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 10 Mar 2022 22:37:35 +0300 Subject: [PATCH 117/752] Fix exception thrown when OpenSpecVersion is null --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index ba8b84e0e..357152343 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -113,7 +113,7 @@ CancellationToken cancellationToken } openApiFormat = format ?? GetOpenApiFormat(openapi, logger); - openApiVersion = version == null ? TryParseOpenApiSpecVersion(version) : result.OpenApiDiagnostic.SpecificationVersion; + openApiVersion = version == null ? result.OpenApiDiagnostic.SpecificationVersion : TryParseOpenApiSpecVersion(version); } Func predicate; From 38b5a5fc6743bcf447818fce76ab669086c8f239 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 10 Mar 2022 22:38:24 +0300 Subject: [PATCH 118/752] Add recursive solution for nested collection item object --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 41 ++++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 357152343..129dfa54b 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -301,24 +301,41 @@ public static Dictionary> ParseJsonCollectionFile(Stream st logger.LogTrace("Parsing the json collection file into a JsonDocument"); using var document = JsonDocument.Parse(stream); var root = document.RootElement; - var itemElement = root.GetProperty("item"); - foreach (var requestObject in itemElement.EnumerateArray().Select(item => item.GetProperty("request"))) - { - // Fetch list of methods and urls from collection, store them in a dictionary - var path = requestObject.GetProperty("url").GetProperty("raw").ToString(); - var method = requestObject.GetProperty("method").ToString(); - if (!requestUrls.ContainsKey(path)) + requestUrls = Enumerate(root, requestUrls); + + logger.LogTrace("Finished fetching the list of paths and Http methods defined in the Postman collection."); + return requestUrls; + } + + private static Dictionary> Enumerate(JsonElement itemElement, Dictionary> paths) + { + var itemsArray = itemElement.GetProperty("item"); + + foreach (var item in itemsArray.EnumerateArray()) + { + if (item.TryGetProperty("request", out var request)) { - requestUrls.Add(path, new List { method }); + // Fetch list of methods and urls from collection, store them in a dictionary + var path = request.GetProperty("url").GetProperty("raw").ToString(); + var method = request.GetProperty("method").ToString(); + + if (!paths.ContainsKey(path)) + { + paths.Add(path, new List { method }); + } + else + { + paths[path].Add(method); + } } else { - requestUrls[path].Add(method); + Enumerate(item, paths); } } - logger.LogTrace("Finished fetching the list of paths and Http methods defined in the Postman collection."); - return requestUrls; + + return paths; } internal static async Task ValidateOpenApiDocument(string openapi, LogLevel loglevel, CancellationToken cancellationToken) From bdb9f034235503ff15a51ed124ddec55960b6179 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 10 Mar 2022 23:23:15 +0300 Subject: [PATCH 119/752] Code refactoring --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 32 ++++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 129dfa54b..eebc5b5dd 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -314,20 +314,26 @@ private static Dictionary> Enumerate(JsonElement itemElemen foreach (var item in itemsArray.EnumerateArray()) { - if (item.TryGetProperty("request", out var request)) + if(item.ValueKind == JsonValueKind.Object) { - // Fetch list of methods and urls from collection, store them in a dictionary - var path = request.GetProperty("url").GetProperty("raw").ToString(); - var method = request.GetProperty("method").ToString(); - - if (!paths.ContainsKey(path)) - { - paths.Add(path, new List { method }); - } - else - { - paths[path].Add(method); - } + if(item.TryGetProperty("request", out var request)) + { + // Fetch list of methods and urls from collection, store them in a dictionary + var path = request.GetProperty("url").GetProperty("raw").ToString(); + var method = request.GetProperty("method").ToString(); + if (!paths.ContainsKey(path)) + { + paths.Add(path, new List { method }); + } + else + { + paths[path].Add(method); + } + } + else + { + Enumerate(item, paths); + } } else { From 57d8b6c97bc9a9d49698a8d5665747166cbbb4e4 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 10 Mar 2022 23:23:51 +0300 Subject: [PATCH 120/752] Add nested sample collection file and copy it to output directory --- .../UtilityFiles/postmanCollection_ver3.json | 1382 +++++++++++++++++ 1 file changed, 1382 insertions(+) create mode 100644 test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver3.json diff --git a/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver3.json b/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver3.json new file mode 100644 index 000000000..2c7637ed7 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver3.json @@ -0,0 +1,1382 @@ +{ + "info": { + "_postman_id": "6281bdba-62b8-2276-a5d6-268e87f48c89", + "name": "Graph-Collection", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "admin", + "item": [ + { + "name": "/admin", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin" + ] + } + } + }, + { + "name": "/admin", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}", + "issues" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}", + "issues" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}", + "issues", + "{serviceHealthIssue-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}", + "issues", + "{serviceHealthIssue-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}", + "issues", + "{serviceHealthIssue-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}/microsoft.graph.incidentReport()", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/healthOverviews/{serviceHealth-id}/issues/{serviceHealthIssue-id}/microsoft.graph.incidentReport()", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "healthOverviews", + "{serviceHealth-id}", + "issues", + "{serviceHealthIssue-id}", + "microsoft.graph.incidentReport()" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/issues", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "issues" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/issues", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "issues" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "issues", + "{serviceHealthIssue-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "issues", + "{serviceHealthIssue-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "issues", + "{serviceHealthIssue-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}/microsoft.graph.incidentReport()", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/issues/{serviceHealthIssue-id}/microsoft.graph.incidentReport()", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "issues", + "{serviceHealthIssue-id}", + "microsoft.graph.incidentReport()" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/microsoft.graph.archive", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/microsoft.graph.archive", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "microsoft.graph.archive" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/microsoft.graph.favorite", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/microsoft.graph.favorite", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "microsoft.graph.favorite" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/microsoft.graph.markRead", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/microsoft.graph.markRead", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "microsoft.graph.markRead" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/microsoft.graph.markUnread", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/microsoft.graph.markUnread", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "microsoft.graph.markUnread" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/microsoft.graph.unarchive", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/microsoft.graph.unarchive", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "microsoft.graph.unarchive" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/microsoft.graph.unfavorite", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/microsoft.graph.unfavorite", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "microsoft.graph.unfavorite" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachments" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachments" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachments", + "{serviceAnnouncementAttachment-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachments", + "{serviceAnnouncementAttachment-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachments", + "{serviceAnnouncementAttachment-id}" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}/content", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachments", + "{serviceAnnouncementAttachment-id}", + "content" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}/content", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachments/{serviceAnnouncementAttachment-id}/content", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachments", + "{serviceAnnouncementAttachment-id}", + "content" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachmentsArchive", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachmentsArchive", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachmentsArchive" + ] + } + } + }, + { + "name": "/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachmentsArchive", + "request": { + "method": "PUT", + "url": { + "raw": "https://graph.microsoft.com/v1.0/admin/serviceAnnouncement/messages/{serviceUpdateMessage-id}/attachmentsArchive", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "admin", + "serviceAnnouncement", + "messages", + "{serviceUpdateMessage-id}", + "attachmentsArchive" + ] + } + } + } + ] + }, + { + "name": "agreementAcceptances", + "item": [ + { + "name": "/agreementAcceptances", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "agreementAcceptances" + ] + } + } + }, + { + "name": "/agreementAcceptances", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "agreementAcceptances" + ] + } + } + }, + { + "name": "/agreementAcceptances/{agreementAcceptance-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances/{agreementAcceptance-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "agreementAcceptances", + "{agreementAcceptance-id}" + ] + } + } + }, + { + "name": "/agreementAcceptances/{agreementAcceptance-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances/{agreementAcceptance-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "agreementAcceptances", + "{agreementAcceptance-id}" + ] + } + } + }, + { + "name": "/agreementAcceptances/{agreementAcceptance-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances/{agreementAcceptance-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "agreementAcceptances", + "{agreementAcceptance-id}" + ] + } + } + } + ] + }, + { + "name": "appCatalogs", + "item": [ + { + "name": "/appCatalogs", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs" + ] + } + } + }, + { + "name": "/appCatalogs", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions", + "{teamsAppDefinition-id}" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions", + "{teamsAppDefinition-id}" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions", + "{teamsAppDefinition-id}" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}/bot", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}/bot", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions", + "{teamsAppDefinition-id}", + "bot" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}/bot", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}/bot", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions", + "{teamsAppDefinition-id}", + "bot" + ] + } + } + }, + { + "name": "/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}/bot", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/{teamsApp-id}/appDefinitions/{teamsAppDefinition-id}/bot", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs", + "teamsApps", + "{teamsApp-id}", + "appDefinitions", + "{teamsAppDefinition-id}", + "bot" + ] + } + } + } + ] + } + ] +} \ No newline at end of file From 615f01c8174b5517ec4729f46ca63bf0df32c008 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 10 Mar 2022 23:24:01 +0300 Subject: [PATCH 121/752] Add unit test --- .../Services/OpenApiFilterServiceTests.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs index 78f8ec048..28c259fc6 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs @@ -69,6 +69,23 @@ public void ReturnFilteredOpenApiDocumentBasedOnPostmanCollection() Assert.Equal(3, subsetOpenApiDocument.Paths.Count); } + [Fact] + public void ShouldParseNestedPostmanCollection() + { + // Arrange + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver3.json"); + var fileInput = new FileInfo(filePath); + var stream = fileInput.OpenRead(); + + // Act + var requestUrls = OpenApiService.ParseJsonCollectionFile(stream, _logger); + var pathCount = requestUrls.Count; + + // Assert + Assert.NotNull(requestUrls); + Assert.Equal(30, pathCount); + } + [Fact] public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument() { From 177a3370f909f722af9a4b47879a8c1fe018a780 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Fri, 11 Mar 2022 23:21:10 -0500 Subject: [PATCH 122/752] Fixed issues related to merge conflicts --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 21 ++++++++++++-------- src/Microsoft.OpenApi.Hidi/Program.cs | 10 +++++++--- src/Microsoft.OpenApi.Hidi/appsettings.json | 7 ------- 3 files changed, 20 insertions(+), 18 deletions(-) delete mode 100644 src/Microsoft.OpenApi.Hidi/appsettings.json diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index ba8b84e0e..3d38ea678 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -71,8 +71,8 @@ CancellationToken cancellationToken { // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion openApiFormat = format ?? GetOpenApiFormat(csdl, logger); - openApiVersion = version == null ? OpenApiSpecVersion.OpenApi3_0 : TryParseOpenApiSpecVersion(version); - + openApiVersion = version != null ? TryParseOpenApiSpecVersion(version) : OpenApiSpecVersion.OpenApi3_0; + stream = await GetStream(csdl, logger, cancellationToken); document = await ConvertCsdlToOpenApi(stream); } @@ -113,7 +113,7 @@ CancellationToken cancellationToken } openApiFormat = format ?? GetOpenApiFormat(openapi, logger); - openApiVersion = version == null ? TryParseOpenApiSpecVersion(version) : result.OpenApiDiagnostic.SpecificationVersion; + openApiVersion = version != null ? TryParseOpenApiSpecVersion(version) : result.OpenApiDiagnostic.SpecificationVersion; } Func predicate; @@ -181,9 +181,10 @@ CancellationToken cancellationToken catch (Exception ex) { #if DEBUG - logger.LogCritical(ex, ex.Message); + logger.LogCritical(ex, ex.Message); #else logger.LogCritical(ex.Message); + #endif return 1; } @@ -335,12 +336,14 @@ internal static async Task ValidateOpenApiDocument(string openapi, LogLevel OpenApiDocument document; logger.LogTrace("Parsing the OpenApi file"); - document = new OpenApiStreamReader(new OpenApiReaderSettings + var result = await new OpenApiStreamReader(new OpenApiReaderSettings { RuleSet = ValidationRuleSet.GetDefaultRuleSet() } - ).Read(stream, out var context); + ).ReadAsync(stream); + document = result.OpenApiDocument; + var context = result.OpenApiDiagnostic; if (context.Errors.Count != 0) { foreach (var error in context.Errors) @@ -355,7 +358,7 @@ internal static async Task ValidateOpenApiDocument(string openapi, LogLevel logger.LogTrace("Finished walking through the OpenApi document. Generating a statistics report.."); logger.LogInformation(statsVisitor.GetStatisticsReport()); - + return 0; } catch(Exception ex) @@ -385,7 +388,9 @@ private static ILogger ConfigureLoggerInstance(LogLevel loglevel) var logger = LoggerFactory.Create((builder) => { builder - .AddConsole() + .AddConsole(c => { + c.LogToStandardErrorThreshold = LogLevel.Error; + }) #if DEBUG .AddDebug() #endif diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 24abb4a98..4fcf3f16b 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System; using System.CommandLine; using System.IO; using System.Threading; @@ -11,7 +12,7 @@ namespace Microsoft.OpenApi.Hidi { static class Program { - static async Task Main(string[] args) + static async Task Main(string[] args) { var rootCommand = new RootCommand() { }; @@ -32,7 +33,7 @@ static async Task Main(string[] args) var formatOption = new Option("--format", "File format"); formatOption.AddAlias("-f"); - var logLevelOption = new Option("--loglevel", () => LogLevel.Warning, "The log level to use when logging messages to the main output."); + var logLevelOption = new Option("--loglevel", () => LogLevel.Information, "The log level to use when logging messages to the main output."); logLevelOption.AddAlias("-ll"); var filterByOperationIdsOption = new Option("--filter-by-operationids", "Filters OpenApiDocument by OperationId(s) provided"); @@ -80,7 +81,10 @@ static async Task Main(string[] args) rootCommand.Add(validateCommand); // Parse the incoming args and invoke the handler - return await rootCommand.InvokeAsync(args); + await rootCommand.InvokeAsync(args); + + //// Wait for logger to write messages to the console before exiting + await Task.Delay(10); } } } diff --git a/src/Microsoft.OpenApi.Hidi/appsettings.json b/src/Microsoft.OpenApi.Hidi/appsettings.json deleted file mode 100644 index 882248cf8..000000000 --- a/src/Microsoft.OpenApi.Hidi/appsettings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Debug" - } - } -} \ No newline at end of file From c191c9cba9a0800b1b8e7f756271dee5002dc495 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 13 Mar 2022 18:05:58 -0400 Subject: [PATCH 123/752] Added scope to tracing --- .../Microsoft.OpenApi.Hidi.csproj | 2 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 417 ++++++++++-------- src/Microsoft.OpenApi.Hidi/Program.cs | 2 +- 3 files changed, 234 insertions(+), 187 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index e33f4777e..b501e2cd2 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -36,7 +36,7 @@ - + diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 3d38ea678..e4da1c900 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -29,7 +29,10 @@ namespace Microsoft.OpenApi.Hidi { public class OpenApiService { - public static async Task ProcessOpenApiDocument( + /// + /// Implementation of the transform command + /// + public static async Task TransformOpenApiDocument( string openapi, string csdl, FileInfo output, @@ -69,127 +72,210 @@ CancellationToken cancellationToken if (!string.IsNullOrEmpty(csdl)) { - // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion - openApiFormat = format ?? GetOpenApiFormat(csdl, logger); - openApiVersion = version != null ? TryParseOpenApiSpecVersion(version) : OpenApiSpecVersion.OpenApi3_0; - - stream = await GetStream(csdl, logger, cancellationToken); - document = await ConvertCsdlToOpenApi(stream); + using (logger.BeginScope($"Convert CSDL: {csdl}", csdl)) + { + stopwatch.Start(); + // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion + openApiFormat = format ?? GetOpenApiFormat(csdl, logger); + openApiVersion = version != null ? TryParseOpenApiSpecVersion(version) : OpenApiSpecVersion.OpenApi3_0; + + stream = await GetStream(csdl, logger, cancellationToken); + document = await ConvertCsdlToOpenApi(stream); + stopwatch.Stop(); + logger.LogTrace("{timestamp}ms: Generated OpenAPI with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); + } } else { stream = await GetStream(openapi, logger, cancellationToken); - // Parsing OpenAPI file - stopwatch.Start(); - logger.LogTrace("Parsing OpenApi file"); - var result = await new OpenApiStreamReader(new OpenApiReaderSettings + using (logger.BeginScope($"Parse OpenAPI: {openapi}",openapi)) { - ReferenceResolution = resolveexternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, - RuleSet = ValidationRuleSet.GetDefaultRuleSet() - } - ).ReadAsync(stream); + stopwatch.Restart(); + var result = await new OpenApiStreamReader(new OpenApiReaderSettings + { + ReferenceResolution = resolveexternal ? ReferenceResolutionSetting.ResolveAllReferences : ReferenceResolutionSetting.ResolveLocalReferences, + RuleSet = ValidationRuleSet.GetDefaultRuleSet() + } + ).ReadAsync(stream); - document = result.OpenApiDocument; - stopwatch.Stop(); + document = result.OpenApiDocument; - var context = result.OpenApiDiagnostic; - if (context.Errors.Count > 0) - { - logger.LogTrace("{timestamp}ms: Parsed OpenAPI with errors. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count); + var context = result.OpenApiDiagnostic; + if (context.Errors.Count > 0) + { + logger.LogTrace("{timestamp}ms: Parsed OpenAPI with errors. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count); - var errorReport = new StringBuilder(); + var errorReport = new StringBuilder(); - foreach (var error in context.Errors) + foreach (var error in context.Errors) + { + logger.LogError("OpenApi Parsing error: {message}", error.ToString()); + errorReport.AppendLine(error.ToString()); + } + logger.LogError($"{stopwatch.ElapsedMilliseconds}ms: OpenApi Parsing errors {string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())}"); + } + else { - logger.LogError("OpenApi Parsing error: {message}", error.ToString()); - errorReport.AppendLine(error.ToString()); + logger.LogTrace("{timestamp}ms: Parsed OpenApi successfully. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } - logger.LogError($"{stopwatch.ElapsedMilliseconds}ms: OpenApi Parsing errors {string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())}"); + + openApiFormat = format ?? GetOpenApiFormat(openapi, logger); + openApiVersion = version != null ? TryParseOpenApiSpecVersion(version) : result.OpenApiDiagnostic.SpecificationVersion; + stopwatch.Stop(); } - else + } + + using (logger.BeginScope("Filter")) + { + Func predicate = null; + + // Check if filter options are provided, then slice the OpenAPI document + if (!string.IsNullOrEmpty(filterbyoperationids) && !string.IsNullOrEmpty(filterbytags)) { - logger.LogTrace("{timestamp}ms: Parsed OpenApi successfully. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count); + throw new InvalidOperationException("Cannot filter by operationIds and tags at the same time."); } + if (!string.IsNullOrEmpty(filterbyoperationids)) + { + logger.LogTrace("Creating predicate based on the operationIds supplied."); + predicate = OpenApiFilterService.CreatePredicate(operationIds: filterbyoperationids); - openApiFormat = format ?? GetOpenApiFormat(openapi, logger); - openApiVersion = version != null ? TryParseOpenApiSpecVersion(version) : result.OpenApiDiagnostic.SpecificationVersion; - } + } + if (!string.IsNullOrEmpty(filterbytags)) + { + logger.LogTrace("Creating predicate based on the tags supplied."); + predicate = OpenApiFilterService.CreatePredicate(tags: filterbytags); - Func predicate; + } + if (!string.IsNullOrEmpty(filterbycollection)) + { + var fileStream = await GetStream(filterbycollection, logger, cancellationToken); + var requestUrls = ParseJsonCollectionFile(fileStream, logger); - // Check if filter options are provided, then slice the OpenAPI document - if (!string.IsNullOrEmpty(filterbyoperationids) && !string.IsNullOrEmpty(filterbytags)) - { - throw new InvalidOperationException("Cannot filter by operationIds and tags at the same time."); + logger.LogTrace("Creating predicate based on the paths and Http methods defined in the Postman collection."); + predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: document); + } + if (predicate != null) + { + stopwatch.Restart(); + document = OpenApiFilterService.CreateFilteredDocument(document, predicate); + stopwatch.Stop(); + logger.LogTrace("{timestamp}ms: Creating filtered OpenApi document with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); + } } - if (!string.IsNullOrEmpty(filterbyoperationids)) - { - logger.LogTrace("Creating predicate based on the operationIds supplied."); - predicate = OpenApiFilterService.CreatePredicate(operationIds: filterbyoperationids); - logger.LogTrace("Creating subset OpenApi document."); - document = OpenApiFilterService.CreateFilteredDocument(document, predicate); - } - if (!string.IsNullOrEmpty(filterbytags)) + using (logger.BeginScope("Output")) { - logger.LogTrace("Creating predicate based on the tags supplied."); - predicate = OpenApiFilterService.CreatePredicate(tags: filterbytags); + ; + using var outputStream = output?.Create(); + var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; - logger.LogTrace("Creating subset OpenApi document."); - document = OpenApiFilterService.CreateFilteredDocument(document, predicate); - } - if (!string.IsNullOrEmpty(filterbycollection)) - { - var fileStream = await GetStream(filterbycollection, logger, cancellationToken); - var requestUrls = ParseJsonCollectionFile(fileStream, logger); + var settings = new OpenApiWriterSettings() + { + ReferenceInline = inline ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences + }; + + IOpenApiWriter writer = openApiFormat switch + { + OpenApiFormat.Json => new OpenApiJsonWriter(textWriter, settings), + OpenApiFormat.Yaml => new OpenApiYamlWriter(textWriter, settings), + _ => throw new ArgumentException("Unknown format"), + }; + + logger.LogTrace("Serializing to OpenApi document using the provided spec version and writer"); - logger.LogTrace("Creating predicate based on the paths and Http methods defined in the Postman collection."); - predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: document); + stopwatch.Start(); + document.Serialize(writer, openApiVersion); + stopwatch.Stop(); - logger.LogTrace("Creating subset OpenApi document."); - document = OpenApiFilterService.CreateFilteredDocument(document, predicate); + logger.LogTrace($"Finished serializing in {stopwatch.ElapsedMilliseconds}ms"); + textWriter.Flush(); } + return 0; + } + catch (Exception ex) + { +#if DEBUG + logger.LogCritical(ex, ex.Message); +#else + logger.LogCritical(ex.Message); + +#endif + return 1; + } + } - logger.LogTrace("Creating a new file"); - using var outputStream = output?.Create(); - var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; + /// + /// Implementation of the validate command + /// + public static async Task ValidateOpenApiDocument( + string openapi, + LogLevel loglevel, + CancellationToken cancellationToken) + { + var logger = ConfigureLoggerInstance(loglevel); - var settings = new OpenApiWriterSettings() + try + { + if (string.IsNullOrEmpty(openapi)) { - ReferenceInline = inline ? ReferenceInlineSetting.InlineLocalReferences : ReferenceInlineSetting.DoNotInlineReferences - }; + throw new ArgumentNullException(nameof(openapi)); + } + var stream = await GetStream(openapi, logger, cancellationToken); - IOpenApiWriter writer = openApiFormat switch + OpenApiDocument document; + Stopwatch stopwatch = Stopwatch.StartNew(); + using (logger.BeginScope($"Parsing OpenAPI: {openapi}", openapi)) { - OpenApiFormat.Json => new OpenApiJsonWriter(textWriter, settings), - OpenApiFormat.Yaml => new OpenApiYamlWriter(textWriter, settings), - _ => throw new ArgumentException("Unknown format"), - }; + stopwatch.Start(); + + var result = await new OpenApiStreamReader(new OpenApiReaderSettings + { + RuleSet = ValidationRuleSet.GetDefaultRuleSet() + } + ).ReadAsync(stream); - logger.LogTrace("Serializing to OpenApi document using the provided spec version and writer"); + logger.LogTrace("{timestamp}ms: Completed parsing.", stopwatch.ElapsedMilliseconds); - stopwatch.Start(); - document.Serialize(writer, openApiVersion); - stopwatch.Stop(); + document = result.OpenApiDocument; + var context = result.OpenApiDiagnostic; + if (context.Errors.Count != 0) + { + using (logger.BeginScope("Detected errors")) + { + foreach (var error in context.Errors) + { + logger.LogError(error.ToString()); + } + } + } + stopwatch.Stop(); + } - logger.LogTrace($"Finished serializing in {stopwatch.ElapsedMilliseconds}ms"); - textWriter.Flush(); + using (logger.BeginScope("Calculating statistics")) + { + var statsVisitor = new StatsVisitor(); + var walker = new OpenApiWalker(statsVisitor); + walker.Walk(document); + + logger.LogTrace("Finished walking through the OpenApi document. Generating a statistics report.."); + logger.LogInformation(statsVisitor.GetStatisticsReport()); + } return 0; } catch (Exception ex) { -#if DEBUG - logger.LogCritical(ex, ex.Message); +#if DEBUG + logger.LogCritical(ex, ex.Message); #else logger.LogCritical(ex.Message); - #endif return 1; - } + } + } - + /// /// Converts CSDL to OpenAPI /// @@ -225,71 +311,6 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl) return document; } - /// - /// Fixes the references in the resulting OpenApiDocument. - /// - /// The converted OpenApiDocument. - /// A valid OpenApiDocument instance. - public static OpenApiDocument FixReferences(OpenApiDocument document) - { - // This method is only needed because the output of ConvertToOpenApi isn't quite a valid OpenApiDocument instance. - // So we write it out, and read it back in again to fix it up. - - var sb = new StringBuilder(); - document.SerializeAsV3(new OpenApiYamlWriter(new StringWriter(sb))); - var doc = new OpenApiStringReader().Read(sb.ToString(), out _); - - return doc; - } - - private static async Task GetStream(string input, ILogger logger, CancellationToken cancellationToken) - { - var stopwatch = new Stopwatch(); - stopwatch.Start(); - - Stream stream; - if (input.StartsWith("http")) - { - try - { - var httpClientHandler = new HttpClientHandler() - { - SslProtocols = System.Security.Authentication.SslProtocols.Tls12, - }; - using var httpClient = new HttpClient(httpClientHandler) - { - DefaultRequestVersion = HttpVersion.Version20 - }; - stream = await httpClient.GetStreamAsync(input, cancellationToken); - } - catch (HttpRequestException ex) - { - throw new InvalidOperationException($"Could not download the file at {input}", ex); - } - } - else - { - try - { - var fileInput = new FileInfo(input); - stream = fileInput.OpenRead(); - } - catch (Exception ex) when (ex is FileNotFoundException || - ex is PathTooLongException || - ex is DirectoryNotFoundException || - ex is IOException || - ex is UnauthorizedAccessException || - ex is SecurityException || - ex is NotSupportedException) - { - throw new InvalidOperationException($"Could not open the file at {input}", ex); - } - } - stopwatch.Stop(); - logger.LogTrace("{timestamp}ms: Read file {input}", stopwatch.ElapsedMilliseconds, input); - return stream; - } - /// /// Takes in a file stream, parses the stream into a JsonDocument and gets a list of paths and Http methods /// @@ -322,57 +343,83 @@ public static Dictionary> ParseJsonCollectionFile(Stream st return requestUrls; } - internal static async Task ValidateOpenApiDocument(string openapi, LogLevel loglevel, CancellationToken cancellationToken) + /// + /// Fixes the references in the resulting OpenApiDocument. + /// + /// The converted OpenApiDocument. + /// A valid OpenApiDocument instance. + private static OpenApiDocument FixReferences(OpenApiDocument document) { - var logger = ConfigureLoggerInstance(loglevel); + // This method is only needed because the output of ConvertToOpenApi isn't quite a valid OpenApiDocument instance. + // So we write it out, and read it back in again to fix it up. - try + var sb = new StringBuilder(); + document.SerializeAsV3(new OpenApiYamlWriter(new StringWriter(sb))); + var doc = new OpenApiStringReader().Read(sb.ToString(), out _); + + return doc; + } + + /// + /// Reads stream from file system or makes HTTP request depending on the input string + /// + private static async Task GetStream(string input, ILogger logger, CancellationToken cancellationToken) + { + Stream stream; + using (logger.BeginScope("Reading input stream")) { - if (string.IsNullOrEmpty(openapi)) - { - throw new ArgumentNullException(nameof(openapi)); - } - var stream = await GetStream(openapi, logger, cancellationToken); + var stopwatch = new Stopwatch(); + stopwatch.Start(); - OpenApiDocument document; - logger.LogTrace("Parsing the OpenApi file"); - var result = await new OpenApiStreamReader(new OpenApiReaderSettings + if (input.StartsWith("http")) { - RuleSet = ValidationRuleSet.GetDefaultRuleSet() + try + { + var httpClientHandler = new HttpClientHandler() + { + SslProtocols = System.Security.Authentication.SslProtocols.Tls12, + }; + using var httpClient = new HttpClient(httpClientHandler) + { + DefaultRequestVersion = HttpVersion.Version20 + }; + stream = await httpClient.GetStreamAsync(input, cancellationToken); + } + catch (HttpRequestException ex) + { + throw new InvalidOperationException($"Could not download the file at {input}", ex); + } } - ).ReadAsync(stream); - - document = result.OpenApiDocument; - var context = result.OpenApiDiagnostic; - if (context.Errors.Count != 0) + else { - foreach (var error in context.Errors) + try + { + var fileInput = new FileInfo(input); + stream = fileInput.OpenRead(); + } + catch (Exception ex) when (ex is FileNotFoundException || + ex is PathTooLongException || + ex is DirectoryNotFoundException || + ex is IOException || + ex is UnauthorizedAccessException || + ex is SecurityException || + ex is NotSupportedException) { - logger.LogError("OpenApi Parsing error: {message}", error.ToString()); + throw new InvalidOperationException($"Could not open the file at {input}", ex); } } - - var statsVisitor = new StatsVisitor(); - var walker = new OpenApiWalker(statsVisitor); - walker.Walk(document); - - logger.LogTrace("Finished walking through the OpenApi document. Generating a statistics report.."); - logger.LogInformation(statsVisitor.GetStatisticsReport()); - - return 0; - } - catch(Exception ex) - { -#if DEBUG - logger.LogCritical(ex, ex.Message); -#else - logger.LogCritical(ex.Message); -#endif - return 1; + stopwatch.Stop(); + logger.LogTrace("{timestamp}ms: Read file {input}", stopwatch.ElapsedMilliseconds, input); } - + return stream; } + /// + /// Attempt to guess OpenAPI format based in input URL + /// + /// + /// + /// private static OpenApiFormat GetOpenApiFormat(string input, ILogger logger) { logger.LogTrace("Getting the OpenApi format"); @@ -388,10 +435,10 @@ private static ILogger ConfigureLoggerInstance(LogLevel loglevel) var logger = LoggerFactory.Create((builder) => { builder - .AddConsole(c => { - c.LogToStandardErrorThreshold = LogLevel.Error; + .AddSimpleConsole(c => { + c.IncludeScopes = true; }) -#if DEBUG +#if DEBUG .AddDebug() #endif .SetMinimumLevel(loglevel); diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 4fcf3f16b..efbf7fea6 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -75,7 +75,7 @@ static async Task Main(string[] args) }; transformCommand.SetHandler ( - OpenApiService.ProcessOpenApiDocument, descriptionOption, csdlOption, outputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); + OpenApiService.TransformOpenApiDocument, descriptionOption, csdlOption, outputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); From 2ac15c1981a661b0fbb48dcf7bc04dca096a18e9 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 13 Mar 2022 21:31:16 -0400 Subject: [PATCH 124/752] Fixed input parameters of transform --- src/Microsoft.OpenApi.Hidi/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index e9a1bc318..ac39aaad4 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -79,7 +79,7 @@ static async Task Main(string[] args) }; transformCommand.SetHandler ( - OpenApiService.TransformOpenApiDocument, descriptionOption, csdlOption, outputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); + OpenApiService.TransformOpenApiDocument, descriptionOption, csdlOption, outputOption, cleanOutputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); From 6590a7216041112b3fd8251e0b7c41fafeea13b3 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 14 Mar 2022 09:37:54 +0300 Subject: [PATCH 125/752] Rename method --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index eebc5b5dd..d68daea80 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -302,13 +302,13 @@ public static Dictionary> ParseJsonCollectionFile(Stream st using var document = JsonDocument.Parse(stream); var root = document.RootElement; - requestUrls = Enumerate(root, requestUrls); - + requestUrls = EnumerateJsonDocument(root, requestUrls); logger.LogTrace("Finished fetching the list of paths and Http methods defined in the Postman collection."); + return requestUrls; } - private static Dictionary> Enumerate(JsonElement itemElement, Dictionary> paths) + private static Dictionary> EnumerateJsonDocument(JsonElement itemElement, Dictionary> paths) { var itemsArray = itemElement.GetProperty("item"); @@ -332,12 +332,12 @@ private static Dictionary> Enumerate(JsonElement itemElemen } else { - Enumerate(item, paths); + EnumerateJsonDocument(item, paths); } } else { - Enumerate(item, paths); + EnumerateJsonDocument(item, paths); } } From 752a78a81730d6141d1c4caff467adea6a34d8d2 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 15 Mar 2022 11:32:05 +0300 Subject: [PATCH 126/752] Log warning to console if url in collection isn't in the input OpenApi doc and continue processing the rest of the urls and add unit test --- .../Services/OpenApiFilterServiceTests.cs | 22 +++ .../UtilityFiles/postmanCollection_ver4.json | 145 ++++++++++++++++++ 2 files changed, 167 insertions(+) create mode 100644 test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver4.json diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs index 28c259fc6..29cb684d2 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs @@ -103,6 +103,28 @@ public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument() Assert.Equal("The urls in the Postman collection supplied could not be found.", message); } + [Fact] + public void ContinueProcessingWhenUrlsInCollectionAreMissingFromSourceDocument() + { + // Arrange + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver4.json"); + var fileInput = new FileInfo(filePath); + var stream = fileInput.OpenRead(); + + // Act + var requestUrls = OpenApiService.ParseJsonCollectionFile(stream, _logger); + var pathCount = requestUrls.Count; + var predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: _openApiDocumentMock); + var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(_openApiDocumentMock, predicate); + var subsetPathCount = subsetOpenApiDocument.Paths.Count; + + // Assert + Assert.NotNull(subsetOpenApiDocument); + Assert.NotEmpty(subsetOpenApiDocument.Paths); + Assert.Equal(2, subsetPathCount); + Assert.NotEqual(pathCount, subsetPathCount); + } + [Fact] public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidArgumentsArePassed() { diff --git a/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver4.json b/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver4.json new file mode 100644 index 000000000..edafeb0bd --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver4.json @@ -0,0 +1,145 @@ +{ + "info": { + "_postman_id": "43402ca3-f018-7c9b-2315-f176d9b171a3", + "name": "Graph-Collection", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "item": [ + { + "name": "users-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users" + ] + } + } + }, + { + "name": "users-POST", + "request": { + "method": "POST", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users" + ] + } + } + }, + { + "name": "/appCatalogs", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/appCatalogs", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "appCatalogs" + ] + } + } + }, + { + "name": "/agreementAcceptances", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/agreementAcceptances", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "agreementAcceptances" + ] + } + } + }, + { + "name": "{user-id}-GET", + "request": { + "method": "GET", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}" + ] + } + } + }, + { + "name": "{user-id}-PATCH", + "request": { + "method": "PATCH", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}" + ] + } + } + }, + { + "name": "{user-id}-DELETE", + "request": { + "method": "DELETE", + "url": { + "raw": "https://graph.microsoft.com/v1.0/users/{user-id}", + "protocol": "https", + "host": [ + "graph", + "microsoft", + "com" + ], + "path": [ + "v1.0", + "users", + "{user-id}" + ] + } + } + } + ] +} \ No newline at end of file From 7087caa652351e5fb9d0d24d30ab1841b4687b3f Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Wed, 23 Mar 2022 13:31:56 -0400 Subject: [PATCH 127/752] Added CSDL filter for entitysets and singletons --- src/Microsoft.OpenApi.Hidi/CsdlFilter.xslt | 22 ++++++++++ .../Microsoft.OpenApi.Hidi.csproj | 8 ++++ src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 41 ++++++++++++++++++- src/Microsoft.OpenApi.Hidi/Program.cs | 8 +++- .../Services/OpenApiServiceTests.cs | 2 +- 5 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 src/Microsoft.OpenApi.Hidi/CsdlFilter.xslt diff --git a/src/Microsoft.OpenApi.Hidi/CsdlFilter.xslt b/src/Microsoft.OpenApi.Hidi/CsdlFilter.xslt new file mode 100644 index 000000000..ee3bf0d40 --- /dev/null +++ b/src/Microsoft.OpenApi.Hidi/CsdlFilter.xslt @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index d9a958db9..98def8818 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -31,6 +31,14 @@ true + + + + + + + + diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index c15f77d6f..4b73c13d4 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -24,6 +24,10 @@ using Microsoft.OpenApi.Writers; using static Microsoft.OpenApi.Hidi.OpenApiSpecVersionHelper; using System.Threading; +using System.Xml.Xsl; +using System.Xml; +using System.Runtime.CompilerServices; +using System.Reflection; namespace Microsoft.OpenApi.Hidi { @@ -35,6 +39,7 @@ public class OpenApiService public static async Task TransformOpenApiDocument( string openapi, string csdl, + string csdlFilter, FileInfo output, bool cleanoutput, string? version, @@ -85,6 +90,13 @@ CancellationToken cancellationToken openApiVersion = version != null ? TryParseOpenApiSpecVersion(version) : OpenApiSpecVersion.OpenApi3_0; stream = await GetStream(csdl, logger, cancellationToken); + + if (!string.IsNullOrEmpty(csdlFilter)) + { + XslCompiledTransform transform = GetFilterTransform(); + stream = ApplyFilter(csdl, csdlFilter, transform); + stream.Position = 0; + } document = await ConvertCsdlToOpenApi(stream); stopwatch.Stop(); logger.LogTrace("{timestamp}ms: Generated OpenAPI with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); @@ -210,6 +222,31 @@ CancellationToken cancellationToken } } + private static XslCompiledTransform GetFilterTransform() + { + XslCompiledTransform transform = new(); + Assembly assembly = typeof(OpenApiService).GetTypeInfo().Assembly; + Stream xslt = assembly.GetManifestResourceStream("Microsoft.OpenApi.Hidi.CsdlFilter.xslt"); + transform.Load(new XmlTextReader(new StreamReader(xslt))); + return transform; + } + + private static Stream ApplyFilter(string csdl, string entitySetOrSingleton, XslCompiledTransform transform) + { + Stream stream; + StreamReader inputReader = new(csdl); + XmlReader inputXmlReader = XmlReader.Create(inputReader); + MemoryStream filteredStream = new(); + StreamWriter writer = new(filteredStream); + XsltArgumentList args = new(); + args.AddParam("entitySetOrSingleton", "", entitySetOrSingleton); + transform.Transform(inputXmlReader, args, writer); + stream = filteredStream; + return stream; + } + + + /// /// Implementation of the validate command /// @@ -306,8 +343,8 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl) EnableDiscriminatorValue = false, EnableDerivedTypesReferencesForRequestBody = false, EnableDerivedTypesReferencesForResponses = false, - ShowRootPath = true, - ShowLinks = true + ShowRootPath = false, + ShowLinks = false }; OpenApiDocument document = edmModel.ConvertToOpenApi(settings); diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index ac39aaad4..5a2a808dd 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -24,6 +24,9 @@ static async Task Main(string[] args) var csdlOption = new Option("--csdl", "Input CSDL file path or URL"); csdlOption.AddAlias("-cs"); + var csdlFilterOption = new Option("--csdlFilter", "Name of EntitySet or Singleton to filter CSDL on"); + csdlOption.AddAlias("-csf"); + var outputOption = new Option("--output", () => new FileInfo("./output"), "The output directory path for the generated file.") { Arity = ArgumentArity.ZeroOrOne }; outputOption.AddAlias("-o"); @@ -66,6 +69,7 @@ static async Task Main(string[] args) { descriptionOption, csdlOption, + csdlFilterOption, outputOption, cleanOutputOption, versionOption, @@ -78,8 +82,8 @@ static async Task Main(string[] args) resolveExternalOption, }; - transformCommand.SetHandler ( - OpenApiService.TransformOpenApiDocument, descriptionOption, csdlOption, outputOption, cleanOutputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); + transformCommand.SetHandler ( + OpenApiService.TransformOpenApiDocument, descriptionOption, csdlOption, csdlFilterOption, outputOption, cleanOutputOption, versionOption, formatOption, logLevelOption, inlineOption, resolveExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs index 1c9fd003b..af5437aa1 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs @@ -22,7 +22,7 @@ public async Task ReturnConvertedCSDLFile() // Act var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream); - var expectedPathCount = 6; + var expectedPathCount = 5; // Assert Assert.NotNull(openApiDoc); From 91a2aab9a9f80e0c4128cb67cae4ad5c81136438 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 27 Mar 2022 09:07:50 -0400 Subject: [PATCH 128/752] Fixed issue with v2 external references --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index cd8d14132..add38e832 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -33,10 +33,10 @@ - + - + From b9f1bb9444ef93d376889fcac12756a8ac192353 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 27 Mar 2022 16:49:34 -0400 Subject: [PATCH 129/752] Fixed command alias and some descriptions --- src/Microsoft.OpenApi.Hidi/Program.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 0eab5a693..8b466913c 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -24,8 +24,8 @@ static async Task Main(string[] args) var csdlOption = new Option("--csdl", "Input CSDL file path or URL"); csdlOption.AddAlias("-cs"); - var csdlFilterOption = new Option("--csdlFilter", "Name of EntitySet or Singleton to filter CSDL on"); - csdlOption.AddAlias("-csf"); + var csdlFilterOption = new Option("--csdl-filter", "Comma delimited list of EntitySets or Singletons to filter CSDL on. e.g. tasks,accounts"); + csdlFilterOption.AddAlias("-csf"); var outputOption = new Option("--output", () => new FileInfo("./output"), "The output directory path for the generated file.") { Arity = ArgumentArity.ZeroOrOne }; outputOption.AddAlias("-o"); @@ -42,13 +42,13 @@ static async Task Main(string[] args) var logLevelOption = new Option("--loglevel", () => LogLevel.Information, "The log level to use when logging messages to the main output."); logLevelOption.AddAlias("-ll"); - var filterByOperationIdsOption = new Option("--filter-by-operationids", "Filters OpenApiDocument by OperationId(s) provided"); + var filterByOperationIdsOption = new Option("--filter-by-operationids", "Filters OpenApiDocument by comma delimited list of OperationId(s) provided"); filterByOperationIdsOption.AddAlias("-op"); - var filterByTagsOption = new Option("--filter-by-tags", "Filters OpenApiDocument by Tag(s) provided"); + var filterByTagsOption = new Option("--filter-by-tags", "Filters OpenApiDocument by comma delimited list of Tag(s) provided. Also accepts a single regex."); filterByTagsOption.AddAlias("-t"); - var filterByCollectionOption = new Option("--filter-by-collection", "Filters OpenApiDocument by Postman collection provided"); + var filterByCollectionOption = new Option("--filter-by-collection", "Filters OpenApiDocument by Postman collection provided. Provide path to collection file."); filterByCollectionOption.AddAlias("-c"); var inlineLocalOption = new Option("--inlineLocal", "Inline local $ref instances"); From a84d495983f806355c9ffcdea0d1d0c3c5117da8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Mar 2022 21:13:35 +0000 Subject: [PATCH 130/752] Bump Microsoft.OpenApi.OData from 1.0.10-preview2 to 1.0.10-preview3 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.0.10-preview2 to 1.0.10-preview3. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 98def8818..128521424 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -46,7 +46,7 @@ - + From 57434c0b108ab667a9640b999eba588eed48a87e Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sat, 9 Apr 2022 16:57:03 -0400 Subject: [PATCH 131/752] Updated package version to preview6 --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 128521424..72ec16c0b 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 0.5.0-preview5 + 0.5.0-preview6 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From 9f0ef0ec05ba03ba058cdb1fd963bfa3639a6507 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 11 Apr 2022 22:45:23 -0400 Subject: [PATCH 132/752] Updated version numbers --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 72ec16c0b..52d0b3c1e 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 0.5.0-preview6 + 1.0.0-preview1 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From a1c2118296f8a796fd4cbcc08ef4f483e5963357 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 13 Apr 2022 11:45:59 +0300 Subject: [PATCH 133/752] Add an optional --terse output commandline option --- src/Microsoft.OpenApi.Hidi/Program.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 8b466913c..6d06a6986 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -39,6 +39,9 @@ static async Task Main(string[] args) var formatOption = new Option("--format", "File format"); formatOption.AddAlias("-f"); + var terseOutputOption = new Option("--terseOutput", "Produce terse json output"); + terseOutputOption.AddAlias("-to"); + var logLevelOption = new Option("--loglevel", () => LogLevel.Information, "The log level to use when logging messages to the main output."); logLevelOption.AddAlias("-ll"); @@ -74,6 +77,7 @@ static async Task Main(string[] args) cleanOutputOption, versionOption, formatOption, + terseOutputOption, logLevelOption, filterByOperationIdsOption, filterByTagsOption, @@ -82,8 +86,8 @@ static async Task Main(string[] args) inlineExternalOption }; - transformCommand.SetHandler ( - OpenApiService.TransformOpenApiDocument, descriptionOption, csdlOption, csdlFilterOption, outputOption, cleanOutputOption, versionOption, formatOption, logLevelOption, inlineLocalOption, inlineExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); + transformCommand.SetHandler ( + OpenApiService.TransformOpenApiDocument, descriptionOption, csdlOption, csdlFilterOption, outputOption, cleanOutputOption, versionOption, formatOption, terseOutputOption, logLevelOption, inlineLocalOption, inlineExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); From 5a238cb27a60d66817ae60eb9de51b7ba38f570a Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 13 Apr 2022 11:47:57 +0300 Subject: [PATCH 134/752] Pass the terseOutput option provided to the OpenApiWriter settings for serializing JSON in a terse format --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index feb62042b..3a333b89f 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -44,6 +44,7 @@ public static async Task TransformOpenApiDocument( bool cleanoutput, string? version, OpenApiFormat? format, + bool terseOutput, LogLevel loglevel, bool inlineLocal, bool inlineExternal, @@ -188,11 +189,13 @@ CancellationToken cancellationToken using var outputStream = output?.Create(); var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; - var settings = new OpenApiWriterSettings() + var settings = new OpenApiWriterSettings(); + if (terseOutput) { - InlineLocalReferences = inlineLocal, - InlineExternalReferences = inlineExternal - }; + settings.Terse = terseOutput; + } + settings.InlineLocalReferences = inlineLocal; + settings.InlineExternalReferences = inlineExternal; IOpenApiWriter writer = openApiFormat switch { From 2426196905c233550dc668d12adbc57be391df1b Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 13 Apr 2022 11:49:52 +0300 Subject: [PATCH 135/752] Update the command format to kebab case --- src/Microsoft.OpenApi.Hidi/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 6d06a6986..80a4c2e14 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -39,7 +39,7 @@ static async Task Main(string[] args) var formatOption = new Option("--format", "File format"); formatOption.AddAlias("-f"); - var terseOutputOption = new Option("--terseOutput", "Produce terse json output"); + var terseOutputOption = new Option("--terse-output", "Produce terse json output"); terseOutputOption.AddAlias("-to"); var logLevelOption = new Option("--loglevel", () => LogLevel.Information, "The log level to use when logging messages to the main output."); From 0fb2b734301aebfad329abf3d10b42426c3fd72b Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 14 Apr 2022 17:52:07 +0300 Subject: [PATCH 136/752] Add a terseOutput parameter to the OpenApiJsonWriter and refactor code --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 3a333b89f..584087ea7 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -189,17 +189,15 @@ CancellationToken cancellationToken using var outputStream = output?.Create(); var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; - var settings = new OpenApiWriterSettings(); - if (terseOutput) + var settings = new OpenApiWriterSettings() { - settings.Terse = terseOutput; - } - settings.InlineLocalReferences = inlineLocal; - settings.InlineExternalReferences = inlineExternal; + InlineLocalReferences = inlineLocal, + InlineExternalReferences = inlineExternal + }; IOpenApiWriter writer = openApiFormat switch { - OpenApiFormat.Json => new OpenApiJsonWriter(textWriter, settings), + OpenApiFormat.Json => terseOutput ? new OpenApiJsonWriter(textWriter, settings, terseOutput) : new OpenApiJsonWriter(textWriter, settings, false), OpenApiFormat.Yaml => new OpenApiYamlWriter(textWriter, settings), _ => throw new ArgumentException("Unknown format"), }; From ac5e63f28d8aed6c00345f7915b2492b9005091c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 May 2022 21:07:33 +0000 Subject: [PATCH 137/752] Bump Microsoft.OpenApi.OData from 1.0.10-preview3 to 1.0.10 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.0.10-preview3 to 1.0.10. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 52d0b3c1e..b03eb46c8 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -46,7 +46,7 @@ - + From 12ea889e0771fb826417f9c7067b308470ba893c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 11 May 2022 13:58:44 +0000 Subject: [PATCH 138/752] Bump Microsoft.OData.Edm from 7.10.0 to 7.11.0 Bumps Microsoft.OData.Edm from 7.10.0 to 7.11.0. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b03eb46c8..a5f3daf6c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -45,7 +45,7 @@ - + From d21f82d898bbad5c30c625a958ddf2824b739ec8 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 11 May 2022 10:03:13 -0400 Subject: [PATCH 139/752] - bumps hidi version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b03eb46c8..7fde25f88 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,14 +15,14 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.0.0-preview1 + 1.0.0-preview2 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET -- Upgrades Microsoft.OpenApi.OData to 1.0.10-preview1 -- Fixes an issue where hidi would not process async operations +- Upgrades Microsoft.OpenApi.OData to 1.0.10 +- Upgrades Microsoft.OData.Edm to 7.11.0 Microsoft.OpenApi.Hidi Microsoft.OpenApi.Hidi From b6a2c8165ec8ffe04408d82de2c53fb3f977b36b Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Wed, 11 May 2022 16:38:18 -0400 Subject: [PATCH 140/752] Configure CSDL via settings --- .../Microsoft.OpenApi.Hidi.csproj | 1 + src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 47 ++++++++++++------- src/Microsoft.OpenApi.Hidi/Program.cs | 17 +++++++ 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 52d0b3c1e..aaa081c05 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -47,6 +47,7 @@ + diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 584087ea7..4c24c0b4c 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -28,6 +28,7 @@ using System.Xml; using System.Runtime.CompilerServices; using System.Reflection; +using Microsoft.Extensions.Configuration; namespace Microsoft.OpenApi.Hidi { @@ -98,6 +99,7 @@ CancellationToken cancellationToken stream = ApplyFilter(csdl, csdlFilter, transform); stream.Position = 0; } + document = await ConvertCsdlToOpenApi(stream); stopwatch.Stop(); logger.LogTrace("{timestamp}ms: Generated OpenAPI with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); @@ -321,6 +323,14 @@ public static async Task ValidateOpenApiDocument( } + internal static IConfiguration GetConfiguration() + { + IConfiguration config = new ConfigurationBuilder() + .AddJsonFile("appsettings.json",true) + .Build(); + return config; + } + /// /// Converts CSDL to OpenAPI /// @@ -332,23 +342,28 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl) var csdlText = await reader.ReadToEndAsync(); var edmModel = CsdlReader.Parse(XElement.Parse(csdlText).CreateReader()); - var settings = new OpenApiConvertSettings() + var config = GetConfiguration(); + OpenApiConvertSettings settings = config.GetSection("OpenApiConvertSettings").Get(); + if (settings == null) { - AddSingleQuotesForStringParameters = true, - AddEnumDescriptionExtension = true, - DeclarePathParametersOnPathItem = true, - EnableKeyAsSegment = true, - EnableOperationId = true, - ErrorResponsesAsDefault = false, - PrefixEntityTypeNameBeforeKey = true, - TagDepth = 2, - EnablePagination = true, - EnableDiscriminatorValue = false, - EnableDerivedTypesReferencesForRequestBody = false, - EnableDerivedTypesReferencesForResponses = false, - ShowRootPath = false, - ShowLinks = false - }; + settings = new OpenApiConvertSettings() + { + AddSingleQuotesForStringParameters = true, + AddEnumDescriptionExtension = true, + DeclarePathParametersOnPathItem = true, + EnableKeyAsSegment = true, + EnableOperationId = true, + ErrorResponsesAsDefault = false, + PrefixEntityTypeNameBeforeKey = true, + TagDepth = 2, + EnablePagination = true, + EnableDiscriminatorValue = false, + EnableDerivedTypesReferencesForRequestBody = false, + EnableDerivedTypesReferencesForResponses = false, + ShowRootPath = false, + ShowLinks = false + }; + } OpenApiDocument document = edmModel.ConvertToOpenApi(settings); document = FixReferences(document); diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 80a4c2e14..09a9061ac 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -3,9 +3,15 @@ using System; using System.CommandLine; +using System.CommandLine.Builder; +using System.CommandLine.Hosting; +using System.CommandLine.Parsing; + using System.IO; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; namespace Microsoft.OpenApi.Hidi @@ -92,9 +98,20 @@ static async Task Main(string[] args) rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); + // Parse the incoming args and invoke the handler await rootCommand.InvokeAsync(args); + + //await new CommandLineBuilder(rootCommand) + // .UseHost(_ => Host.CreateDefaultBuilder(), + // host => { + // var config = host.Services.GetRequiredService(); + // }) + // .UseDefaults() + // .Build() + // .InvokeAsync(args); + //// Wait for logger to write messages to the console before exiting await Task.Delay(10); } From 60a238855deb751dd14910cd158af901c1043189 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 16 May 2022 08:46:45 -0400 Subject: [PATCH 141/752] - enables discriminator for conversion in hidi --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 5 ++--- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 71674e395..cf0c69bc2 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,14 +15,13 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.0.0-preview2 + 1.0.0-preview3 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET -- Upgrades Microsoft.OpenApi.OData to 1.0.10 -- Upgrades Microsoft.OData.Edm to 7.11.0 +- Enables discriminator values Microsoft.OpenApi.Hidi Microsoft.OpenApi.Hidi diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 584087ea7..887f5326b 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -343,7 +343,7 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl) PrefixEntityTypeNameBeforeKey = true, TagDepth = 2, EnablePagination = true, - EnableDiscriminatorValue = false, + EnableDiscriminatorValue = true, EnableDerivedTypesReferencesForRequestBody = false, EnableDerivedTypesReferencesForResponses = false, ShowRootPath = false, From 3b33435affc2d722b3875056782b55c5495ded7c Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Tue, 17 May 2022 20:28:15 +0300 Subject: [PATCH 142/752] Add new OpenAPI convert setting --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 887f5326b..0adfca1e7 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -347,7 +347,8 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl) EnableDerivedTypesReferencesForRequestBody = false, EnableDerivedTypesReferencesForResponses = false, ShowRootPath = false, - ShowLinks = false + ShowLinks = false, + ExpandDerivedTypesNavigationProperties = false }; OpenApiDocument document = edmModel.ConvertToOpenApi(settings); From c44231791a77f1a0fc12c2b9be66197d2c7300e8 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Tue, 17 May 2022 21:23:01 +0300 Subject: [PATCH 143/752] Bump lib. version and update release note --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index cf0c69bc2..4d2dc417d 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,13 +15,14 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.0.0-preview3 + 1.0.0-preview4 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET - Enables discriminator values +- Adds new OpenAPI convert setting, ExpandDerivedTypesNavigationProperties and sets it to false Microsoft.OpenApi.Hidi Microsoft.OpenApi.Hidi From 83e8f641c941e88d2414f2fdafefd53920f9d204 Mon Sep 17 00:00:00 2001 From: Carol Kigoonya Date: Thu, 19 May 2022 08:51:24 +0300 Subject: [PATCH 144/752] Add files via upload --- src/Microsoft.OpenApi.Hidi/readme.md | 88 ++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 src/Microsoft.OpenApi.Hidi/readme.md diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md new file mode 100644 index 000000000..1bc3187fd --- /dev/null +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -0,0 +1,88 @@ +# Overview + +Hidi is a command line tool that makes it easy to work with and transform OpenAPI documents. The tool enables you validate and apply transformations to and from different file formats using various commands to do different actions on the files. + +## Capabilities +Hidi has these key capabilities that enable you to build different scenarios off the tool + • Validation of OpenAPI files + • Conversion of OpenAPI files into different file formats: convert files from JSON to YAML, YAML to JSON + • Slice or filter OpenAPI documents to smaller subsets using operationIDs and tags + + +## Installation + +Install [Microsoft.OpenApi.Hidi](https://www.nuget.org/packages/Microsoft.OpenApi.Hidi/1.0.0-preview4) package from NuGet by running the following command: + +### .NET CLI(Global) + 1. dotnet tool install --global Microsoft.OpenApi.Hidi --version 0.5.0-preview4 + +### .NET CLI(local) + + 1. dotnet new tool-manifest #if you are setting up the OpenAPI.NET repo + 2. dotnet tool install --local Microsoft.OpenApi.Hidi --version 0.5.0-preview4 + + + +## How to use Hidi +Once you've installed the package locally, you can invoke the Hidi by running: hidi [command]. +You can access the list of command options we have by running hidi -h +The tool avails the following commands: + + • Validate + • Transform + +### Validate +This command option accepts an OpenAPI document as an input parameter, visits multiple OpenAPI elements within the document and returns statistics count report on the following elements: + + • Path Items + • Operations + • Parameters + • Request bodies + • Responses + • Links + • Callbacks + • Schemas + +It accepts the following command: + + • --openapi(-d) - OpenAPI description file path or URL + • --loglevel(-ll) - The log level to use when logging messages to the main output + + +**Example:** hidi.exe validate --openapi C:\OpenApidocs\Mail.yml --loglevel trace +Run validate -h to see the options available. + +### Transform +Used to convert file formats from JSON to YAML and vice versa and performs slicing of OpenAPI documents. + +This command accepts the following parameters: + + • --openapi(-d) - OpenAPI description file path in the local filesystem or a valid URL hosted on a HTTPS server + • --csdl(-cs) - CSDL file path in the local filesystem or a valid URL hosted on a HTTPS server + • --csdlfilter(-csf) - a filter parameter that a user can use to select a subset of a large CSDL file. They do so by providing a comma delimited list of EntitySet and Singleton names that appear in the EntityContainer. + • --output(-o) - Output directory path for the transformed document + • --clean-ouput(-co) - an optional param that allows a user to overwrite an existing file. + • --version(-v) - OpenAPI specification version + • --format(-f) - File format + • --loglevel(-ll) - The log level to use when logging messages to the main output + • --inline(-i) - Inline $ref instances + • --resolveExternal(-ex) - Resolve external $refs + • --filterByOperationIds(-op) - Slice document based on OperationId(s) provided. Accepts a comma delimited list of operation ids. + • --filterByTags(-t) - Slice document based on tag(s) provided. Accepts a comma delimited list of tags. + • --filterByCollection(-c) - Slices the OpenAPI document based on the Postman Collection file generated by Resource Explorer + + **Examples:** + + 1. Filtering by OperationIds + hidi transform -d files\People.yml -f yaml -o files\People.yml -v OpenApi3_0 -op users_UpdateInsights -co + + 2. Filtering by Postman collection + hidi transform --openapi files\People.yml --format yaml --output files\People2.yml --version OpenApi3_0 --filterByCollection Graph-Collection-0017059134807617005.postman_collection.json + + 3. CSDL--->OpenAPI conversion and filtering + hidi transform --input Files/Todo.xml --output Files/Todo-subset.yml --format yaml --version OpenApi3_0 --filterByOperationIds Todos.Todo.UpdateTodo + + 4. CSDL Filtering by EntitySets and Singletons + hidi transform -cs dataverse.csdl --csdlFilter "appointments,opportunities" -o appointmentsAndOpportunities.yaml -ll trace + +Run transform -h to see all the available usage options. \ No newline at end of file From a49c686fe42c59587e3208552f967da7f5be8a06 Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 19 May 2022 09:46:04 -0400 Subject: [PATCH 145/752] Changed explicit version parameter to --prerelease --- src/Microsoft.OpenApi.Hidi/readme.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md index 1bc3187fd..71c32cb1c 100644 --- a/src/Microsoft.OpenApi.Hidi/readme.md +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -14,12 +14,14 @@ Hidi has these key capabilities that enable you to build different scenarios off Install [Microsoft.OpenApi.Hidi](https://www.nuget.org/packages/Microsoft.OpenApi.Hidi/1.0.0-preview4) package from NuGet by running the following command: ### .NET CLI(Global) - 1. dotnet tool install --global Microsoft.OpenApi.Hidi --version 0.5.0-preview4 + 1. dotnet tool install --global Microsoft.OpenApi.Hidi --prerelease + ### .NET CLI(local) 1. dotnet new tool-manifest #if you are setting up the OpenAPI.NET repo - 2. dotnet tool install --local Microsoft.OpenApi.Hidi --version 0.5.0-preview4 + 2. dotnet tool install --local Microsoft.OpenApi.Hidi --prerelease + @@ -49,7 +51,8 @@ It accepts the following command: • --loglevel(-ll) - The log level to use when logging messages to the main output -**Example:** hidi.exe validate --openapi C:\OpenApidocs\Mail.yml --loglevel trace +**Example:** `hidi.exe validate --openapi C:\OpenApidocs\Mail.yml --loglevel trace` + Run validate -h to see the options available. ### Transform From 94c3def36a223dd0f8194d3d5d7c4f8ba42ae40d Mon Sep 17 00:00:00 2001 From: Darrel Date: Thu, 19 May 2022 10:07:00 -0400 Subject: [PATCH 146/752] Update readme.md --- src/Microsoft.OpenApi.Hidi/readme.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md index 71c32cb1c..6295c5c99 100644 --- a/src/Microsoft.OpenApi.Hidi/readme.md +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -4,6 +4,7 @@ Hidi is a command line tool that makes it easy to work with and transform OpenAP ## Capabilities Hidi has these key capabilities that enable you to build different scenarios off the tool + • Validation of OpenAPI files • Conversion of OpenAPI files into different file formats: convert files from JSON to YAML, YAML to JSON • Slice or filter OpenAPI documents to smaller subsets using operationIDs and tags @@ -88,4 +89,4 @@ This command accepts the following parameters: 4. CSDL Filtering by EntitySets and Singletons hidi transform -cs dataverse.csdl --csdlFilter "appointments,opportunities" -o appointmentsAndOpportunities.yaml -ll trace -Run transform -h to see all the available usage options. \ No newline at end of file +Run transform -h to see all the available usage options. From 4dcb165e4bf93fe3550f8bb1a2f6315a65fd02ab Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 20 May 2022 10:19:23 -0400 Subject: [PATCH 147/752] - normalizes inlining parameters to kebab case --- src/Microsoft.OpenApi.Hidi/Program.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 80a4c2e14..e9d44c41d 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -54,10 +54,10 @@ static async Task Main(string[] args) var filterByCollectionOption = new Option("--filter-by-collection", "Filters OpenApiDocument by Postman collection provided. Provide path to collection file."); filterByCollectionOption.AddAlias("-c"); - var inlineLocalOption = new Option("--inlineLocal", "Inline local $ref instances"); + var inlineLocalOption = new Option("--inline-local", "Inline local $ref instances"); inlineLocalOption.AddAlias("-il"); - var inlineExternalOption = new Option("--inlineExternal", "Inline external $ref instances"); + var inlineExternalOption = new Option("--inline-external", "Inline external $ref instances"); inlineExternalOption.AddAlias("-ie"); var validateCommand = new Command("validate") From a01a450fb84cd17bd1eb41bf14a4c2e6251b85ba Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 20 May 2022 10:22:14 -0400 Subject: [PATCH 148/752] - aligns on two dashes for more than one character shorthands --- src/Microsoft.OpenApi.Hidi/Program.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index e9d44c41d..97fa776cc 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -22,16 +22,16 @@ static async Task Main(string[] args) descriptionOption.AddAlias("-d"); var csdlOption = new Option("--csdl", "Input CSDL file path or URL"); - csdlOption.AddAlias("-cs"); + csdlOption.AddAlias("--cs"); var csdlFilterOption = new Option("--csdl-filter", "Comma delimited list of EntitySets or Singletons to filter CSDL on. e.g. tasks,accounts"); - csdlFilterOption.AddAlias("-csf"); + csdlFilterOption.AddAlias("--csf"); var outputOption = new Option("--output", () => new FileInfo("./output"), "The output directory path for the generated file.") { Arity = ArgumentArity.ZeroOrOne }; outputOption.AddAlias("-o"); var cleanOutputOption = new Option("--clean-output", "Overwrite an existing file"); - cleanOutputOption.AddAlias("-co"); + cleanOutputOption.AddAlias("--co"); var versionOption = new Option("--version", "OpenAPI specification version"); versionOption.AddAlias("-v"); @@ -40,25 +40,25 @@ static async Task Main(string[] args) formatOption.AddAlias("-f"); var terseOutputOption = new Option("--terse-output", "Produce terse json output"); - terseOutputOption.AddAlias("-to"); + terseOutputOption.AddAlias("--to"); var logLevelOption = new Option("--loglevel", () => LogLevel.Information, "The log level to use when logging messages to the main output."); - logLevelOption.AddAlias("-ll"); + logLevelOption.AddAlias("--ll"); var filterByOperationIdsOption = new Option("--filter-by-operationids", "Filters OpenApiDocument by comma delimited list of OperationId(s) provided"); - filterByOperationIdsOption.AddAlias("-op"); + filterByOperationIdsOption.AddAlias("--op"); var filterByTagsOption = new Option("--filter-by-tags", "Filters OpenApiDocument by comma delimited list of Tag(s) provided. Also accepts a single regex."); - filterByTagsOption.AddAlias("-t"); + filterByTagsOption.AddAlias("--t"); var filterByCollectionOption = new Option("--filter-by-collection", "Filters OpenApiDocument by Postman collection provided. Provide path to collection file."); filterByCollectionOption.AddAlias("-c"); var inlineLocalOption = new Option("--inline-local", "Inline local $ref instances"); - inlineLocalOption.AddAlias("-il"); + inlineLocalOption.AddAlias("--il"); var inlineExternalOption = new Option("--inline-external", "Inline external $ref instances"); - inlineExternalOption.AddAlias("-ie"); + inlineExternalOption.AddAlias("--ie"); var validateCommand = new Command("validate") { From 932735a42082701a82d3fae47e836c60d515872e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 20 May 2022 10:23:33 -0400 Subject: [PATCH 149/752] - aligns log level on kebab casing convention --- src/Microsoft.OpenApi.Hidi/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 97fa776cc..c8ba8fdcd 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -42,7 +42,7 @@ static async Task Main(string[] args) var terseOutputOption = new Option("--terse-output", "Produce terse json output"); terseOutputOption.AddAlias("--to"); - var logLevelOption = new Option("--loglevel", () => LogLevel.Information, "The log level to use when logging messages to the main output."); + var logLevelOption = new Option("--log-level", () => LogLevel.Information, "The log level to use when logging messages to the main output."); logLevelOption.AddAlias("--ll"); var filterByOperationIdsOption = new Option("--filter-by-operationids", "Filters OpenApiDocument by comma delimited list of OperationId(s) provided"); From 1183c81c62d85509ce531df19097f7564dc128b8 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 27 May 2022 10:03:40 -0400 Subject: [PATCH 150/752] - fixes an issue where log entries would be missing Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 0adfca1e7..8e1838d95 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -54,7 +54,8 @@ public static async Task TransformOpenApiDocument( CancellationToken cancellationToken ) { - var logger = ConfigureLoggerInstance(loglevel); + using var loggerFactory = ConfigureLoggerInstance(loglevel); + var logger = loggerFactory.CreateLogger(); try { @@ -258,7 +259,8 @@ public static async Task ValidateOpenApiDocument( LogLevel loglevel, CancellationToken cancellationToken) { - var logger = ConfigureLoggerInstance(loglevel); + using var loggerFactory = ConfigureLoggerInstance(loglevel); + var logger = loggerFactory.CreateLogger(); try { @@ -573,14 +575,14 @@ private static OpenApiFormat GetOpenApiFormat(string input, ILogger logger) return !input.StartsWith("http") && Path.GetExtension(input) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml; } - private static ILogger ConfigureLoggerInstance(LogLevel loglevel) + private static ILoggerFactory ConfigureLoggerInstance(LogLevel loglevel) { // Configure logger options #if DEBUG loglevel = loglevel > LogLevel.Debug ? LogLevel.Debug : loglevel; #endif - var logger = LoggerFactory.Create((builder) => { + return LoggerFactory.Create((builder) => { builder .AddSimpleConsole(c => { c.IncludeScopes = true; @@ -589,9 +591,7 @@ private static ILogger ConfigureLoggerInstance(LogLevel loglevel) .AddDebug() #endif .SetMinimumLevel(loglevel); - }).CreateLogger(); - - return logger; + }); } } } From 0e66f96502efbff5dfd7a195d1d711d2ecc9f501 Mon Sep 17 00:00:00 2001 From: Irvine Date: Tue, 7 Jun 2022 15:17:35 +0300 Subject: [PATCH 151/752] Bump conversion lib version and hidi version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 4d2dc417d..00f726e0c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.0.0-preview4 + 1.0.0-preview5 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET @@ -46,7 +46,7 @@ - + From 8344c04fe34eb632460c3c16692b34dea871fe90 Mon Sep 17 00:00:00 2001 From: Irvine Date: Tue, 7 Jun 2022 15:33:58 +0300 Subject: [PATCH 152/752] Adds entry to the csproj release notes --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 00f726e0c..6bc530517 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -23,6 +23,7 @@ - Enables discriminator values - Adds new OpenAPI convert setting, ExpandDerivedTypesNavigationProperties and sets it to false +- Bumps up the Microsoft.OpenApi.OData library to v1.0.11-preview2 Microsoft.OpenApi.Hidi Microsoft.OpenApi.Hidi From 5ff26009e46f413af30535e21bdf19b508ee1954 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 21 Jun 2022 11:45:08 -0400 Subject: [PATCH 153/752] - adds docker image definition for hidi --- Dockerfile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..8326ce3b9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env +WORKDIR /app + +COPY ./src ./hidi/src +WORKDIR /app/hidi +RUN dotnet publish ./src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -c Release + +FROM mcr.microsoft.com/dotnet/runtime:6.0 as runtime +WORKDIR /app + +COPY --from=build-env /app/hidi/src/Microsoft.OpenApi.Hidi/bin/Release/net6.0 ./ + +VOLUME /app/output +VOLUME /app/openapi.yml +VOLUME /app/api.csdl +VOLUME /app/collection.json +ENV HIDI_CONTAINER=true DOTNET_TieredPGO=1 DOTNET_TC_QuickJitForLoops=1 +ENTRYPOINT ["dotnet", "Microsoft.OpenApi.Hidi.dll"] +LABEL description="# Welcome to Hidi \ +To start transforming OpenAPI documents checkout [the getting started documentation](https://github.com/microsoft/OpenAPI.NET/tree/vnext/src/Microsoft.OpenApi.Hidi) \ +[Source dockerfile](https://github.com/microsoft/OpenAPI.NET/blob/vnext/Dockerfile)" From cbc3178660edfd53fa0920d9ee2ee02ef6c64bde Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Jun 2022 21:55:42 +0000 Subject: [PATCH 154/752] Bump Microsoft.OData.Edm from 7.11.0 to 7.12.0 Bumps Microsoft.OData.Edm from 7.11.0 to 7.12.0. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 6bc530517..d1b3724db 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -46,7 +46,7 @@ - + From a6181e58301e71d56af43181ea931ff32124aa0f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Jun 2022 03:17:27 +0000 Subject: [PATCH 155/752] Bump Microsoft.OpenApi.OData from 1.0.11-preview2 to 1.0.11-preview3 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.0.11-preview2 to 1.0.11-preview3. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index d1b3724db..154e2d552 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -47,7 +47,7 @@ - + From e95d6b28e1df772d3dc2f54fbb056c0a40753961 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 23 Jun 2022 13:17:59 -0400 Subject: [PATCH 156/752] - adds release notes Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 154e2d552..f885e8d6f 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,15 +15,15 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.0.0-preview5 + 1.0.0-preview6 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET -- Enables discriminator values -- Adds new OpenAPI convert setting, ExpandDerivedTypesNavigationProperties and sets it to false -- Bumps up the Microsoft.OpenApi.OData library to v1.0.11-preview2 +- Bumps up the Microsoft.OpenAPI library to v1.3.2 +- Bumps up the Microsoft.OData library to v7.12.0 +- Bumps up the Microsoft.OpenApi.OData library to v1.0.11-preview3 Microsoft.OpenApi.Hidi Microsoft.OpenApi.Hidi From 35f4701b6621bb6226875b3b333e744ea70e195f Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 6 Jul 2022 12:55:20 +0300 Subject: [PATCH 157/752] Updates csproj release notes to point to Github release notes --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index f885e8d6f..27bf00b5b 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -20,11 +20,7 @@ © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET - -- Bumps up the Microsoft.OpenAPI library to v1.3.2 -- Bumps up the Microsoft.OData library to v7.12.0 -- Bumps up the Microsoft.OpenApi.OData library to v1.0.11-preview3 - + https://github.com/microsoft/OpenAPI.NET/releases/tag/1.3.3 Microsoft.OpenApi.Hidi Microsoft.OpenApi.Hidi true From b0d46576af87d56f65861799b6916f89bb5d34d9 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 6 Jul 2022 08:21:59 -0400 Subject: [PATCH 158/752] - releases hidi with discriminator fix Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index f885e8d6f..c5d6562aa 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,15 +15,13 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.0.0-preview6 + 1.0.0-preview7 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET -- Bumps up the Microsoft.OpenAPI library to v1.3.2 -- Bumps up the Microsoft.OData library to v7.12.0 -- Bumps up the Microsoft.OpenApi.OData library to v1.0.11-preview3 +- Bumps up the Microsoft.OpenApi.OData library to v1.0.11-preview4 Microsoft.OpenApi.Hidi Microsoft.OpenApi.Hidi @@ -47,7 +45,7 @@ - + From 58a8518857f9fff800c6127330421ffee4d94384 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 7 Jul 2022 13:05:08 +0300 Subject: [PATCH 159/752] Infer input file path extension and add it to the default output path --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 26 +++++++++++++++----- src/Microsoft.OpenApi.Hidi/Program.cs | 2 +- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 8e1838d95..934b00cda 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -63,10 +63,11 @@ CancellationToken cancellationToken { throw new ArgumentException("Please input a file path"); } - if(output == null) + if (output == null) { - throw new ArgumentNullException(nameof(output)); - } + var inputExtension = GetInputPathExtension(openapi, csdl); + output = new FileInfo($"./output{inputExtension}"); + }; if (cleanoutput && output.Exists) { output.Delete(); @@ -249,8 +250,6 @@ private static Stream ApplyFilter(string csdl, string entitySetOrSingleton, XslC return stream; } - - /// /// Implementation of the validate command /// @@ -575,6 +574,21 @@ private static OpenApiFormat GetOpenApiFormat(string input, ILogger logger) return !input.StartsWith("http") && Path.GetExtension(input) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml; } + private static string GetInputPathExtension(string openapi = null, string csdl = null) + { + var extension = String.Empty; + if (!string.IsNullOrEmpty(openapi)) + { + extension = Path.GetExtension(openapi); + } + if (!string.IsNullOrEmpty(csdl)) + { + extension = ".yml"; + } + + return extension; + } + private static ILoggerFactory ConfigureLoggerInstance(LogLevel loglevel) { // Configure logger options diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index c8ba8fdcd..d19e48cf4 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -27,7 +27,7 @@ static async Task Main(string[] args) var csdlFilterOption = new Option("--csdl-filter", "Comma delimited list of EntitySets or Singletons to filter CSDL on. e.g. tasks,accounts"); csdlFilterOption.AddAlias("--csf"); - var outputOption = new Option("--output", () => new FileInfo("./output"), "The output directory path for the generated file.") { Arity = ArgumentArity.ZeroOrOne }; + var outputOption = new Option("--output", "The output directory path for the generated file.") { Arity = ArgumentArity.ZeroOrOne }; outputOption.AddAlias("-o"); var cleanOutputOption = new Option("--clean-output", "Overwrite an existing file"); From 151d20dfe685bb019290589b7a611dcd5b4fd3ca Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 7 Jul 2022 13:05:26 +0300 Subject: [PATCH 160/752] Move Hidi tests to own test project --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 54 +++++++++++++++++++ .../Services/OpenApiFilterServiceTests.cs | 0 .../Services/OpenApiServiceTests.cs | 0 .../UtilityFiles/OpenApiDocumentMock.cs | 0 .../UtilityFiles/Todo.xml | 0 .../UtilityFiles/postmanCollection_ver1.json | 0 .../UtilityFiles/postmanCollection_ver2.json | 0 .../UtilityFiles/postmanCollection_ver3.json | 0 .../UtilityFiles/postmanCollection_ver4.json | 0 9 files changed, 54 insertions(+) create mode 100644 Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj rename {test/Microsoft.OpenApi.Tests => Microsoft.OpenApi.Hidi.Tests}/Services/OpenApiFilterServiceTests.cs (100%) rename {test/Microsoft.OpenApi.Tests => Microsoft.OpenApi.Hidi.Tests}/Services/OpenApiServiceTests.cs (100%) rename {test/Microsoft.OpenApi.Tests => Microsoft.OpenApi.Hidi.Tests}/UtilityFiles/OpenApiDocumentMock.cs (100%) rename {test/Microsoft.OpenApi.Tests => Microsoft.OpenApi.Hidi.Tests}/UtilityFiles/Todo.xml (100%) rename {test/Microsoft.OpenApi.Tests => Microsoft.OpenApi.Hidi.Tests}/UtilityFiles/postmanCollection_ver1.json (100%) rename {test/Microsoft.OpenApi.Tests => Microsoft.OpenApi.Hidi.Tests}/UtilityFiles/postmanCollection_ver2.json (100%) rename {test/Microsoft.OpenApi.Tests => Microsoft.OpenApi.Hidi.Tests}/UtilityFiles/postmanCollection_ver3.json (100%) rename {test/Microsoft.OpenApi.Tests => Microsoft.OpenApi.Hidi.Tests}/UtilityFiles/postmanCollection_ver4.json (100%) diff --git a/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj new file mode 100644 index 000000000..d179b0f57 --- /dev/null +++ b/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -0,0 +1,54 @@ + + + + net6.0 + enable + enable + + false + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + + + Always + + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + + diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs b/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs similarity index 100% rename from test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs rename to Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs b/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs similarity index 100% rename from test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs rename to Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs diff --git a/test/Microsoft.OpenApi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs similarity index 100% rename from test/Microsoft.OpenApi.Tests/UtilityFiles/OpenApiDocumentMock.cs rename to Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs diff --git a/test/Microsoft.OpenApi.Tests/UtilityFiles/Todo.xml b/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/Todo.xml similarity index 100% rename from test/Microsoft.OpenApi.Tests/UtilityFiles/Todo.xml rename to Microsoft.OpenApi.Hidi.Tests/UtilityFiles/Todo.xml diff --git a/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver1.json b/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver1.json similarity index 100% rename from test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver1.json rename to Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver1.json diff --git a/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver2.json b/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver2.json similarity index 100% rename from test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver2.json rename to Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver2.json diff --git a/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver3.json b/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver3.json similarity index 100% rename from test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver3.json rename to Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver3.json diff --git a/test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver4.json b/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver4.json similarity index 100% rename from test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver4.json rename to Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver4.json From 3d78ea99e9bab57655ebbe3f8c10d3630d8b537d Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 7 Jul 2022 18:43:39 +0300 Subject: [PATCH 161/752] Use else if() clause --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 934b00cda..d9f9887e1 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -581,7 +581,7 @@ private static string GetInputPathExtension(string openapi = null, string csdl = { extension = Path.GetExtension(openapi); } - if (!string.IsNullOrEmpty(csdl)) + else if (!string.IsNullOrEmpty(csdl)) { extension = ".yml"; } From a878967bd64f3463ee9ff104f3d85db7cef1a7c3 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 7 Jul 2022 18:45:31 +0300 Subject: [PATCH 162/752] Upgrade dependencies --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index d179b0f57..fb6eaecc1 100644 --- a/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -9,10 +9,10 @@ - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all From b2a11ebc045d6c852a5602e0d929cfd634007a5f Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 8 Jul 2022 12:13:50 -0400 Subject: [PATCH 163/752] - bumps hidi version and reference to conversion lib Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index cee484046..1cb71a20a 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.0.0-preview7 + 1.0.0-preview8 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET @@ -43,7 +43,7 @@ - + From 3259881eeb711af4412ea49d48a8c1ce70107097 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 9 Jul 2022 18:44:59 +1000 Subject: [PATCH 164/752] remove duplicate SourceLink --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 1cb71a20a..b6b0292c4 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -51,8 +51,4 @@ - - - - From c45a1a9227a64769836ae43d1dc2318ee220ee92 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 14 Jul 2022 16:59:15 +0300 Subject: [PATCH 165/752] Adds test for retrieving path parameters --- .../Services/OpenApiFilterServiceTests.cs | 19 +++++++++++- .../UtilityFiles/OpenApiDocumentMock.cs | 30 ++++++++++++++++++- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 29cb684d2..176fb20d1 100644 --- a/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -135,5 +135,22 @@ public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidArguments var message2 = Assert.Throws(() => OpenApiFilterService.CreatePredicate("users.user.ListUser", "users.user")).Message; Assert.Equal("Cannot specify both operationIds and tags at the same time.", message2); } + + [Theory] + [InlineData("reports.getTeamsUserActivityUserDetail-a3f1", null)] + [InlineData(null, "reports.Functions")] + public void ReturnsPathParametersOnSlicingBasedOnOperationIdsOrTags(string operationIds, string tags) + { + // Act + var predicate = OpenApiFilterService.CreatePredicate(operationIds, tags); + var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(_openApiDocumentMock, predicate); + + // Assert + foreach (var pathItem in subsetOpenApiDocument.Paths) + { + Assert.True(pathItem.Value.Parameters.Any()); + Assert.Equal(1, pathItem.Value.Parameters.Count); + } + } } } diff --git a/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index d21fccb9a..58b85d91d 100644 --- a/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -116,6 +116,21 @@ public static OpenApiDocument CreateOpenApiDocument() } } } + }, + Parameters = new List + { + { + new OpenApiParameter() + { + Name = "period", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema() + { + Type = "string" + } + } + } } }, ["/reports/microsoft.graph.getTeamsUserActivityUserDetail(date={date})"] = new OpenApiPathItem() @@ -175,7 +190,20 @@ public static OpenApiDocument CreateOpenApiDocument() } } } - } + }, + Parameters = new List + { + new OpenApiParameter + { + Name = "period", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema() + { + Type = "string" + } + } + } }, ["/users"] = new OpenApiPathItem() { From 88acad3d9bb73b6b1c9198bc9482d1c52a1d5e18 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Jul 2022 21:41:14 +0000 Subject: [PATCH 166/752] Bump Microsoft.OpenApi.OData from 1.0.11-preview5 to 1.0.11 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.0.11-preview5 to 1.0.11. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b6b0292c4..0eefee6db 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From 4b77a2092d8e2b0bb05e24f55125363baf717d92 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Tue, 19 Jul 2022 11:12:29 +0300 Subject: [PATCH 167/752] Bumps Hidi version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 0eefee6db..cb67b1211 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.0.0-preview8 + 1.0.0-preview9 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From 1682331dba85cf4a3717777ac5e403d51d37e41d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 20 Jul 2022 21:23:33 +0000 Subject: [PATCH 168/752] Bump Microsoft.OData.Edm from 7.12.0 to 7.12.1 Bumps Microsoft.OData.Edm from 7.12.0 to 7.12.1. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index cb67b1211..f9e1f0d9e 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -42,7 +42,7 @@ - + From be071729cf609a6b56a0113c9e93e50d17ebd8f3 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 1 Aug 2022 10:45:28 +0300 Subject: [PATCH 169/752] Bumps up System.Commandline API to v2.0.0-beta4.22272.1 and resolve breaking change --- .../Handlers/TransformCommandHandler.cs | 73 +++++++++++++++++++ .../Handlers/ValidateCommandHandler.cs | 49 +++++++++++++ .../Microsoft.OpenApi.Hidi.csproj | 14 ++-- src/Microsoft.OpenApi.Hidi/Program.cs | 28 +++++-- 4 files changed, 152 insertions(+), 12 deletions(-) create mode 100644 src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs create mode 100644 src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs new file mode 100644 index 000000000..8123f4620 --- /dev/null +++ b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System; +using System.CommandLine; +using System.CommandLine.Invocation; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; + +namespace Microsoft.OpenApi.Hidi.Handlers +{ + internal class TransformCommandHandler : ICommandHandler + { + public Option DescriptionOption { get; set; } + public Option CsdlOption { get; set; } + public Option CsdlFilterOption { get; set; } + public Option OutputOption { get; set; } + public Option CleanOutputOption { get; set; } + public Option VersionOption { get; set; } + public Option FormatOption { get; set; } + public Option TerseOutputOption { get; set; } + public Option LogLevelOption { get; set; } + public Option FilterByOperationIdsOption { get; set; } + public Option FilterByTagsOption { get; set; } + public Option FilterByCollectionOption { get; set; } + public Option InlineLocalOption { get; set; } + public Option InlineExternalOption { get; set; } + + public int Invoke(InvocationContext context) + { + return InvokeAsync(context).GetAwaiter().GetResult(); + } + public async Task InvokeAsync(InvocationContext context) + { + string openapi = context.ParseResult.GetValueForOption(DescriptionOption); + string csdlFilter = context.ParseResult.GetValueForOption(CsdlFilterOption); + string csdl = context.ParseResult.GetValueForOption(CsdlOption); + FileInfo output = context.ParseResult.GetValueForOption(OutputOption); + bool cleanOutput = context.ParseResult.GetValueForOption(CleanOutputOption); + string? version = context.ParseResult.GetValueForOption(VersionOption); + OpenApiFormat? format = context.ParseResult.GetValueForOption(FormatOption); + bool terseOutput = context.ParseResult.GetValueForOption(TerseOutputOption); + LogLevel logLevel = context.ParseResult.GetValueForOption(LogLevelOption); + bool inlineLocal = context.ParseResult.GetValueForOption(InlineLocalOption); + bool inlineExternal = context.ParseResult.GetValueForOption(InlineExternalOption); + string filterbyoperationids = context.ParseResult.GetValueForOption(FilterByOperationIdsOption); + string filterbytags = context.ParseResult.GetValueForOption(FilterByTagsOption); + string filterbycollection = context.ParseResult.GetValueForOption(FilterByCollectionOption); + CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetService(typeof(CancellationToken)); + + var logger = Logger.ConfigureLogger(logLevel); + + try + { + await OpenApiService.TransformOpenApiDocument(openapi, csdl, csdlFilter, output, cleanOutput, version, format, terseOutput, logLevel, inlineLocal, inlineExternal, filterbyoperationids, filterbytags, filterbycollection, cancellationToken); + + return 0; + } + catch (Exception ex) + { +#if DEBUG + logger.LogCritical(ex, ex.Message); + throw; // so debug tools go straight to the source of the exception when attached +#else + logger.LogCritical( ex.Message); + return 1; +#endif + } + } + } +} diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs new file mode 100644 index 000000000..84ffcc122 --- /dev/null +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System; +using System.CommandLine; +using System.CommandLine.Invocation; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; + +namespace Microsoft.OpenApi.Hidi.Handlers +{ + internal class ValidateCommandHandler : ICommandHandler + { + public Option DescriptionOption { get; set; } + public Option LogLevelOption { get; set; } + + public int Invoke(InvocationContext context) + { + return InvokeAsync(context).GetAwaiter().GetResult(); + } + public async Task InvokeAsync(InvocationContext context) + { + string openapi = context.ParseResult.GetValueForOption(DescriptionOption); + LogLevel logLevel = context.ParseResult.GetValueForOption(LogLevelOption); + CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetService(typeof(CancellationToken)); + + + var logger = Logger.ConfigureLogger(logLevel); + + try + { + await OpenApiService.ValidateOpenApiDocument(openapi, logLevel, cancellationToken); + return 0; + } + catch (Exception ex) + { +#if DEBUG + logger.LogCritical(ex, ex.Message); + throw; // so debug tools go straight to the source of the exception when attached +#else + logger.LogCritical( ex.Message); + Environment.Exit(1); + return 1; +#endif + } + } + } +} diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index cee484046..e48cecc8b 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -37,13 +37,13 @@ - - - - - - - + + + + + + + diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index c8ba8fdcd..88c72fa8b 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -1,12 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; using System.CommandLine; using System.IO; -using System.Threading; using System.Threading.Tasks; using Microsoft.Extensions.Logging; +using Microsoft.OpenApi.Hidi.Handlers; namespace Microsoft.OpenApi.Hidi { @@ -66,7 +65,11 @@ static async Task Main(string[] args) logLevelOption }; - validateCommand.SetHandler(OpenApiService.ValidateOpenApiDocument, descriptionOption, logLevelOption); + validateCommand.Handler = new ValidateCommandHandler + { + DescriptionOption = descriptionOption, + LogLevelOption = logLevelOption + }; var transformCommand = new Command("transform") { @@ -86,8 +89,23 @@ static async Task Main(string[] args) inlineExternalOption }; - transformCommand.SetHandler ( - OpenApiService.TransformOpenApiDocument, descriptionOption, csdlOption, csdlFilterOption, outputOption, cleanOutputOption, versionOption, formatOption, terseOutputOption, logLevelOption, inlineLocalOption, inlineExternalOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption); + transformCommand.Handler = new TransformCommandHandler + { + DescriptionOption = descriptionOption, + CsdlOption = csdlOption, + CsdlFilterOption = csdlFilterOption, + OutputOption = outputOption, + CleanOutputOption = cleanOutputOption, + VersionOption = versionOption, + FormatOption = formatOption, + TerseOutputOption = terseOutputOption, + LogLevelOption = logLevelOption, + FilterByOperationIdsOption = filterByOperationIdsOption, + FilterByTagsOption = filterByTagsOption, + FilterByCollectionOption = filterByCollectionOption, + InlineLocalOption = inlineLocalOption, + InlineExternalOption = inlineExternalOption + }; rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); From f948ca7abbf784596d6e3c2a6a825cc1879100f5 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 1 Aug 2022 10:46:07 +0300 Subject: [PATCH 170/752] Add logger class for easy reuse and clean up code --- src/Microsoft.OpenApi.Hidi/Logger.cs | 35 ++++++++++++++++++++ src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 34 ++++--------------- 2 files changed, 42 insertions(+), 27 deletions(-) create mode 100644 src/Microsoft.OpenApi.Hidi/Logger.cs diff --git a/src/Microsoft.OpenApi.Hidi/Logger.cs b/src/Microsoft.OpenApi.Hidi/Logger.cs new file mode 100644 index 000000000..cca906949 --- /dev/null +++ b/src/Microsoft.OpenApi.Hidi/Logger.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using Microsoft.Extensions.Logging; + +namespace Microsoft.OpenApi.Hidi +{ + public class Logger + { + public static ILogger ConfigureLogger(LogLevel logLevel) + { + // Configure logger options +#if DEBUG + logLevel = logLevel > LogLevel.Debug ? LogLevel.Debug : logLevel; +#endif + + using var loggerFactory = LoggerFactory.Create((builder) => + { + builder + .AddSimpleConsole(c => + { + c.IncludeScopes = true; + }) +#if DEBUG + .AddDebug() +#endif + .SetMinimumLevel(logLevel); + }); + + var logger = loggerFactory.CreateLogger(); + + return logger; + } + } +} diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 8e1838d95..79b518507 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -26,7 +26,6 @@ using System.Threading; using System.Xml.Xsl; using System.Xml; -using System.Runtime.CompilerServices; using System.Reflection; namespace Microsoft.OpenApi.Hidi @@ -36,7 +35,7 @@ public class OpenApiService /// /// Implementation of the transform command /// - public static async Task TransformOpenApiDocument( + public static async Task TransformOpenApiDocument( string openapi, string csdl, string csdlFilter, @@ -54,8 +53,7 @@ public static async Task TransformOpenApiDocument( CancellationToken cancellationToken ) { - using var loggerFactory = ConfigureLoggerInstance(loglevel); - var logger = loggerFactory.CreateLogger(); + var logger = Logger.ConfigureLogger(loglevel); try { @@ -212,18 +210,11 @@ CancellationToken cancellationToken logger.LogTrace($"Finished serializing in {stopwatch.ElapsedMilliseconds}ms"); textWriter.Flush(); } - return 0; } catch (Exception ex) { -#if DEBUG - logger.LogCritical(ex, ex.Message); -#else - logger.LogCritical(ex.Message); - -#endif - return 1; - } + throw new InvalidOperationException($"Could not transform the document, reason: {ex.Message}", ex); + } } private static XslCompiledTransform GetFilterTransform() @@ -249,18 +240,15 @@ private static Stream ApplyFilter(string csdl, string entitySetOrSingleton, XslC return stream; } - - /// /// Implementation of the validate command /// - public static async Task ValidateOpenApiDocument( + public static async Task ValidateOpenApiDocument( string openapi, LogLevel loglevel, CancellationToken cancellationToken) { - using var loggerFactory = ConfigureLoggerInstance(loglevel); - var logger = loggerFactory.CreateLogger(); + var logger = Logger.ConfigureLogger(loglevel); try { @@ -308,19 +296,11 @@ public static async Task ValidateOpenApiDocument( logger.LogTrace("Finished walking through the OpenApi document. Generating a statistics report.."); logger.LogInformation(statsVisitor.GetStatisticsReport()); } - - return 0; } catch (Exception ex) { -#if DEBUG - logger.LogCritical(ex, ex.Message); -#else - logger.LogCritical(ex.Message); -#endif - return 1; + throw new InvalidOperationException($"Could not validate the document, reason: {ex.Message}", ex); } - } /// From abbd6bfabb32817cf82b1d6ff635f9cade556958 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Aug 2022 23:25:20 +0000 Subject: [PATCH 171/752] Bump xunit from 2.4.1 to 2.4.2 Bumps [xunit](https://github.com/xunit/xunit) from 2.4.1 to 2.4.2. - [Release notes](https://github.com/xunit/xunit/releases) - [Commits](https://github.com/xunit/xunit/compare/2.4.1...2.4.2) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index fb6eaecc1..b74df3589 100644 --- a/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -11,7 +11,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 0e44802cef1b4191af98b26442d2c60c2fcc8679 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 Aug 2022 21:07:24 +0000 Subject: [PATCH 172/752] Bump Moq from 4.18.1 to 4.18.2 Bumps [Moq](https://github.com/moq/moq4) from 4.18.1 to 4.18.2. - [Release notes](https://github.com/moq/moq4/releases) - [Changelog](https://github.com/moq/moq4/blob/main/CHANGELOG.md) - [Commits](https://github.com/moq/moq4/compare/v4.18.1...v4.18.2) --- updated-dependencies: - dependency-name: Moq dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index b74df3589..de148b7d3 100644 --- a/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -10,7 +10,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive From a8bbc19653995f90a5418fbb06c3096edc36c35d Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 3 Aug 2022 11:27:45 +0300 Subject: [PATCH 173/752] Clean up code --- src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs index 84ffcc122..194a1eba8 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs @@ -40,7 +40,6 @@ public async Task InvokeAsync(InvocationContext context) throw; // so debug tools go straight to the source of the exception when attached #else logger.LogCritical( ex.Message); - Environment.Exit(1); return 1; #endif } From 33774da67450a896c9749db684232e95e3a5e190 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 3 Aug 2022 17:16:21 +0300 Subject: [PATCH 174/752] Refactor code --- .../Handlers/TransformCommandHandler.cs | 4 ++-- .../Handlers/ValidateCommandHandler.cs | 4 ++-- src/Microsoft.OpenApi.Hidi/Logger.cs | 8 ++------ src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 16 ++++++++-------- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs index 8123f4620..e8d9431de 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs @@ -50,8 +50,8 @@ public async Task InvokeAsync(InvocationContext context) string filterbycollection = context.ParseResult.GetValueForOption(FilterByCollectionOption); CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetService(typeof(CancellationToken)); - var logger = Logger.ConfigureLogger(logLevel); - + using var loggerFactory = Logger.ConfigureLogger(logLevel); + var logger = loggerFactory.CreateLogger(); try { await OpenApiService.TransformOpenApiDocument(openapi, csdl, csdlFilter, output, cleanOutput, version, format, terseOutput, logLevel, inlineLocal, inlineExternal, filterbyoperationids, filterbytags, filterbycollection, cancellationToken); diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs index 194a1eba8..2faa771ea 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs @@ -26,8 +26,8 @@ public async Task InvokeAsync(InvocationContext context) CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetService(typeof(CancellationToken)); - var logger = Logger.ConfigureLogger(logLevel); - + using var loggerFactory = Logger.ConfigureLogger(logLevel); + var logger = loggerFactory.CreateLogger(); try { await OpenApiService.ValidateOpenApiDocument(openapi, logLevel, cancellationToken); diff --git a/src/Microsoft.OpenApi.Hidi/Logger.cs b/src/Microsoft.OpenApi.Hidi/Logger.cs index cca906949..2b02e9600 100644 --- a/src/Microsoft.OpenApi.Hidi/Logger.cs +++ b/src/Microsoft.OpenApi.Hidi/Logger.cs @@ -7,14 +7,14 @@ namespace Microsoft.OpenApi.Hidi { public class Logger { - public static ILogger ConfigureLogger(LogLevel logLevel) + public static ILoggerFactory ConfigureLogger(LogLevel logLevel) { // Configure logger options #if DEBUG logLevel = logLevel > LogLevel.Debug ? LogLevel.Debug : logLevel; #endif - using var loggerFactory = LoggerFactory.Create((builder) => + return LoggerFactory.Create((builder) => { builder .AddSimpleConsole(c => @@ -26,10 +26,6 @@ public static ILogger ConfigureLogger(LogLevel logLevel) #endif .SetMinimumLevel(logLevel); }); - - var logger = loggerFactory.CreateLogger(); - - return logger; } } } diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 0d2d5d531..c37c9479d 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -44,7 +44,7 @@ public static async Task TransformOpenApiDocument( string? version, OpenApiFormat? format, bool terseOutput, - LogLevel loglevel, + LogLevel logLevel, bool inlineLocal, bool inlineExternal, string filterbyoperationids, @@ -53,8 +53,8 @@ public static async Task TransformOpenApiDocument( CancellationToken cancellationToken ) { - var logger = Logger.ConfigureLogger(loglevel); - + using var loggerFactory = Logger.ConfigureLogger(logLevel); + var logger = loggerFactory.CreateLogger(); try { if (string.IsNullOrEmpty(openapi) && string.IsNullOrEmpty(csdl)) @@ -246,11 +246,11 @@ private static Stream ApplyFilter(string csdl, string entitySetOrSingleton, XslC /// public static async Task ValidateOpenApiDocument( string openapi, - LogLevel loglevel, + LogLevel logLevel, CancellationToken cancellationToken) { - var logger = Logger.ConfigureLogger(loglevel); - + using var loggerFactory = Logger.ConfigureLogger(logLevel); + var logger = loggerFactory.CreateLogger(); try { if (string.IsNullOrEmpty(openapi)) @@ -578,7 +578,7 @@ private static ILoggerFactory ConfigureLoggerInstance(LogLevel loglevel) loglevel = loglevel > LogLevel.Debug ? LogLevel.Debug : loglevel; #endif - return LoggerFactory.Create((builder) => { + return Microsoft.Extensions.Logging.LoggerFactory.Create((builder) => { builder .AddSimpleConsole(c => { c.IncludeScopes = true; From f369e231c57ce9f2be81050b2554e308ce1bc049 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 4 Aug 2022 14:31:38 +0300 Subject: [PATCH 175/752] Revert packages to stable versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 71570a9c4..c35c40209 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -37,10 +37,10 @@ - - - - + + + + From da7e2ecaa6e41557aa7ac9ddffe73471443f17e6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Aug 2022 21:12:33 +0000 Subject: [PATCH 176/752] Bump Microsoft.NET.Test.Sdk from 17.2.0 to 17.3.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.2.0 to 17.3.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v17.2.0...v17.3.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index de148b7d3..6045d85b6 100644 --- a/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -9,7 +9,7 @@ - + From c4e96cbe3834c274ab8ee43d0d7e224518b636c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Aug 2022 21:11:30 +0000 Subject: [PATCH 177/752] Bump Microsoft.OData.Edm from 7.12.1 to 7.12.2 Bumps Microsoft.OData.Edm from 7.12.1 to 7.12.2. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c35c40209..eda11732d 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -42,7 +42,7 @@ - + From b18c470863586af18e7602575866adebf4f48680 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 22 Aug 2022 15:33:33 +0300 Subject: [PATCH 178/752] Code cleanup --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 80 +------------------- 1 file changed, 1 insertion(+), 79 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index c37c9479d..461ca50be 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -356,57 +356,7 @@ public static OpenApiDocument FixReferences(OpenApiDocument document) return doc; } - - private static async Task GetStream(string input, ILogger logger) - { - var stopwatch = new Stopwatch(); - stopwatch.Start(); - - Stream stream; - if (input.StartsWith("http")) - { - try - { - var httpClientHandler = new HttpClientHandler() - { - SslProtocols = System.Security.Authentication.SslProtocols.Tls12, - }; - using var httpClient = new HttpClient(httpClientHandler) - { - DefaultRequestVersion = HttpVersion.Version20 - }; - stream = await httpClient.GetStreamAsync(input); - } - catch (HttpRequestException ex) - { - logger.LogError($"Could not download the file at {input}, reason{ex}"); - return null; - } - } - else - { - try - { - var fileInput = new FileInfo(input); - stream = fileInput.OpenRead(); - } - catch (Exception ex) when (ex is FileNotFoundException || - ex is PathTooLongException || - ex is DirectoryNotFoundException || - ex is IOException || - ex is UnauthorizedAccessException || - ex is SecurityException || - ex is NotSupportedException) - { - logger.LogError($"Could not open the file at {input}, reason: {ex.Message}"); - return null; - } - } - stopwatch.Stop(); - logger.LogTrace("{timestamp}ms: Read file {input}", stopwatch.ElapsedMilliseconds, input); - return stream; - } - + /// /// Takes in a file stream, parses the stream into a JsonDocument and gets a list of paths and Http methods /// @@ -462,34 +412,6 @@ private static Dictionary> EnumerateJsonDocument(JsonElemen return paths; } - /// - /// Fixes the references in the resulting OpenApiDocument. - /// - /// The converted OpenApiDocument. - /// A valid OpenApiDocument instance. - // private static OpenApiDocument FixReferences2(OpenApiDocument document) - // { - // // This method is only needed because the output of ConvertToOpenApi isn't quite a valid OpenApiDocument instance. - // // So we write it out, and read it back in again to fix it up. - - // OpenApiDocument document; - // logger.LogTrace("Parsing the OpenApi file"); - // var result = await new OpenApiStreamReader(new OpenApiReaderSettings - // { - // RuleSet = ValidationRuleSet.GetDefaultRuleSet(), - // BaseUrl = new Uri(openapi) - // } - // ).ReadAsync(stream); - - // document = result.OpenApiDocument; - // var context = result.OpenApiDiagnostic; - // var sb = new StringBuilder(); - // document.SerializeAsV3(new OpenApiYamlWriter(new StringWriter(sb))); - // var doc = new OpenApiStringReader().Read(sb.ToString(), out _); - - // return doc; - // } - /// /// Reads stream from file system or makes HTTP request depending on the input string /// From b934a5bf8fe3326e1fa3400ce617e1f008f58d78 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Aug 2022 21:14:34 +0000 Subject: [PATCH 179/752] Bump Microsoft.NET.Test.Sdk from 17.3.0 to 17.3.1 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.3.0 to 17.3.1. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v17.3.0...v17.3.1) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 6045d85b6..084738bac 100644 --- a/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -9,7 +9,7 @@ - + From df4055e103b801441512ad26bb75c340eba0cd5c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 21:14:54 +0000 Subject: [PATCH 180/752] Bump Microsoft.Extensions.Logging.Abstractions from 6.0.1 to 6.0.2 Bumps [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime) from 6.0.1 to 6.0.2. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v6.0.1...v6.0.2) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index eda11732d..1e6b17aa6 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From 532f79a55fa7dced8153199504f539768857750a Mon Sep 17 00:00:00 2001 From: Irvine Date: Wed, 14 Sep 2022 19:17:00 +0300 Subject: [PATCH 181/752] Bump up lib version and Hidi version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 1e6b17aa6..518892f1d 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.0.0-preview9 + 1.0.0-preview10 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET @@ -43,7 +43,7 @@ - + From 89d6632d5bc492125b38302ff9dabdf5acf1be53 Mon Sep 17 00:00:00 2001 From: Irvine Date: Wed, 14 Sep 2022 23:55:38 +0300 Subject: [PATCH 182/752] Update some convert settings --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 461ca50be..034350f1a 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -331,7 +331,9 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl) EnableDerivedTypesReferencesForResponses = false, ShowRootPath = false, ShowLinks = false, - ExpandDerivedTypesNavigationProperties = false + ExpandDerivedTypesNavigationProperties = false, + EnableCount = true, + UseSuccessStatusCodeRange = true }; OpenApiDocument document = edmModel.ConvertToOpenApi(settings); From 6ebe3a4a003f4b3210d5d481996ab4a946c9150b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Sep 2022 21:11:00 +0000 Subject: [PATCH 183/752] Bump Microsoft.OData.Edm from 7.12.2 to 7.12.3 Bumps Microsoft.OData.Edm from 7.12.2 to 7.12.3. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 518892f1d..beacdddc2 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -42,7 +42,7 @@ - + From 0c58d03b28aa72db359ebd1cd1619434c540231f Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 20 Sep 2022 08:43:28 -0700 Subject: [PATCH 184/752] - bumps minor for hidi --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index beacdddc2..fbb16de3f 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.0.0-preview10 + 1.1.0-preview1 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From 35118b684ad1945c2fd74f3a4636ee6b4bceef71 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 26 Sep 2022 21:08:09 +0000 Subject: [PATCH 185/752] Bump Microsoft.NET.Test.Sdk from 17.3.1 to 17.3.2 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.3.1 to 17.3.2. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v17.3.1...v17.3.2) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 084738bac..d03fda9c0 100644 --- a/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -9,7 +9,7 @@ - + From 6972c6cbbfd1d0d65f1c697867bc7eb48852998b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 6 Oct 2022 07:31:07 -0400 Subject: [PATCH 186/752] - bumps hidi version and updates reference to conversion lib Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index fbb16de3f..4814ed70b 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.1.0-preview1 + 1.1.0-preview2 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET @@ -43,7 +43,7 @@ - + From 87d08904871c349d9298e48f6ac63d678097b109 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 6 Oct 2022 07:33:39 -0400 Subject: [PATCH 187/752] - moves hidi test project to test directory --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 0 .../Services/OpenApiFilterServiceTests.cs | 0 .../Microsoft.OpenApi.Hidi.Tests}/Services/OpenApiServiceTests.cs | 0 .../UtilityFiles/OpenApiDocumentMock.cs | 0 .../Microsoft.OpenApi.Hidi.Tests}/UtilityFiles/Todo.xml | 0 .../UtilityFiles/postmanCollection_ver1.json | 0 .../UtilityFiles/postmanCollection_ver2.json | 0 .../UtilityFiles/postmanCollection_ver3.json | 0 .../UtilityFiles/postmanCollection_ver4.json | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename {Microsoft.OpenApi.Hidi.Tests => test/Microsoft.OpenApi.Hidi.Tests}/Microsoft.OpenApi.Hidi.Tests.csproj (100%) rename {Microsoft.OpenApi.Hidi.Tests => test/Microsoft.OpenApi.Hidi.Tests}/Services/OpenApiFilterServiceTests.cs (100%) rename {Microsoft.OpenApi.Hidi.Tests => test/Microsoft.OpenApi.Hidi.Tests}/Services/OpenApiServiceTests.cs (100%) rename {Microsoft.OpenApi.Hidi.Tests => test/Microsoft.OpenApi.Hidi.Tests}/UtilityFiles/OpenApiDocumentMock.cs (100%) rename {Microsoft.OpenApi.Hidi.Tests => test/Microsoft.OpenApi.Hidi.Tests}/UtilityFiles/Todo.xml (100%) rename {Microsoft.OpenApi.Hidi.Tests => test/Microsoft.OpenApi.Hidi.Tests}/UtilityFiles/postmanCollection_ver1.json (100%) rename {Microsoft.OpenApi.Hidi.Tests => test/Microsoft.OpenApi.Hidi.Tests}/UtilityFiles/postmanCollection_ver2.json (100%) rename {Microsoft.OpenApi.Hidi.Tests => test/Microsoft.OpenApi.Hidi.Tests}/UtilityFiles/postmanCollection_ver3.json (100%) rename {Microsoft.OpenApi.Hidi.Tests => test/Microsoft.OpenApi.Hidi.Tests}/UtilityFiles/postmanCollection_ver4.json (100%) diff --git a/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj similarity index 100% rename from Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj rename to test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj diff --git a/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs similarity index 100% rename from Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs rename to test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs diff --git a/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs similarity index 100% rename from Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs rename to test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs diff --git a/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs similarity index 100% rename from Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs rename to test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs diff --git a/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/Todo.xml b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/Todo.xml similarity index 100% rename from Microsoft.OpenApi.Hidi.Tests/UtilityFiles/Todo.xml rename to test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/Todo.xml diff --git a/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver1.json b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver1.json similarity index 100% rename from Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver1.json rename to test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver1.json diff --git a/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver2.json b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver2.json similarity index 100% rename from Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver2.json rename to test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver2.json diff --git a/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver3.json b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver3.json similarity index 100% rename from Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver3.json rename to test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver3.json diff --git a/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver4.json b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver4.json similarity index 100% rename from Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver4.json rename to test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/postmanCollection_ver4.json From ecb5c13d9c3d2092226ec0ab687a1fec5e5536ce Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 6 Oct 2022 10:23:45 -0400 Subject: [PATCH 188/752] - bumps odata to latest --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 4814ed70b..55d529a06 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From 765c4e4baaab48b8cd79740ec8b923db5effe067 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 6 Oct 2022 11:04:07 -0400 Subject: [PATCH 189/752] - fixes references to projects in tests projects --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index d03fda9c0..1a4002daa 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -23,8 +23,8 @@ - - + + From 7d4df70c402cf57364947467501e2e0b84e6297a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Oct 2022 09:20:39 +0300 Subject: [PATCH 190/752] Bump Microsoft.OData.Edm from 7.12.3 to 7.12.4 (#1043) Bumps Microsoft.OData.Edm from 7.12.3 to 7.12.4. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 55d529a06..cbff7e937 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -42,7 +42,7 @@ - + From 04d6035bf0cebb67d300729984910d1e89f84923 Mon Sep 17 00:00:00 2001 From: Irvine Date: Mon, 24 Oct 2022 15:29:16 +0300 Subject: [PATCH 191/752] Upgrade conversion lib. ver.; update Hidi version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index cbff7e937..c77e30194 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.1.0-preview2 + 1.1.0-preview3 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET @@ -43,7 +43,7 @@ - + From caf394af29e371d28e9a4491ec4a7d74b1a54dae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Oct 2022 21:12:12 +0000 Subject: [PATCH 192/752] Bump Microsoft.OData.Edm from 7.12.4 to 7.12.5 Bumps Microsoft.OData.Edm from 7.12.4 to 7.12.5. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c77e30194..37c7d3b42 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -42,7 +42,7 @@ - + From d82757386994fd9294f2d0cd4bcf107c9d73ec0c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Oct 2022 21:12:01 +0000 Subject: [PATCH 193/752] Bump coverlet.collector from 3.1.2 to 3.2.0 Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 3.1.2 to 3.2.0. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/commits/v3.2.0) --- updated-dependencies: - dependency-name: coverlet.collector dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 1a4002daa..2c53d82da 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -16,7 +16,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 18c0cfd886b1d03da64b4f62ae8dee40fbe0571c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Nov 2022 21:11:27 +0000 Subject: [PATCH 194/752] Bump Microsoft.OpenApi.OData from 1.2.0-preview5 to 1.2.0-preview6 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.2.0-preview5 to 1.2.0-preview6. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 37c7d3b42..e133b37cf 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From 355a03ddca2db6b9400ba0fd0011e805ee253a28 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 7 Nov 2022 11:30:04 +0300 Subject: [PATCH 195/752] Add a settingsFile parameter that allows one to input a path to the settingsfile --- .../Handlers/TransformCommandHandler.cs | 4 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 57 ++++++++++--------- src/Microsoft.OpenApi.Hidi/Program.cs | 5 ++ 3 files changed, 38 insertions(+), 28 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs index e8d9431de..696837d3f 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs @@ -21,6 +21,7 @@ internal class TransformCommandHandler : ICommandHandler public Option VersionOption { get; set; } public Option FormatOption { get; set; } public Option TerseOutputOption { get; set; } + public Option SettingsFileOption { get; set; } public Option LogLevelOption { get; set; } public Option FilterByOperationIdsOption { get; set; } public Option FilterByTagsOption { get; set; } @@ -42,6 +43,7 @@ public async Task InvokeAsync(InvocationContext context) string? version = context.ParseResult.GetValueForOption(VersionOption); OpenApiFormat? format = context.ParseResult.GetValueForOption(FormatOption); bool terseOutput = context.ParseResult.GetValueForOption(TerseOutputOption); + string settingsFile = context.ParseResult.GetValueForOption(SettingsFileOption); LogLevel logLevel = context.ParseResult.GetValueForOption(LogLevelOption); bool inlineLocal = context.ParseResult.GetValueForOption(InlineLocalOption); bool inlineExternal = context.ParseResult.GetValueForOption(InlineExternalOption); @@ -54,7 +56,7 @@ public async Task InvokeAsync(InvocationContext context) var logger = loggerFactory.CreateLogger(); try { - await OpenApiService.TransformOpenApiDocument(openapi, csdl, csdlFilter, output, cleanOutput, version, format, terseOutput, logLevel, inlineLocal, inlineExternal, filterbyoperationids, filterbytags, filterbycollection, cancellationToken); + await OpenApiService.TransformOpenApiDocument(openapi, csdl, csdlFilter, output, cleanOutput, version, format, terseOutput, settingsFile, logLevel, inlineLocal, inlineExternal, filterbyoperationids, filterbytags, filterbycollection, cancellationToken); return 0; } diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index e6603d62d..488db08cf 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -45,6 +45,7 @@ public static async Task TransformOpenApiDocument( string? version, OpenApiFormat? format, bool terseOutput, + string settingsFile, LogLevel logLevel, bool inlineLocal, bool inlineExternal, @@ -100,7 +101,7 @@ CancellationToken cancellationToken stream.Position = 0; } - document = await ConvertCsdlToOpenApi(stream); + document = await ConvertCsdlToOpenApi(stream, settingsFile); stopwatch.Stop(); logger.LogTrace("{timestamp}ms: Generated OpenAPI with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } @@ -306,11 +307,14 @@ public static async Task ValidateOpenApiDocument( } } - internal static IConfiguration GetConfiguration() + public static IConfiguration GetConfiguration(string settingsFile) { + settingsFile ??= "appsettings.json"; + IConfiguration config = new ConfigurationBuilder() - .AddJsonFile("appsettings.json",true) + .AddJsonFile(settingsFile, true) .Build(); + return config; } @@ -319,37 +323,36 @@ internal static IConfiguration GetConfiguration() /// /// The CSDL stream. /// An OpenAPI document. - public static async Task ConvertCsdlToOpenApi(Stream csdl) + public static async Task ConvertCsdlToOpenApi(Stream csdl, string settingsFile = null) { using var reader = new StreamReader(csdl); var csdlText = await reader.ReadToEndAsync(); var edmModel = CsdlReader.Parse(XElement.Parse(csdlText).CreateReader()); + + var config = GetConfiguration(settingsFile); + var settings = config.GetSection("OpenApiConvertSettings").Get(); - var config = GetConfiguration(); - OpenApiConvertSettings settings = config.GetSection("OpenApiConvertSettings").Get(); - if (settings == null) - { - settings = new OpenApiConvertSettings() + settings ??= new OpenApiConvertSettings() { - AddSingleQuotesForStringParameters = true, - AddEnumDescriptionExtension = true, - DeclarePathParametersOnPathItem = true, - EnableKeyAsSegment = true, - EnableOperationId = true, - ErrorResponsesAsDefault = false, - PrefixEntityTypeNameBeforeKey = true, - TagDepth = 2, - EnablePagination = true, - EnableDiscriminatorValue = true, - EnableDerivedTypesReferencesForRequestBody = false, - EnableDerivedTypesReferencesForResponses = false, - ShowRootPath = false, - ShowLinks = false, - ExpandDerivedTypesNavigationProperties = false, - EnableCount = true, - UseSuccessStatusCodeRange = true + AddSingleQuotesForStringParameters = true, + AddEnumDescriptionExtension = true, + DeclarePathParametersOnPathItem = true, + EnableKeyAsSegment = true, + EnableOperationId = true, + ErrorResponsesAsDefault = false, + PrefixEntityTypeNameBeforeKey = true, + TagDepth = 2, + EnablePagination = true, + EnableDiscriminatorValue = true, + EnableDerivedTypesReferencesForRequestBody = false, + EnableDerivedTypesReferencesForResponses = false, + ShowRootPath = false, + ShowLinks = false, + ExpandDerivedTypesNavigationProperties = false, + EnableCount = true, + UseSuccessStatusCodeRange = true }; - } + OpenApiDocument document = edmModel.ConvertToOpenApi(settings); document = FixReferences(document); diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 67f4c2974..3af6818da 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -47,6 +47,9 @@ static async Task Main(string[] args) var terseOutputOption = new Option("--terse-output", "Produce terse json output"); terseOutputOption.AddAlias("--to"); + var settingsFileOption = new Option("--settingsFile", "The configuration file with CSDL conversion settings."); + settingsFileOption.AddAlias("--sf"); + var logLevelOption = new Option("--log-level", () => LogLevel.Information, "The log level to use when logging messages to the main output."); logLevelOption.AddAlias("--ll"); @@ -87,6 +90,7 @@ static async Task Main(string[] args) versionOption, formatOption, terseOutputOption, + settingsFileOption, logLevelOption, filterByOperationIdsOption, filterByTagsOption, @@ -105,6 +109,7 @@ static async Task Main(string[] args) VersionOption = versionOption, FormatOption = formatOption, TerseOutputOption = terseOutputOption, + SettingsFileOption = settingsFileOption, LogLevelOption = logLevelOption, FilterByOperationIdsOption = filterByOperationIdsOption, FilterByTagsOption = filterByTagsOption, From 4ee21f3765792f739c3e07193bbcfd08c82c82ce Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 7 Nov 2022 11:31:03 +0300 Subject: [PATCH 196/752] Add test --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 3 +++ .../Services/OpenApiServiceTests.cs | 16 ++++++++++++++++ .../Services/appsettingstest.json | 7 +++++++ 3 files changed, 26 insertions(+) create mode 100644 test/Microsoft.OpenApi.Hidi.Tests/Services/appsettingstest.json diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 2c53d82da..39fa1d87b 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -34,6 +34,9 @@ + + Always + Always diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index af5437aa1..aed9e4889 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -4,7 +4,9 @@ using System; using System.IO; using System.Threading.Tasks; +using Microsoft.Extensions.Configuration; using Microsoft.OpenApi.Hidi; +using Microsoft.OpenApi.OData; using Microsoft.OpenApi.Services; using Xunit; @@ -51,5 +53,19 @@ public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocumen Assert.NotEmpty(subsetOpenApiDocument.Paths); Assert.Equal(expectedPathCount, subsetOpenApiDocument.Paths.Count); } + + [Fact] + public void ReturnOpenApiConvertSettings() + { + // Arrange + var filePath = "C:\\Users\\v-makim\\source\\repos\\OpenAPI.NET\\test\\Microsoft.OpenApi.Hidi.Tests\\Services\\appsettingstest.json"; + var config = OpenApiService.GetConfiguration(filePath); + + // Act + var settings = config.GetSection("OpenApiConvertSettings").Get(); + + // Assert + Assert.NotNull(settings); + } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/appsettingstest.json b/test/Microsoft.OpenApi.Hidi.Tests/Services/appsettingstest.json new file mode 100644 index 000000000..2effcaced --- /dev/null +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/appsettingstest.json @@ -0,0 +1,7 @@ +{ + "OpenApiConvertSettings": { + "AddSingleQuotesForStringParameters": "true", + "AddEnumDescriptionExtension": "true", + "DeclarePathParametersOnPathItem": "true" + } +} \ No newline at end of file From 5d3c19346aca91394a17867b33c496d6faea51bd Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 7 Nov 2022 13:04:04 +0300 Subject: [PATCH 197/752] Use backslash in filePath --- .../Services/OpenApiServiceTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index aed9e4889..68fefe088 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -58,7 +58,7 @@ public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocumen public void ReturnOpenApiConvertSettings() { // Arrange - var filePath = "C:\\Users\\v-makim\\source\\repos\\OpenAPI.NET\\test\\Microsoft.OpenApi.Hidi.Tests\\Services\\appsettingstest.json"; + var filePath = "C:/Users/v-makim/source/repos/OpenAPI.NET/test/Microsoft.OpenApi.Hidi.Tests/Services/appsettingstest.json"; var config = OpenApiService.GetConfiguration(filePath); // Act From 21dd57045252d2c04dc63f033e55295e6a1fd2ca Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 7 Nov 2022 14:33:37 +0300 Subject: [PATCH 198/752] Clean up tests --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- .../Services/OpenApiServiceTests.cs | 2 +- .../Services/appsettingstest.json | 7 ------- .../UtilityFiles/appsettingstest.json | 21 +++++++++++++++++++ 4 files changed, 23 insertions(+), 9 deletions(-) delete mode 100644 test/Microsoft.OpenApi.Hidi.Tests/Services/appsettingstest.json create mode 100644 test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/appsettingstest.json diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 39fa1d87b..9bc2e7849 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -34,7 +34,7 @@ - + Always diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 68fefe088..44d0740be 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -58,7 +58,7 @@ public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocumen public void ReturnOpenApiConvertSettings() { // Arrange - var filePath = "C:/Users/v-makim/source/repos/OpenAPI.NET/test/Microsoft.OpenApi.Hidi.Tests/Services/appsettingstest.json"; + var filePath = "C:/Users/v-makim/source/repos/OpenAPI.NET/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/appsettingstest.json"; var config = OpenApiService.GetConfiguration(filePath); // Act diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/appsettingstest.json b/test/Microsoft.OpenApi.Hidi.Tests/Services/appsettingstest.json deleted file mode 100644 index 2effcaced..000000000 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/appsettingstest.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "OpenApiConvertSettings": { - "AddSingleQuotesForStringParameters": "true", - "AddEnumDescriptionExtension": "true", - "DeclarePathParametersOnPathItem": "true" - } -} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/appsettingstest.json b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/appsettingstest.json new file mode 100644 index 000000000..a71d0a9fa --- /dev/null +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/appsettingstest.json @@ -0,0 +1,21 @@ +{ + "OpenApiConvertSettings": { + "AddSingleQuotesForStringParameters": "true", + "AddEnumDescriptionExtension": "true", + "DeclarePathParametersOnPathItem": "true", + "EnableKeyAsSegment": "true", + "EnableOperationId": "true", + "ErrorResponsesAsDefault": "false", + "PrefixEntityTypeNameBeforeKey": "true", + "TagDepth": 2, + "EnablePagination": "true", + "EnableDiscriminatorValue": "true", + "EnableDerivedTypesReferencesForRequestBody": "false", + "EnableDerivedTypesReferencesForResponses": "false", + "ShowRootPath": "false", + "ShowLinks": "false", + "ExpandDerivedTypesNavigationProperties": "false", + "EnableCount": "true", + "UseSuccessStatusCodeRange": "true" + } +} \ No newline at end of file From 630d26caf17ad1f973088ec36fe10785f94b7fee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Nov 2022 21:10:46 +0000 Subject: [PATCH 199/752] Bump Microsoft.NET.Test.Sdk from 17.3.2 to 17.4.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.3.2 to 17.4.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Commits](https://github.com/microsoft/vstest/compare/v17.3.2...v17.4.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 2c53d82da..f4c368024 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -9,7 +9,7 @@ - + From af0328941d625ce027bdedfac7512c0b8e75beb5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Nov 2022 21:10:59 +0000 Subject: [PATCH 200/752] Bump Microsoft.Extensions.Logging.Abstractions from 6.0.2 to 7.0.0 Bumps [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime) from 6.0.2 to 7.0.0. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/commits) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index e133b37cf..e11d1c315 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From 77bf5416b2474295801c709f9ae39cd81da64a80 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Nov 2022 21:51:07 +0000 Subject: [PATCH 201/752] Bump Microsoft.Extensions.Logging from 6.0.0 to 7.0.0 Bumps [Microsoft.Extensions.Logging](https://github.com/dotnet/runtime) from 6.0.0 to 7.0.0. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/commits) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index e11d1c315..c19926e38 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -37,7 +37,7 @@ - + From 90f87415f1feded884c22fb1adcda5e09753844e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Nov 2022 22:05:56 +0000 Subject: [PATCH 202/752] Bump Microsoft.Extensions.Logging.Console from 6.0.0 to 7.0.0 Bumps [Microsoft.Extensions.Logging.Console](https://github.com/dotnet/runtime) from 6.0.0 to 7.0.0. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/commits) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Console dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c19926e38..c884e91fe 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -39,7 +39,7 @@ - + From 68dc83e34d92a917dd1b411c025d9b550839179c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 7 Nov 2022 22:17:37 +0000 Subject: [PATCH 203/752] Bump Microsoft.Extensions.Logging.Debug from 6.0.0 to 7.0.0 Bumps [Microsoft.Extensions.Logging.Debug](https://github.com/dotnet/runtime) from 6.0.0 to 7.0.0. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/commits) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Debug dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c884e91fe..6c9b54e04 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -40,7 +40,7 @@ - + From 3443cfae1b9eb6aafb88f42fd5f1c777edb65170 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 8 Nov 2022 12:45:30 +0300 Subject: [PATCH 204/752] Address PR feedback --- .../Microsoft.OpenApi.Hidi.csproj | 8 ++++ src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 48 +++++++++---------- src/Microsoft.OpenApi.Hidi/Program.cs | 15 +----- .../Services/OpenApiServiceTests.cs | 24 ++++++---- 4 files changed, 48 insertions(+), 47 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 0e7abdbdb..c2071f810 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -52,4 +52,12 @@ + + + + <_Parameter1>Microsoft.OpenApi.Hidi.Tests + + + + diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 488db08cf..0d9500682 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -28,6 +28,7 @@ using System.Xml; using System.Reflection; using Microsoft.Extensions.Configuration; +using System.Runtime.CompilerServices; namespace Microsoft.OpenApi.Hidi { @@ -307,7 +308,7 @@ public static async Task ValidateOpenApiDocument( } } - public static IConfiguration GetConfiguration(string settingsFile) + internal static IConfiguration GetConfiguration(string settingsFile) { settingsFile ??= "appsettings.json"; @@ -317,7 +318,7 @@ public static IConfiguration GetConfiguration(string settingsFile) return config; } - + /// /// Converts CSDL to OpenAPI /// @@ -330,28 +331,27 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl, stri var edmModel = CsdlReader.Parse(XElement.Parse(csdlText).CreateReader()); var config = GetConfiguration(settingsFile); - var settings = config.GetSection("OpenApiConvertSettings").Get(); - - settings ??= new OpenApiConvertSettings() - { - AddSingleQuotesForStringParameters = true, - AddEnumDescriptionExtension = true, - DeclarePathParametersOnPathItem = true, - EnableKeyAsSegment = true, - EnableOperationId = true, - ErrorResponsesAsDefault = false, - PrefixEntityTypeNameBeforeKey = true, - TagDepth = 2, - EnablePagination = true, - EnableDiscriminatorValue = true, - EnableDerivedTypesReferencesForRequestBody = false, - EnableDerivedTypesReferencesForResponses = false, - ShowRootPath = false, - ShowLinks = false, - ExpandDerivedTypesNavigationProperties = false, - EnableCount = true, - UseSuccessStatusCodeRange = true - }; + var settings = new OpenApiConvertSettings() + { + AddSingleQuotesForStringParameters = true, + AddEnumDescriptionExtension = true, + DeclarePathParametersOnPathItem = true, + EnableKeyAsSegment = true, + EnableOperationId = true, + ErrorResponsesAsDefault = false, + PrefixEntityTypeNameBeforeKey = true, + TagDepth = 2, + EnablePagination = true, + EnableDiscriminatorValue = true, + EnableDerivedTypesReferencesForRequestBody = false, + EnableDerivedTypesReferencesForResponses = false, + ShowRootPath = false, + ShowLinks = false, + ExpandDerivedTypesNavigationProperties = false, + EnableCount = true, + UseSuccessStatusCodeRange = true + }; + config.GetSection("OpenApiConvertSettings").Bind(settings); OpenApiDocument document = edmModel.ConvertToOpenApi(settings); diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 3af6818da..71e9e0d00 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -47,8 +47,8 @@ static async Task Main(string[] args) var terseOutputOption = new Option("--terse-output", "Produce terse json output"); terseOutputOption.AddAlias("--to"); - var settingsFileOption = new Option("--settingsFile", "The configuration file with CSDL conversion settings."); - settingsFileOption.AddAlias("--sf"); + var settingsFileOption = new Option("--settings-path", "The configuration file with CSDL conversion settings."); + settingsFileOption.AddAlias("--sp"); var logLevelOption = new Option("--log-level", () => LogLevel.Information, "The log level to use when logging messages to the main output."); logLevelOption.AddAlias("--ll"); @@ -121,20 +121,9 @@ static async Task Main(string[] args) rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); - // Parse the incoming args and invoke the handler await rootCommand.InvokeAsync(args); - - //await new CommandLineBuilder(rootCommand) - // .UseHost(_ => Host.CreateDefaultBuilder(), - // host => { - // var config = host.Services.GetRequiredService(); - // }) - // .UseDefaults() - // .Build() - // .InvokeAsync(args); - //// Wait for logger to write messages to the console before exiting await Task.Delay(10); } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 44d0740be..c2fb3798f 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -1,9 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; -using System.IO; -using System.Threading.Tasks; using Microsoft.Extensions.Configuration; using Microsoft.OpenApi.Hidi; using Microsoft.OpenApi.OData; @@ -54,18 +51,25 @@ public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocumen Assert.Equal(expectedPathCount, subsetOpenApiDocument.Paths.Count); } - [Fact] - public void ReturnOpenApiConvertSettings() + [Theory] + [InlineData("UtilityFiles/appsettingstest.json")] + [InlineData(null)] + public void ReturnOpenApiConvertSettingsWhenSettingsFileIsProvided(string filePath) { // Arrange - var filePath = "C:/Users/v-makim/source/repos/OpenAPI.NET/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/appsettingstest.json"; var config = OpenApiService.GetConfiguration(filePath); - - // Act + + // Act and Assert var settings = config.GetSection("OpenApiConvertSettings").Get(); - // Assert - Assert.NotNull(settings); + if (filePath == null) + { + Assert.Null(settings); + } + else + { + Assert.NotNull(settings); + } } } } From 18787b51bb641f2c4fd17dcc0f58da589a16b0e1 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 8 Nov 2022 10:26:15 -0500 Subject: [PATCH 205/752] - upgrades to dotnet 7 Signed-off-by: Vincent Biret --- Dockerfile | 6 +++--- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 6 +++--- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8326ce3b9..6b3507124 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,14 @@ -FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env WORKDIR /app COPY ./src ./hidi/src WORKDIR /app/hidi RUN dotnet publish ./src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -c Release -FROM mcr.microsoft.com/dotnet/runtime:6.0 as runtime +FROM mcr.microsoft.com/dotnet/runtime:7.0 as runtime WORKDIR /app -COPY --from=build-env /app/hidi/src/Microsoft.OpenApi.Hidi/bin/Release/net6.0 ./ +COPY --from=build-env /app/hidi/src/Microsoft.OpenApi.Hidi/bin/Release/net7.0 ./ VOLUME /app/output VOLUME /app/openapi.yml diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index f88e7ed63..c7f84666a 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net7.0 9.0 true http://go.microsoft.com/fwlink/?LinkID=288890 @@ -43,8 +43,8 @@ - - + + diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index d73d8af81..f450e2ff7 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net7.0 enable enable From a5861c92474bc10bdc01809cd7f9f6f9ebb0033d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 21:01:46 +0000 Subject: [PATCH 206/752] Bump System.CommandLine.Hosting Bumps [System.CommandLine.Hosting](https://github.com/dotnet/command-line-api) from 0.4.0-alpha.22114.1 to 0.4.0-alpha.22272.1. - [Release notes](https://github.com/dotnet/command-line-api/releases) - [Changelog](https://github.com/dotnet/command-line-api/blob/main/docs/History.md) - [Commits](https://github.com/dotnet/command-line-api/commits) --- updated-dependencies: - dependency-name: System.CommandLine.Hosting dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index f88e7ed63..c3fe239bb 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -44,7 +44,7 @@ - + From bd90b99cae2ab5bf6726def7067fe37d31cd02e0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Nov 2022 21:20:46 +0000 Subject: [PATCH 207/752] Bump Microsoft.OpenApi.OData from 1.2.0-preview6 to 1.2.0-preview7 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.2.0-preview6 to 1.2.0-preview7. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c3fe239bb..d89cd5026 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From f970e7e71f998876548f701d90b4ca34b6e025d2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Nov 2022 21:07:16 +0000 Subject: [PATCH 208/752] Bump Microsoft.OpenApi.OData from 1.2.0-preview7 to 1.2.0-preview8 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.2.0-preview7 to 1.2.0-preview8. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c7f84666a..03d8c70f0 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From 53c4b137771935628f1719ad8be0e10e94922271 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 21 Nov 2022 10:30:32 +0300 Subject: [PATCH 209/752] Bump up lib versions from preview to stable releases --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index f88e7ed63..da61c969f 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.1.0-preview3 + 1.1.0 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From 0ba913073210f824d0cf4e75ec7924c531f95db1 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 21 Nov 2022 11:24:44 +0300 Subject: [PATCH 210/752] Add conversion setting --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index f88e7ed63..62677c571 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 0d9500682..56dda4d9a 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -349,7 +349,8 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl, stri ShowLinks = false, ExpandDerivedTypesNavigationProperties = false, EnableCount = true, - UseSuccessStatusCodeRange = true + UseSuccessStatusCodeRange = true, + EnableTypeDisambiguationForDefaultValueOfOdataTypeProperty = true }; config.GetSection("OpenApiConvertSettings").Bind(settings); From 3e090768609a29fe93902675c20ff7924657b3dc Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 29 Nov 2022 09:51:04 -0500 Subject: [PATCH 211/752] - adds coverage dependencies --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index f450e2ff7..5cc0d90a8 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -9,6 +9,10 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + From c3cd0f6cbb97a90ef8271682e4fd37a583bdd7f8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 Dec 2022 21:03:37 +0000 Subject: [PATCH 212/752] Bump Moq from 4.18.2 to 4.18.3 Bumps [Moq](https://github.com/moq/moq4) from 4.18.2 to 4.18.3. - [Release notes](https://github.com/moq/moq4/releases) - [Changelog](https://github.com/moq/moq4/blob/main/CHANGELOG.md) - [Commits](https://github.com/moq/moq4/compare/v4.18.2...v4.18.3) --- updated-dependencies: - dependency-name: Moq dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index f450e2ff7..a864bc5e4 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -10,7 +10,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive From 9d86749dce350069f4f2ffc2bc1628a9479e8b0c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Dec 2022 21:01:34 +0000 Subject: [PATCH 213/752] Bump Microsoft.OData.Edm from 7.12.5 to 7.13.0 Bumps Microsoft.OData.Edm from 7.12.5 to 7.13.0. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index aba953065..3ba1aa4ed 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -42,7 +42,7 @@ - + From 2ee16de9150569422f0c7779833f54482119b76e Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 14 Dec 2022 12:06:14 +0300 Subject: [PATCH 214/752] Enable termination of transform process --- src/Microsoft.OpenApi.Hidi/Program.cs | 35 +++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 71e9e0d00..f8934a0f4 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -1,15 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System; using System.CommandLine; -using System.CommandLine.Builder; -using System.CommandLine.Hosting; using System.CommandLine.Parsing; - +using System.Diagnostics; using System.IO; +using System.Threading; using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Hidi.Handlers; @@ -19,6 +17,9 @@ static class Program { static async Task Main(string[] args) { + // subscribe to CancelKeyPress event to listen for termination requests from users through Ctrl+C or Ctrl+Break keys + Console.CancelKeyPress += new ConsoleCancelEventHandler(Console_CancelKeyPressEvent); + var rootCommand = new RootCommand() { }; @@ -127,5 +128,29 @@ static async Task Main(string[] args) //// Wait for logger to write messages to the console before exiting await Task.Delay(10); } + + /// + /// This event is raised when the user presses either of the two breaking key combinations: Ctrl+C or Ctrl+Break keys. + /// + /// + /// + private static void Console_CancelKeyPressEvent(object sender, ConsoleCancelEventArgs eventArgs) + { + if ((eventArgs.SpecialKey == ConsoleSpecialKey.ControlC) || (eventArgs.SpecialKey == ConsoleSpecialKey.ControlBreak)) + { + Console.WriteLine("CTRL+C pressed, aborting current process..."); + Thread.Sleep(5000); + + if (Process.GetCurrentProcess().HasExited) + { + Console.WriteLine("Process has already exited."); + } + else + { + Console.WriteLine("Process has not exited, attempting to kill process..."); + Process.GetCurrentProcess().Kill(); + } + } + } } } From 5a96b6b5bca40e8b9d26b0d4d74d6652a2d9627f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 15 Dec 2022 21:01:54 +0000 Subject: [PATCH 215/752] Bump Microsoft.OpenApi.OData from 1.2.0-preview8 to 1.2.0-preview9 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.2.0-preview8 to 1.2.0-preview9. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 3ba1aa4ed..e27a214d5 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From 7ffe79b252a6dbdf4e610c47b08e78736cc4669e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Dec 2022 21:04:52 +0000 Subject: [PATCH 216/752] Bump Microsoft.NET.Test.Sdk from 17.4.0 to 17.4.1 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.4.0 to 17.4.1. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.4.0...v17.4.1) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 0902ff177..4d052a56c 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -13,7 +13,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + From e7194820167dcedfc08b51f73f5165b937ee66be Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 19 Dec 2022 13:46:34 +0300 Subject: [PATCH 217/752] Use an IConsole instance to register and handle cancellation when CTRL+C is pressed --- src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs index 696837d3f..c0af09728 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs @@ -50,6 +50,8 @@ public async Task InvokeAsync(InvocationContext context) string filterbyoperationids = context.ParseResult.GetValueForOption(FilterByOperationIdsOption); string filterbytags = context.ParseResult.GetValueForOption(FilterByTagsOption); string filterbycollection = context.ParseResult.GetValueForOption(FilterByCollectionOption); + + var console = context.Console; CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetService(typeof(CancellationToken)); using var loggerFactory = Logger.ConfigureLogger(logLevel); From bcba26c4cb1d7359e273d52e7519750c4eb1e133 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 19 Dec 2022 13:47:32 +0300 Subject: [PATCH 218/752] Pass cancellation token to the conversion method and degrade gracefully when an operation is terminated --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 56dda4d9a..dbcdf5457 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -102,7 +102,7 @@ CancellationToken cancellationToken stream.Position = 0; } - document = await ConvertCsdlToOpenApi(stream, settingsFile); + document = await ConvertCsdlToOpenApi(stream, cancellationToken, settingsFile); stopwatch.Stop(); logger.LogTrace("{timestamp}ms: Generated OpenAPI with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } @@ -216,6 +216,10 @@ CancellationToken cancellationToken textWriter.Flush(); } } + catch(TaskCanceledException) + { + Console.Error.WriteLine("CTRL+C pressed, aborting the operation."); + } catch (Exception ex) { throw new InvalidOperationException($"Could not transform the document, reason: {ex.Message}", ex); @@ -324,12 +328,12 @@ internal static IConfiguration GetConfiguration(string settingsFile) /// /// The CSDL stream. /// An OpenAPI document. - public static async Task ConvertCsdlToOpenApi(Stream csdl, string settingsFile = null) + public static async Task ConvertCsdlToOpenApi(Stream csdl, CancellationToken token, string settingsFile = null) { using var reader = new StreamReader(csdl); - var csdlText = await reader.ReadToEndAsync(); + var csdlText = await reader.ReadToEndAsync(token); var edmModel = CsdlReader.Parse(XElement.Parse(csdlText).CreateReader()); - + var config = GetConfiguration(settingsFile); var settings = new OpenApiConvertSettings() { @@ -353,9 +357,8 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl, stri EnableTypeDisambiguationForDefaultValueOfOdataTypeProperty = true }; config.GetSection("OpenApiConvertSettings").Bind(settings); - - OpenApiDocument document = edmModel.ConvertToOpenApi(settings); + OpenApiDocument document = edmModel.ConvertToOpenApi(settings); document = FixReferences(document); return document; From 4a96dff182d082b1afe5c813a0fa1e6759d895bd Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 19 Dec 2022 13:47:44 +0300 Subject: [PATCH 219/752] Clean up code --- src/Microsoft.OpenApi.Hidi/Program.cs | 34 +++------------------------ 1 file changed, 3 insertions(+), 31 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index f8934a0f4..e9246eb6c 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -16,12 +16,8 @@ namespace Microsoft.OpenApi.Hidi static class Program { static async Task Main(string[] args) - { - // subscribe to CancelKeyPress event to listen for termination requests from users through Ctrl+C or Ctrl+Break keys - Console.CancelKeyPress += new ConsoleCancelEventHandler(Console_CancelKeyPressEvent); - - var rootCommand = new RootCommand() { - }; + { + var rootCommand = new RootCommand() {}; // command option parameters and aliases var descriptionOption = new Option("--openapi", "Input OpenAPI description file path or URL"); @@ -121,36 +117,12 @@ static async Task Main(string[] args) rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); - + // Parse the incoming args and invoke the handler await rootCommand.InvokeAsync(args); //// Wait for logger to write messages to the console before exiting await Task.Delay(10); - } - - /// - /// This event is raised when the user presses either of the two breaking key combinations: Ctrl+C or Ctrl+Break keys. - /// - /// - /// - private static void Console_CancelKeyPressEvent(object sender, ConsoleCancelEventArgs eventArgs) - { - if ((eventArgs.SpecialKey == ConsoleSpecialKey.ControlC) || (eventArgs.SpecialKey == ConsoleSpecialKey.ControlBreak)) - { - Console.WriteLine("CTRL+C pressed, aborting current process..."); - Thread.Sleep(5000); - - if (Process.GetCurrentProcess().HasExited) - { - Console.WriteLine("Process has already exited."); - } - else - { - Console.WriteLine("Process has not exited, attempting to kill process..."); - Process.GetCurrentProcess().Kill(); - } - } } } } From 9f7aa73533150f609c18ad36f583d415aa2971c7 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 19 Dec 2022 14:01:37 +0300 Subject: [PATCH 220/752] Fix failing tests --- .../Services/OpenApiServiceTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index c2fb3798f..70b222750 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -20,7 +20,7 @@ public async Task ReturnConvertedCSDLFile() var csdlStream = fileInput.OpenRead(); // Act - var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream); + var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream, CancellationToken.None); var expectedPathCount = 5; // Assert @@ -39,9 +39,9 @@ public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocumen var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml"); var fileInput = new FileInfo(filePath); var csdlStream = fileInput.OpenRead(); - + // Act - var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream); + var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream, CancellationToken.None); var predicate = OpenApiFilterService.CreatePredicate(operationIds, tags); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(openApiDoc, predicate); From 6ddf6ee639b114268df034dcdad1ca86990eb67e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 19 Dec 2022 08:18:17 -0500 Subject: [PATCH 221/752] Update src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs --- src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs index c0af09728..e46b34340 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs @@ -51,7 +51,6 @@ public async Task InvokeAsync(InvocationContext context) string filterbytags = context.ParseResult.GetValueForOption(FilterByTagsOption); string filterbycollection = context.ParseResult.GetValueForOption(FilterByCollectionOption); - var console = context.Console; CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetService(typeof(CancellationToken)); using var loggerFactory = Logger.ConfigureLogger(logLevel); From 6c54d75df3caab749d988cfafac1db7f5d6ea0fd Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 19 Dec 2022 19:12:18 +0300 Subject: [PATCH 222/752] Code clean up --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 ++-- .../Services/OpenApiServiceTests.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index dbcdf5457..60bba4aef 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -102,7 +102,7 @@ CancellationToken cancellationToken stream.Position = 0; } - document = await ConvertCsdlToOpenApi(stream, cancellationToken, settingsFile); + document = await ConvertCsdlToOpenApi(stream, settingsFile, cancellationToken); stopwatch.Stop(); logger.LogTrace("{timestamp}ms: Generated OpenAPI with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } @@ -328,7 +328,7 @@ internal static IConfiguration GetConfiguration(string settingsFile) /// /// The CSDL stream. /// An OpenAPI document. - public static async Task ConvertCsdlToOpenApi(Stream csdl, CancellationToken token, string settingsFile = null) + public static async Task ConvertCsdlToOpenApi(Stream csdl, string settingsFile = null, CancellationToken token = default) { using var reader = new StreamReader(csdl); var csdlText = await reader.ReadToEndAsync(token); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 70b222750..3d764b4fb 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -20,7 +20,7 @@ public async Task ReturnConvertedCSDLFile() var csdlStream = fileInput.OpenRead(); // Act - var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream, CancellationToken.None); + var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream); var expectedPathCount = 5; // Assert @@ -41,7 +41,7 @@ public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocumen var csdlStream = fileInput.OpenRead(); // Act - var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream, CancellationToken.None); + var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream); var predicate = OpenApiFilterService.CreatePredicate(operationIds, tags); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(openApiDoc, predicate); From 1a3fba655d262a5c84b58e44e1d7b5d0ae4468f0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 30 Dec 2022 21:01:29 +0000 Subject: [PATCH 223/752] Bump Moq from 4.18.3 to 4.18.4 Bumps [Moq](https://github.com/moq/moq4) from 4.18.3 to 4.18.4. - [Release notes](https://github.com/moq/moq4/releases) - [Changelog](https://github.com/moq/moq4/blob/main/CHANGELOG.md) - [Commits](https://github.com/moq/moq4/compare/v4.18.3...v4.18.4) --- updated-dependencies: - dependency-name: Moq dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 4d052a56c..578cdc9e3 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ all - + runtime; build; native; contentfiles; analyzers; buildtransitive From 000430841ec927b042f01c2c33264e0dcdf868b3 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Thu, 22 Dec 2022 22:54:07 -0500 Subject: [PATCH 224/752] Added show command --- .../Handlers/ShowCommandHandler.cs | 51 ++++++++ src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 114 ++++++++++++++++++ src/Microsoft.OpenApi.Hidi/Program.cs | 16 +++ src/Microsoft.OpenApi.Hidi/readme.md | 32 +++-- 4 files changed, 204 insertions(+), 9 deletions(-) create mode 100644 src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs new file mode 100644 index 000000000..e6542c34a --- /dev/null +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System; +using System.CommandLine; +using System.CommandLine.Invocation; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; + +namespace Microsoft.OpenApi.Hidi.Handlers +{ + internal class ShowCommandHandler : ICommandHandler + { + public Option DescriptionOption { get; set; } + public Option OutputOption { get; set; } + public Option LogLevelOption { get; set; } + + public int Invoke(InvocationContext context) + { + return InvokeAsync(context).GetAwaiter().GetResult(); + } + public async Task InvokeAsync(InvocationContext context) + { + string openapi = context.ParseResult.GetValueForOption(DescriptionOption); + FileInfo output = context.ParseResult.GetValueForOption(OutputOption); + LogLevel logLevel = context.ParseResult.GetValueForOption(LogLevelOption); + CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetService(typeof(CancellationToken)); + + using var loggerFactory = Logger.ConfigureLogger(logLevel); + var logger = loggerFactory.CreateLogger(); + try + { + await OpenApiService.ShowOpenApiDocument(openapi, output, logLevel, cancellationToken); + + return 0; + } + catch (Exception ex) + { +#if DEBUG + logger.LogCritical(ex, ex.Message); + throw; // so debug tools go straight to the source of the exception when attached +#else + logger.LogCritical( ex.Message); + return 1; +#endif + } + } + } +} diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 60bba4aef..a1f95a63d 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -535,5 +535,119 @@ private static ILoggerFactory ConfigureLoggerInstance(LogLevel loglevel) .SetMinimumLevel(loglevel); }); } + + internal static async Task ShowOpenApiDocument(string openapi, FileInfo output, LogLevel logLevel, CancellationToken cancellationToken) + { + using var loggerFactory = Logger.ConfigureLogger(logLevel); + var logger = loggerFactory.CreateLogger(); + try + { + if (string.IsNullOrEmpty(openapi)) + { + throw new ArgumentNullException(nameof(openapi)); + } + var stream = await GetStream(openapi, logger, cancellationToken); + + OpenApiDocument document; + Stopwatch stopwatch = Stopwatch.StartNew(); + using (logger.BeginScope($"Parsing OpenAPI: {openapi}", openapi)) + { + stopwatch.Start(); + + var result = await new OpenApiStreamReader(new OpenApiReaderSettings + { + RuleSet = ValidationRuleSet.GetDefaultRuleSet() + } + ).ReadAsync(stream); + + logger.LogTrace("{timestamp}ms: Completed parsing.", stopwatch.ElapsedMilliseconds); + + document = result.OpenApiDocument; + var context = result.OpenApiDiagnostic; + if (context.Errors.Count != 0) + { + using (logger.BeginScope("Detected errors")) + { + foreach (var error in context.Errors) + { + logger.LogError(error.ToString()); + } + } + } + stopwatch.Stop(); + } + + using (logger.BeginScope("Creating diagram")) + { + // Create OpenApiUrlTree from document + + using var file = new FileStream(output.FullName, FileMode.Create); + var writer = new StreamWriter(file); + WriteTreeDocument(openapi, document, writer); + writer.Flush(); + + logger.LogTrace("Finished walking through the OpenApi document. "); + } + } + catch (Exception ex) + { + throw new InvalidOperationException($"Could not generate the document, reason: {ex.Message}", ex); + } + } + + private static void WriteTreeDocument(string openapi, OpenApiDocument document, StreamWriter writer) + { + var rootNode = OpenApiUrlTreeNode.Create(document, "main"); + + writer.WriteLine("# " + document.Info.Title); + writer.WriteLine(); + writer.WriteLine("OpenAPI: " + openapi); + writer.Write(@"
+GET +POST +GET POST +GET PATCH DELETE +GET PUT DELETE +GET DELETE +DELETE +
+"); + writer.WriteLine(); + writer.WriteLine("```mermaid"); + writer.WriteLine("graph LR"); + writer.WriteLine("classDef GET fill:lightSteelBlue,stroke:#333,stroke-width:2px;"); + writer.WriteLine("classDef POST fill:SteelBlue,stroke:#333,stroke-width:2px;"); + writer.WriteLine("classDef GETPOST fill:forestGreen,stroke:#333,stroke-width:2px;"); + writer.WriteLine("classDef DELETEGETPATCH fill:yellowGreen,stroke:#333,stroke-width:2px;"); + writer.WriteLine("classDef DELETEGETPUT fill:olive,stroke:#333,stroke-width:2px;"); + writer.WriteLine("classDef DELETEGET fill:DarkSeaGreen,stroke:#333,stroke-width:2px;"); + writer.WriteLine("classDef DELETE fill:tomato,stroke:#333,stroke-width:2px;"); + writer.WriteLine("classDef OTHER fill:white,stroke:#333,stroke-width:2px;"); + + ProcessNode(rootNode, writer); + writer.WriteLine("```"); + } + + private static void ProcessNode(OpenApiUrlTreeNode node, StreamWriter writer) + { + var path = string.IsNullOrEmpty(node.Path) ? "/" : Sanitize(node.Path); + foreach (var child in node.Children) + { + writer.WriteLine($"{Sanitize(path)} --> {Sanitize(child.Value.Path)}[{Sanitize(child.Key)}]"); + ProcessNode(child.Value, writer); + } + var methods = String.Join("", node.PathItems.SelectMany(p => p.Value.Operations.Select(o => o.Key)) + .Distinct() + .Select(o => o.ToString().ToUpper()) + .OrderBy(o => o) + .ToList()); + if (String.IsNullOrEmpty(methods)) methods = "OTHER"; + writer.WriteLine($"class {path} {methods}"); + } + + private static string Sanitize(string token) + { + return token.Replace("\\", "/").Replace("{", ":").Replace("}", ""); + } } } diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index e9246eb6c..b9db1229f 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -115,6 +115,22 @@ static async Task Main(string[] args) InlineExternalOption = inlineExternalOption }; + var showCommand = new Command("show") + { + descriptionOption, + logLevelOption, + outputOption, + cleanOutputOption + }; + + showCommand.Handler = new ShowCommandHandler + { + DescriptionOption = descriptionOption, + OutputOption = outputOption, + LogLevelOption = logLevelOption + }; + + rootCommand.Add(showCommand); rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md index 6295c5c99..a6283817e 100644 --- a/src/Microsoft.OpenApi.Hidi/readme.md +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -1,24 +1,26 @@ -# Overview +# Overview Hidi is a command line tool that makes it easy to work with and transform OpenAPI documents. The tool enables you validate and apply transformations to and from different file formats using various commands to do different actions on the files. ## Capabilities + Hidi has these key capabilities that enable you to build different scenarios off the tool • Validation of OpenAPI files • Conversion of OpenAPI files into different file formats: convert files from JSON to YAML, YAML to JSON • Slice or filter OpenAPI documents to smaller subsets using operationIDs and tags + • Generate a Mermaid diagram of the API from an OpenAPI document - -## Installation +## Installation Install [Microsoft.OpenApi.Hidi](https://www.nuget.org/packages/Microsoft.OpenApi.Hidi/1.0.0-preview4) package from NuGet by running the following command: -### .NET CLI(Global) +### .NET CLI(Global) + 1. dotnet tool install --global Microsoft.OpenApi.Hidi --prerelease -### .NET CLI(local) +### .NET CLI(local) 1. dotnet new tool-manifest #if you are setting up the OpenAPI.NET repo 2. dotnet tool install --local Microsoft.OpenApi.Hidi --prerelease @@ -27,14 +29,17 @@ Install [Microsoft.OpenApi.Hidi](https://www.nuget.org/packages/Microsoft.OpenAp ## How to use Hidi + Once you've installed the package locally, you can invoke the Hidi by running: hidi [command]. You can access the list of command options we have by running hidi -h The tool avails the following commands: • Validate • Transform + • Show -### Validate +### Validate + This command option accepts an OpenAPI document as an input parameter, visits multiple OpenAPI elements within the document and returns statistics count report on the following elements: • Path Items @@ -54,9 +59,10 @@ It accepts the following command: **Example:** `hidi.exe validate --openapi C:\OpenApidocs\Mail.yml --loglevel trace` -Run validate -h to see the options available. - -### Transform +Run validate -h to see the options available. + +### Transform + Used to convert file formats from JSON to YAML and vice versa and performs slicing of OpenAPI documents. This command accepts the following parameters: @@ -90,3 +96,11 @@ This command accepts the following parameters: hidi transform -cs dataverse.csdl --csdlFilter "appointments,opportunities" -o appointmentsAndOpportunities.yaml -ll trace Run transform -h to see all the available usage options. + +### Show + +This command accepts an OpenAPI document as an input parameter and generates a Markdown file that contains a diagram of the API using Mermaid syntax. + +**Examples:** + + 1. hidi show -d files\People.yml -o People.md -ll trace From 7df0777987e2378d97174502a9700f6a3c5c70cb Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Fri, 23 Dec 2022 12:42:12 -0500 Subject: [PATCH 225/752] Moved mermaid writer into OpenApiUrlTreeNode and fixed more sanitization issues --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 52 ++++---------------- 1 file changed, 9 insertions(+), 43 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index a1f95a63d..881fda1e1 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -602,52 +602,18 @@ private static void WriteTreeDocument(string openapi, OpenApiDocument document, writer.WriteLine("# " + document.Info.Title); writer.WriteLine(); writer.WriteLine("OpenAPI: " + openapi); - writer.Write(@"
-GET -POST -GET POST -GET PATCH DELETE -GET PUT DELETE -GET DELETE -DELETE -
-"); - writer.WriteLine(); - writer.WriteLine("```mermaid"); - writer.WriteLine("graph LR"); - writer.WriteLine("classDef GET fill:lightSteelBlue,stroke:#333,stroke-width:2px;"); - writer.WriteLine("classDef POST fill:SteelBlue,stroke:#333,stroke-width:2px;"); - writer.WriteLine("classDef GETPOST fill:forestGreen,stroke:#333,stroke-width:2px;"); - writer.WriteLine("classDef DELETEGETPATCH fill:yellowGreen,stroke:#333,stroke-width:2px;"); - writer.WriteLine("classDef DELETEGETPUT fill:olive,stroke:#333,stroke-width:2px;"); - writer.WriteLine("classDef DELETEGET fill:DarkSeaGreen,stroke:#333,stroke-width:2px;"); - writer.WriteLine("classDef DELETE fill:tomato,stroke:#333,stroke-width:2px;"); - writer.WriteLine("classDef OTHER fill:white,stroke:#333,stroke-width:2px;"); - - ProcessNode(rootNode, writer); - writer.WriteLine("```"); - } - private static void ProcessNode(OpenApiUrlTreeNode node, StreamWriter writer) - { - var path = string.IsNullOrEmpty(node.Path) ? "/" : Sanitize(node.Path); - foreach (var child in node.Children) + writer.WriteLine(@"
"); + // write a span for each mermaidcolorscheme + foreach (var color in OpenApiUrlTreeNode.MermaidColorScheme) { - writer.WriteLine($"{Sanitize(path)} --> {Sanitize(child.Value.Path)}[{Sanitize(child.Key)}]"); - ProcessNode(child.Value, writer); + writer.WriteLine($"{color.Key.Replace("_"," ")}"); } - var methods = String.Join("", node.PathItems.SelectMany(p => p.Value.Operations.Select(o => o.Key)) - .Distinct() - .Select(o => o.ToString().ToUpper()) - .OrderBy(o => o) - .ToList()); - if (String.IsNullOrEmpty(methods)) methods = "OTHER"; - writer.WriteLine($"class {path} {methods}"); - } - - private static string Sanitize(string token) - { - return token.Replace("\\", "/").Replace("{", ":").Replace("}", ""); + writer.WriteLine("/div"); + writer.WriteLine(); + writer.WriteLine("```mermaid"); + rootNode.WriteMermaid(writer); + writer.WriteLine("```"); } } } From 22059773fea2f5093d44f8cc66c65b519a4773e7 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sat, 24 Dec 2022 18:35:42 -0500 Subject: [PATCH 226/752] Added shapes for better accessibility --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 881fda1e1..fbbacb140 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -605,11 +605,11 @@ private static void WriteTreeDocument(string openapi, OpenApiDocument document, writer.WriteLine(@"
"); // write a span for each mermaidcolorscheme - foreach (var color in OpenApiUrlTreeNode.MermaidColorScheme) + foreach (var style in OpenApiUrlTreeNode.MermaidNodeStyles) { - writer.WriteLine($"{color.Key.Replace("_"," ")}"); + writer.WriteLine($"{style.Key.Replace("_"," ")}"); } - writer.WriteLine("/div"); + writer.WriteLine("
"); writer.WriteLine(); writer.WriteLine("```mermaid"); rootNode.WriteMermaid(writer); From cf7073af25b2487f495041f5327e0192893dfc86 Mon Sep 17 00:00:00 2001 From: Darrel Date: Sat, 24 Dec 2022 19:06:22 -0500 Subject: [PATCH 227/752] Update to do a unnecessary using Co-authored-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index fbbacb140..0df940d03 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -582,7 +582,7 @@ internal static async Task ShowOpenApiDocument(string openapi, FileInfo output, // Create OpenApiUrlTree from document using var file = new FileStream(output.FullName, FileMode.Create); - var writer = new StreamWriter(file); + using var writer = new StreamWriter(file); WriteTreeDocument(openapi, document, writer); writer.Flush(); From 7e915911795fbb675de0225ac777e16221d8c680 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sat, 24 Dec 2022 19:15:57 -0500 Subject: [PATCH 228/752] Added a bunch of usings and removed an unnecessary flush to address comments --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 0df940d03..52d2e4fc9 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -265,7 +265,7 @@ public static async Task ValidateOpenApiDocument( { throw new ArgumentNullException(nameof(openapi)); } - var stream = await GetStream(openapi, logger, cancellationToken); + using var stream = await GetStream(openapi, logger, cancellationToken); OpenApiDocument document; Stopwatch stopwatch = Stopwatch.StartNew(); @@ -546,7 +546,7 @@ internal static async Task ShowOpenApiDocument(string openapi, FileInfo output, { throw new ArgumentNullException(nameof(openapi)); } - var stream = await GetStream(openapi, logger, cancellationToken); + using var stream = await GetStream(openapi, logger, cancellationToken); OpenApiDocument document; Stopwatch stopwatch = Stopwatch.StartNew(); @@ -584,7 +584,6 @@ internal static async Task ShowOpenApiDocument(string openapi, FileInfo output, using var file = new FileStream(output.FullName, FileMode.Create); using var writer = new StreamWriter(file); WriteTreeDocument(openapi, document, writer); - writer.Flush(); logger.LogTrace("Finished walking through the OpenApi document. "); } From 5b1a089569bb9b29ddb5c703f8f9e3c7edd46344 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Tue, 3 Jan 2023 23:08:02 -0500 Subject: [PATCH 229/752] Fixed data in broken test --- .../Services/OpenApiServiceTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 3d764b4fb..a080db11a 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -30,7 +30,7 @@ public async Task ReturnConvertedCSDLFile() } [Theory] - [InlineData("Todos.Todo.UpdateTodo",null, 1)] + [InlineData("Todos.Todo.UpdateTodoById",null, 1)] [InlineData("Todos.Todo.ListTodo",null, 1)] [InlineData(null, "Todos.Todo", 4)] public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount) From 87de3226ede00366e984036179cb24254d86e368 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 4 Jan 2023 09:56:15 -0500 Subject: [PATCH 230/752] - bumps hidi version to get latest odata and mermaid Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index e27a214d5..e23533fbf 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.1.0 + 1.2.0 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From bf0630702639077211886275e480c8dc84ba742b Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 5 Jan 2023 11:48:13 +0300 Subject: [PATCH 231/752] Fix failing test by updating operation id --- .../Services/OpenApiServiceTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 3d764b4fb..379482283 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -30,8 +30,8 @@ public async Task ReturnConvertedCSDLFile() } [Theory] - [InlineData("Todos.Todo.UpdateTodo",null, 1)] - [InlineData("Todos.Todo.ListTodo",null, 1)] + [InlineData("Todos.Todo.UpdateTodoById", null, 1)] + [InlineData("Todos.Todo.ListTodo", null, 1)] [InlineData(null, "Todos.Todo", 4)] public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount) { From fbc6ad7825c8d9727504d83a4cdafa22cd5f2c5a Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 5 Jan 2023 12:30:31 +0300 Subject: [PATCH 232/752] Fix failing test --- .../Services/OpenApiServiceTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 3d764b4fb..a080db11a 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -30,7 +30,7 @@ public async Task ReturnConvertedCSDLFile() } [Theory] - [InlineData("Todos.Todo.UpdateTodo",null, 1)] + [InlineData("Todos.Todo.UpdateTodoById",null, 1)] [InlineData("Todos.Todo.ListTodo",null, 1)] [InlineData(null, "Todos.Todo", 4)] public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount) From 48309af79669b3eb5a9fb7b98934fcd340847dc5 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Thu, 5 Jan 2023 14:27:41 -0500 Subject: [PATCH 233/752] Refactored OpenAPIService to remove duplicate code --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 145 +++++++------------ 1 file changed, 50 insertions(+), 95 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 52d2e4fc9..d2eb2e229 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -29,6 +29,7 @@ using System.Reflection; using Microsoft.Extensions.Configuration; using System.Runtime.CompilerServices; +using System.Reflection.Metadata; namespace Microsoft.OpenApi.Hidi { @@ -110,43 +111,13 @@ CancellationToken cancellationToken else { stream = await GetStream(openapi, logger, cancellationToken); - - using (logger.BeginScope($"Parse OpenAPI: {openapi}",openapi)) - { - stopwatch.Restart(); - var result = await new OpenApiStreamReader(new OpenApiReaderSettings - { - RuleSet = ValidationRuleSet.GetDefaultRuleSet(), - LoadExternalRefs = inlineExternal, - BaseUrl = openapi.StartsWith("http") ? new Uri(openapi) : new Uri("file:" + new FileInfo(openapi).DirectoryName + "\\") - } - ).ReadAsync(stream); - - document = result.OpenApiDocument; - - var context = result.OpenApiDiagnostic; - if (context.Errors.Count > 0) - { - logger.LogTrace("{timestamp}ms: Parsed OpenAPI with errors. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count); - - var errorReport = new StringBuilder(); - - foreach (var error in context.Errors) - { - logger.LogError("OpenApi Parsing error: {message}", error.ToString()); - errorReport.AppendLine(error.ToString()); - } - logger.LogError($"{stopwatch.ElapsedMilliseconds}ms: OpenApi Parsing errors {string.Join(Environment.NewLine, context.Errors.Select(e => e.Message).ToArray())}"); - } - else - { - logger.LogTrace("{timestamp}ms: Parsed OpenApi successfully. {count} paths found.", stopwatch.ElapsedMilliseconds, document.Paths.Count); - } - - openApiFormat = format ?? GetOpenApiFormat(openapi, logger); - openApiVersion = version != null ? TryParseOpenApiSpecVersion(version) : result.OpenApiDiagnostic.SpecificationVersion; - stopwatch.Stop(); - } + stopwatch.Restart(); + var result = await ParseOpenApi(openapi, logger, stream); + document = result.OpenApiDocument; + + openApiFormat = format ?? GetOpenApiFormat(openapi, logger); + openApiVersion = version != null ? TryParseOpenApiSpecVersion(version) : result.OpenApiDiagnostic.SpecificationVersion; + stopwatch.Stop(); } using (logger.BeginScope("Filter")) @@ -267,40 +238,13 @@ public static async Task ValidateOpenApiDocument( } using var stream = await GetStream(openapi, logger, cancellationToken); - OpenApiDocument document; - Stopwatch stopwatch = Stopwatch.StartNew(); - using (logger.BeginScope($"Parsing OpenAPI: {openapi}", openapi)) - { - stopwatch.Start(); - - var result = await new OpenApiStreamReader(new OpenApiReaderSettings - { - RuleSet = ValidationRuleSet.GetDefaultRuleSet() - } - ).ReadAsync(stream); - - logger.LogTrace("{timestamp}ms: Completed parsing.", stopwatch.ElapsedMilliseconds); - - document = result.OpenApiDocument; - var context = result.OpenApiDiagnostic; - if (context.Errors.Count != 0) - { - using (logger.BeginScope("Detected errors")) - { - foreach (var error in context.Errors) - { - logger.LogError(error.ToString()); - } - } - } - stopwatch.Stop(); - } + var result = await ParseOpenApi(openapi, logger, stream); using (logger.BeginScope("Calculating statistics")) { var statsVisitor = new StatsVisitor(); var walker = new OpenApiWalker(statsVisitor); - walker.Walk(document); + walker.Walk(result.OpenApiDocument); logger.LogTrace("Finished walking through the OpenApi document. Generating a statistics report.."); logger.LogInformation(statsVisitor.GetStatisticsReport()); @@ -312,6 +256,29 @@ public static async Task ValidateOpenApiDocument( } } + private static async Task ParseOpenApi(string openApiFile, ILogger logger, Stream stream) + { + ReadResult result; + Stopwatch stopwatch = Stopwatch.StartNew(); + using (logger.BeginScope($"Parsing OpenAPI: {openApiFile}", openApiFile)) + { + stopwatch.Start(); + + result = await new OpenApiStreamReader(new OpenApiReaderSettings + { + RuleSet = ValidationRuleSet.GetDefaultRuleSet() + } + ).ReadAsync(stream); + + logger.LogTrace("{timestamp}ms: Completed parsing.", stopwatch.ElapsedMilliseconds); + + LogErrors(logger, result); + stopwatch.Stop(); + } + + return result; + } + internal static IConfiguration GetConfiguration(string settingsFile) { settingsFile ??= "appsettings.json"; @@ -548,34 +515,7 @@ internal static async Task ShowOpenApiDocument(string openapi, FileInfo output, } using var stream = await GetStream(openapi, logger, cancellationToken); - OpenApiDocument document; - Stopwatch stopwatch = Stopwatch.StartNew(); - using (logger.BeginScope($"Parsing OpenAPI: {openapi}", openapi)) - { - stopwatch.Start(); - - var result = await new OpenApiStreamReader(new OpenApiReaderSettings - { - RuleSet = ValidationRuleSet.GetDefaultRuleSet() - } - ).ReadAsync(stream); - - logger.LogTrace("{timestamp}ms: Completed parsing.", stopwatch.ElapsedMilliseconds); - - document = result.OpenApiDocument; - var context = result.OpenApiDiagnostic; - if (context.Errors.Count != 0) - { - using (logger.BeginScope("Detected errors")) - { - foreach (var error in context.Errors) - { - logger.LogError(error.ToString()); - } - } - } - stopwatch.Stop(); - } + var result = await ParseOpenApi(openapi, logger, stream); using (logger.BeginScope("Creating diagram")) { @@ -583,7 +523,7 @@ internal static async Task ShowOpenApiDocument(string openapi, FileInfo output, using var file = new FileStream(output.FullName, FileMode.Create); using var writer = new StreamWriter(file); - WriteTreeDocument(openapi, document, writer); + WriteTreeDocument(openapi, result.OpenApiDocument, writer); logger.LogTrace("Finished walking through the OpenApi document. "); } @@ -594,6 +534,21 @@ internal static async Task ShowOpenApiDocument(string openapi, FileInfo output, } } + private static void LogErrors(ILogger logger, ReadResult result) + { + var context = result.OpenApiDiagnostic; + if (context.Errors.Count != 0) + { + using (logger.BeginScope("Detected errors")) + { + foreach (var error in context.Errors) + { + logger.LogError(error.ToString()); + } + } + } + } + private static void WriteTreeDocument(string openapi, OpenApiDocument document, StreamWriter writer) { var rootNode = OpenApiUrlTreeNode.Create(document, "main"); From d052d6c50a17a9ca64bfef83744ab70c87c967ab Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 8 Jan 2023 10:30:07 -0500 Subject: [PATCH 234/752] Added tests for mermaid diagrams --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 ++-- .../Services/OpenApiServiceTests.cs | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index d2eb2e229..73c9fc336 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -549,13 +549,13 @@ private static void LogErrors(ILogger logger, ReadResult result) } } - private static void WriteTreeDocument(string openapi, OpenApiDocument document, StreamWriter writer) + internal static void WriteTreeDocument(string openapiUrl, OpenApiDocument document, StreamWriter writer) { var rootNode = OpenApiUrlTreeNode.Create(document, "main"); writer.WriteLine("# " + document.Info.Title); writer.WriteLine(); - writer.WriteLine("OpenAPI: " + openapi); + writer.WriteLine("OpenAPI: " + openapiUrl); writer.WriteLine(@"
"); // write a span for each mermaidcolorscheme diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index a080db11a..eb0872b3b 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -1,10 +1,14 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Text; using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Hidi; +using Microsoft.OpenApi.Models; using Microsoft.OpenApi.OData; using Microsoft.OpenApi.Services; +using Microsoft.VisualStudio.TestPlatform.Utilities; using Xunit; namespace Microsoft.OpenApi.Tests.Services @@ -71,5 +75,24 @@ public void ReturnOpenApiConvertSettingsWhenSettingsFileIsProvided(string filePa Assert.NotNull(settings); } } + + [Fact] + public void ShowCommandGeneratesMermaidDiagram() + { + var openApiDoc = new OpenApiDocument(); + openApiDoc.Info = new OpenApiInfo + { + Title = "Test", + Version = "1.0.0" + }; + var stream = new MemoryStream(); + using var writer = new StreamWriter(stream); + OpenApiService.WriteTreeDocument("https://example.org/openapi.json", openApiDoc, writer); + writer.Flush(); + stream.Position = 0; + using var reader = new StreamReader(stream); + var output = reader.ReadToEnd(); + Assert.Contains("graph LR", output); + } } } From 5da67c5578693a13ebbc236cf305574167686233 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Wed, 11 Jan 2023 17:44:02 -0500 Subject: [PATCH 235/752] Added test for show command --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 3 +++ .../Services/OpenApiServiceTests.cs | 10 ++++++++++ .../UtilityFiles/SampleOpenApi.yml | 19 +++++++++++++++++++ 3 files changed, 32 insertions(+) create mode 100644 test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/SampleOpenApi.yml diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 578cdc9e3..aaaa66cba 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -53,6 +53,9 @@ Always + + PreserveNewest + Always diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index eb0872b3b..fd1ea0d59 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -94,5 +94,15 @@ public void ShowCommandGeneratesMermaidDiagram() var output = reader.ReadToEnd(); Assert.Contains("graph LR", output); } + + [Fact] + public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() + { + var fileinfo = new FileInfo("sample.md"); + await OpenApiService.ShowOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", fileinfo, LogLevel.Information, new CancellationToken()); + + var output = File.ReadAllText(fileinfo.FullName); + Assert.Contains("graph LR", output); + } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/SampleOpenApi.yml b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/SampleOpenApi.yml new file mode 100644 index 000000000..c4fb2e62f --- /dev/null +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/SampleOpenApi.yml @@ -0,0 +1,19 @@ +openapi: 3.0.0 +info: + title: Sample OpenApi + version: 1.0.0 +paths: + /api/editresource: + get: + responses: + '200': + description: OK + patch: + responses: + '200': + description: OK + /api/viewresource: + get: + responses: + '200': + description: OK \ No newline at end of file From aaedf86461c921a8f6046aa71ed7117da32bb577 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Wed, 11 Jan 2023 21:29:39 -0500 Subject: [PATCH 236/752] Refactored to improve test coverage --- src/Microsoft.OpenApi.Hidi/Program.cs | 32 +++++++++++-------- .../Services/OpenApiServiceTests.cs | 27 ++++++++++++++++ 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index b9db1229f..03aac121d 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -16,8 +16,19 @@ namespace Microsoft.OpenApi.Hidi static class Program { static async Task Main(string[] args) - { - var rootCommand = new RootCommand() {}; + { + var rootCommand = CreateRootCommand(); + + // Parse the incoming args and invoke the handler + await rootCommand.InvokeAsync(args); + + //// Wait for logger to write messages to the console before exiting + await Task.Delay(10); + } + + internal static RootCommand CreateRootCommand() + { + var rootCommand = new RootCommand() { }; // command option parameters and aliases var descriptionOption = new Option("--openapi", "Input OpenAPI description file path or URL"); @@ -46,7 +57,7 @@ static async Task Main(string[] args) var settingsFileOption = new Option("--settings-path", "The configuration file with CSDL conversion settings."); settingsFileOption.AddAlias("--sp"); - + var logLevelOption = new Option("--log-level", () => LogLevel.Information, "The log level to use when logging messages to the main output."); logLevelOption.AddAlias("--ll"); @@ -71,7 +82,7 @@ static async Task Main(string[] args) logLevelOption }; - validateCommand.Handler = new ValidateCommandHandler + validateCommand.Handler = new ValidateCommandHandler { DescriptionOption = descriptionOption, LogLevelOption = logLevelOption @@ -88,7 +99,7 @@ static async Task Main(string[] args) formatOption, terseOutputOption, settingsFileOption, - logLevelOption, + logLevelOption, filterByOperationIdsOption, filterByTagsOption, filterByCollectionOption, @@ -123,7 +134,7 @@ static async Task Main(string[] args) cleanOutputOption }; - showCommand.Handler = new ShowCommandHandler + showCommand.Handler = new ShowCommandHandler { DescriptionOption = descriptionOption, OutputOption = outputOption, @@ -133,12 +144,7 @@ static async Task Main(string[] args) rootCommand.Add(showCommand); rootCommand.Add(transformCommand); rootCommand.Add(validateCommand); - - // Parse the incoming args and invoke the handler - await rootCommand.InvokeAsync(args); - - //// Wait for logger to write messages to the console before exiting - await Task.Delay(10); - } + return rootCommand; + } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index fd1ea0d59..020f0db9c 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -1,10 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.CommandLine; +using System.CommandLine.Invocation; using System.Text; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Hidi; +using Microsoft.OpenApi.Hidi.Handlers; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.OData; using Microsoft.OpenApi.Services; @@ -104,5 +107,29 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() var output = File.ReadAllText(fileinfo.FullName); Assert.Contains("graph LR", output); } + + [Fact] + public async Task InvokeShowCommand() + { + var rootCommand = Program.CreateRootCommand(); + var args = new string[] { "show", "-d", ".\\UtilityFiles\\SampleOpenApi.yml", "-o", "sample.md" }; + var parseResult = rootCommand.Parse(args); + var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler; + var context = new InvocationContext(parseResult); + + await handler.InvokeAsync(context); + + var output = File.ReadAllText("sample.md"); + Assert.Contains("graph LR", output); + } + + + // Relatively useless test to keep the code coverage metrics happy + [Fact] + public void CreateRootCommand() + { + var rootCommand = Program.CreateRootCommand(); + Assert.NotNull(rootCommand); + } } } From fa17363276083855496ad4807a99efb224c68440 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Wed, 11 Jan 2023 21:43:14 -0500 Subject: [PATCH 237/752] Change test to call sync invoke --- .../Services/OpenApiServiceTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 020f0db9c..db30d2eff 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -109,7 +109,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() } [Fact] - public async Task InvokeShowCommand() + public void InvokeShowCommand() { var rootCommand = Program.CreateRootCommand(); var args = new string[] { "show", "-d", ".\\UtilityFiles\\SampleOpenApi.yml", "-o", "sample.md" }; @@ -117,7 +117,7 @@ public async Task InvokeShowCommand() var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler; var context = new InvocationContext(parseResult); - await handler.InvokeAsync(context); + handler.Invoke(context); var output = File.ReadAllText("sample.md"); Assert.Contains("graph LR", output); From 9e930dd1e0abb58337f0580a25230c4a8c8cb198 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Wed, 11 Jan 2023 22:18:10 -0500 Subject: [PATCH 238/752] Added back missing parameter config options in parseopenapi --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 73c9fc336..dfd1886a4 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -112,7 +112,7 @@ CancellationToken cancellationToken { stream = await GetStream(openapi, logger, cancellationToken); stopwatch.Restart(); - var result = await ParseOpenApi(openapi, logger, stream); + var result = await ParseOpenApi(openapi, inlineExternal, logger, stream); document = result.OpenApiDocument; openApiFormat = format ?? GetOpenApiFormat(openapi, logger); @@ -238,7 +238,7 @@ public static async Task ValidateOpenApiDocument( } using var stream = await GetStream(openapi, logger, cancellationToken); - var result = await ParseOpenApi(openapi, logger, stream); + var result = await ParseOpenApi(openapi, false, logger, stream); using (logger.BeginScope("Calculating statistics")) { @@ -256,7 +256,7 @@ public static async Task ValidateOpenApiDocument( } } - private static async Task ParseOpenApi(string openApiFile, ILogger logger, Stream stream) + private static async Task ParseOpenApi(string openApiFile, bool inlineExternal, ILogger logger, Stream stream) { ReadResult result; Stopwatch stopwatch = Stopwatch.StartNew(); @@ -266,7 +266,9 @@ private static async Task ParseOpenApi(string openApiFile, ILogger Date: Fri, 13 Jan 2023 21:01:47 +0000 Subject: [PATCH 239/752] Bump Microsoft.OData.Edm from 7.13.0 to 7.14.0 Bumps Microsoft.OData.Edm from 7.13.0 to 7.14.0. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index e23533fbf..232830c37 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -42,7 +42,7 @@ - + From 26f7135e82234aa1f529d50a5ecf40d6df78ca3f Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sat, 14 Jan 2023 20:33:05 -0500 Subject: [PATCH 240/752] Removed Task.Delay as no longer necessary. #1127 --- src/Microsoft.OpenApi.Hidi/Program.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 03aac121d..056da9ab2 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -22,8 +22,6 @@ static async Task Main(string[] args) // Parse the incoming args and invoke the handler await rootCommand.InvokeAsync(args); - //// Wait for logger to write messages to the console before exiting - await Task.Delay(10); } internal static RootCommand CreateRootCommand() @@ -129,6 +127,8 @@ internal static RootCommand CreateRootCommand() var showCommand = new Command("show") { descriptionOption, + csdlOption, + csdlFilterOption, logLevelOption, outputOption, cleanOutputOption @@ -137,6 +137,8 @@ internal static RootCommand CreateRootCommand() showCommand.Handler = new ShowCommandHandler { DescriptionOption = descriptionOption, + CsdlOption = csdlOption, + CsdlFilterOption = csdlFilterOption, OutputOption = outputOption, LogLevelOption = logLevelOption }; From 6428456002e1ef6112486dfe62bc446722f9f130 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sat, 14 Jan 2023 20:33:59 -0500 Subject: [PATCH 241/752] Updated commands to enable reading from CSDL url for both transform and show commands --- .../Handlers/ShowCommandHandler.cs | 7 +- .../Handlers/TransformCommandHandler.cs | 2 +- .../Handlers/ValidateCommandHandler.cs | 2 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 345 +++++++++++------- .../Services/OpenApiServiceTests.cs | 44 ++- 5 files changed, 254 insertions(+), 146 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs index e6542c34a..6974e76dd 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs @@ -16,6 +16,9 @@ internal class ShowCommandHandler : ICommandHandler public Option DescriptionOption { get; set; } public Option OutputOption { get; set; } public Option LogLevelOption { get; set; } + public Option CsdlOption { get; set; } + public Option CsdlFilterOption { get; set; } + public int Invoke(InvocationContext context) { @@ -26,13 +29,15 @@ public async Task InvokeAsync(InvocationContext context) string openapi = context.ParseResult.GetValueForOption(DescriptionOption); FileInfo output = context.ParseResult.GetValueForOption(OutputOption); LogLevel logLevel = context.ParseResult.GetValueForOption(LogLevelOption); + string csdlFilter = context.ParseResult.GetValueForOption(CsdlFilterOption); + string csdl = context.ParseResult.GetValueForOption(CsdlOption); CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetService(typeof(CancellationToken)); using var loggerFactory = Logger.ConfigureLogger(logLevel); var logger = loggerFactory.CreateLogger(); try { - await OpenApiService.ShowOpenApiDocument(openapi, output, logLevel, cancellationToken); + await OpenApiService.ShowOpenApiDocument(openapi, csdl, csdlFilter, output, logger, cancellationToken); return 0; } diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs index e46b34340..d0a49c209 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs @@ -57,7 +57,7 @@ public async Task InvokeAsync(InvocationContext context) var logger = loggerFactory.CreateLogger(); try { - await OpenApiService.TransformOpenApiDocument(openapi, csdl, csdlFilter, output, cleanOutput, version, format, terseOutput, settingsFile, logLevel, inlineLocal, inlineExternal, filterbyoperationids, filterbytags, filterbycollection, cancellationToken); + await OpenApiService.TransformOpenApiDocument(openapi, csdl, csdlFilter, output, cleanOutput, version, format, terseOutput, settingsFile, inlineLocal, inlineExternal, filterbyoperationids, filterbytags, filterbycollection, logger, cancellationToken); return 0; } diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs index 2faa771ea..416471d9e 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs @@ -30,7 +30,7 @@ public async Task InvokeAsync(InvocationContext context) var logger = loggerFactory.CreateLogger(); try { - await OpenApiService.ValidateOpenApiDocument(openapi, logLevel, cancellationToken); + await OpenApiService.ValidateOpenApiDocument(openapi, logger, cancellationToken); return 0; } catch (Exception ex) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index dfd1886a4..c54b65db5 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -28,8 +28,6 @@ using System.Xml; using System.Reflection; using Microsoft.Extensions.Configuration; -using System.Runtime.CompilerServices; -using System.Reflection.Metadata; namespace Microsoft.OpenApi.Hidi { @@ -48,22 +46,21 @@ public static async Task TransformOpenApiDocument( OpenApiFormat? format, bool terseOutput, string settingsFile, - LogLevel logLevel, bool inlineLocal, bool inlineExternal, string filterbyoperationids, string filterbytags, string filterbycollection, + ILogger logger, CancellationToken cancellationToken ) { - using var loggerFactory = Logger.ConfigureLogger(logLevel); - var logger = loggerFactory.CreateLogger(); + try { if (string.IsNullOrEmpty(openapi) && string.IsNullOrEmpty(csdl)) { - throw new ArgumentException("Please input a file path"); + throw new ArgumentException("Please input a file path or URL"); } if (output == null) { @@ -79,122 +76,136 @@ CancellationToken cancellationToken throw new IOException($"The file {output} already exists. Please input a new file path."); } - Stream stream; - OpenApiDocument document; - OpenApiFormat openApiFormat; - OpenApiSpecVersion openApiVersion; - var stopwatch = new Stopwatch(); + // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion + OpenApiFormat openApiFormat = format ?? (!string.IsNullOrEmpty(openapi) ? GetOpenApiFormat(openapi, logger) : OpenApiFormat.Yaml); + OpenApiSpecVersion openApiVersion = version != null ? TryParseOpenApiSpecVersion(version) : OpenApiSpecVersion.OpenApi3_0; - if (!string.IsNullOrEmpty(csdl)) - { - using (logger.BeginScope($"Convert CSDL: {csdl}", csdl)) - { - stopwatch.Start(); - // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion - openApiFormat = format ?? GetOpenApiFormat(csdl, logger); - openApiVersion = version != null ? TryParseOpenApiSpecVersion(version) : OpenApiSpecVersion.OpenApi3_0; - - stream = await GetStream(csdl, logger, cancellationToken); + OpenApiDocument document = await GetOpenApi(openapi, csdl, csdlFilter, settingsFile, inlineExternal, logger, cancellationToken); + document = await FilterOpenApiDocument(filterbyoperationids, filterbytags, filterbycollection, document, logger, cancellationToken); + WriteOpenApi(output, terseOutput, inlineLocal, inlineExternal, openApiFormat, openApiVersion, document, logger); + } + catch (TaskCanceledException) + { + Console.Error.WriteLine("CTRL+C pressed, aborting the operation."); + } + catch (Exception ex) + { + throw new InvalidOperationException($"Could not transform the document, reason: {ex.Message}", ex); + } + } - if (!string.IsNullOrEmpty(csdlFilter)) - { - XslCompiledTransform transform = GetFilterTransform(); - stream = ApplyFilter(csdl, csdlFilter, transform); - stream.Position = 0; - } + private static void WriteOpenApi(FileInfo output, bool terseOutput, bool inlineLocal, bool inlineExternal, OpenApiFormat openApiFormat, OpenApiSpecVersion openApiVersion, OpenApiDocument document, ILogger logger) + { + using (logger.BeginScope("Output")) + { + using var outputStream = output?.Create(); + var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; - document = await ConvertCsdlToOpenApi(stream, settingsFile, cancellationToken); - stopwatch.Stop(); - logger.LogTrace("{timestamp}ms: Generated OpenAPI with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); - } - } - else + var settings = new OpenApiWriterSettings() { - stream = await GetStream(openapi, logger, cancellationToken); - stopwatch.Restart(); - var result = await ParseOpenApi(openapi, inlineExternal, logger, stream); - document = result.OpenApiDocument; - - openApiFormat = format ?? GetOpenApiFormat(openapi, logger); - openApiVersion = version != null ? TryParseOpenApiSpecVersion(version) : result.OpenApiDiagnostic.SpecificationVersion; - stopwatch.Stop(); - } + InlineLocalReferences = inlineLocal, + InlineExternalReferences = inlineExternal + }; - using (logger.BeginScope("Filter")) + IOpenApiWriter writer = openApiFormat switch { - Func predicate = null; + OpenApiFormat.Json => terseOutput ? new OpenApiJsonWriter(textWriter, settings, terseOutput) : new OpenApiJsonWriter(textWriter, settings, false), + OpenApiFormat.Yaml => new OpenApiYamlWriter(textWriter, settings), + _ => throw new ArgumentException("Unknown format"), + }; - // Check if filter options are provided, then slice the OpenAPI document - if (!string.IsNullOrEmpty(filterbyoperationids) && !string.IsNullOrEmpty(filterbytags)) - { - throw new InvalidOperationException("Cannot filter by operationIds and tags at the same time."); - } - if (!string.IsNullOrEmpty(filterbyoperationids)) - { - logger.LogTrace("Creating predicate based on the operationIds supplied."); - predicate = OpenApiFilterService.CreatePredicate(operationIds: filterbyoperationids); + logger.LogTrace("Serializing to OpenApi document using the provided spec version and writer"); - } - if (!string.IsNullOrEmpty(filterbytags)) - { - logger.LogTrace("Creating predicate based on the tags supplied."); - predicate = OpenApiFilterService.CreatePredicate(tags: filterbytags); + var stopwatch = new Stopwatch(); + stopwatch.Start(); + document.Serialize(writer, openApiVersion); + stopwatch.Stop(); - } - if (!string.IsNullOrEmpty(filterbycollection)) - { - var fileStream = await GetStream(filterbycollection, logger, cancellationToken); - var requestUrls = ParseJsonCollectionFile(fileStream, logger); + logger.LogTrace($"Finished serializing in {stopwatch.ElapsedMilliseconds}ms"); + textWriter.Flush(); + } + } - logger.LogTrace("Creating predicate based on the paths and Http methods defined in the Postman collection."); - predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: document); - } - if (predicate != null) + // Get OpenAPI document either from OpenAPI or CSDL + private static async Task GetOpenApi(string openapi, string csdl, string csdlFilter, string settingsFile, bool inlineExternal, ILogger logger, CancellationToken cancellationToken) + { + OpenApiDocument document; + Stream stream; + + if (!string.IsNullOrEmpty(csdl)) + { + var stopwatch = new Stopwatch(); + using (logger.BeginScope($"Convert CSDL: {csdl}", csdl)) + { + stopwatch.Start(); + stream = await GetStream(csdl, logger, cancellationToken); + Stream filteredStream = null; + if (!string.IsNullOrEmpty(csdlFilter)) { - stopwatch.Restart(); - document = OpenApiFilterService.CreateFilteredDocument(document, predicate); - stopwatch.Stop(); - logger.LogTrace("{timestamp}ms: Creating filtered OpenApi document with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); + XslCompiledTransform transform = GetFilterTransform(); + filteredStream = ApplyFilterToCsdl(stream, csdlFilter, transform); + filteredStream.Position = 0; + stream.Dispose(); + stream = null; } + + document = await ConvertCsdlToOpenApi(filteredStream ?? stream, settingsFile, cancellationToken); + stopwatch.Stop(); + logger.LogTrace("{timestamp}ms: Generated OpenAPI with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } + } + else + { + stream = await GetStream(openapi, logger, cancellationToken); + var result = await ParseOpenApi(openapi, inlineExternal, logger, stream); + document = result.OpenApiDocument; + } - using (logger.BeginScope("Output")) - { - ; - using var outputStream = output?.Create(); - var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; + return document; + } - var settings = new OpenApiWriterSettings() - { - InlineLocalReferences = inlineLocal, - InlineExternalReferences = inlineExternal - }; + private static async Task FilterOpenApiDocument(string filterbyoperationids, string filterbytags, string filterbycollection, OpenApiDocument document, ILogger logger, CancellationToken cancellationToken) + { + using (logger.BeginScope("Filter")) + { + Func predicate = null; - IOpenApiWriter writer = openApiFormat switch - { - OpenApiFormat.Json => terseOutput ? new OpenApiJsonWriter(textWriter, settings, terseOutput) : new OpenApiJsonWriter(textWriter, settings, false), - OpenApiFormat.Yaml => new OpenApiYamlWriter(textWriter, settings), - _ => throw new ArgumentException("Unknown format"), - }; + // Check if filter options are provided, then slice the OpenAPI document + if (!string.IsNullOrEmpty(filterbyoperationids) && !string.IsNullOrEmpty(filterbytags)) + { + throw new InvalidOperationException("Cannot filter by operationIds and tags at the same time."); + } + if (!string.IsNullOrEmpty(filterbyoperationids)) + { + logger.LogTrace("Creating predicate based on the operationIds supplied."); + predicate = OpenApiFilterService.CreatePredicate(operationIds: filterbyoperationids); + + } + if (!string.IsNullOrEmpty(filterbytags)) + { + logger.LogTrace("Creating predicate based on the tags supplied."); + predicate = OpenApiFilterService.CreatePredicate(tags: filterbytags); - logger.LogTrace("Serializing to OpenApi document using the provided spec version and writer"); + } + if (!string.IsNullOrEmpty(filterbycollection)) + { + var fileStream = await GetStream(filterbycollection, logger, cancellationToken); + var requestUrls = ParseJsonCollectionFile(fileStream, logger); + logger.LogTrace("Creating predicate based on the paths and Http methods defined in the Postman collection."); + predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: document); + } + if (predicate != null) + { + var stopwatch = new Stopwatch(); stopwatch.Start(); - document.Serialize(writer, openApiVersion); + document = OpenApiFilterService.CreateFilteredDocument(document, predicate); stopwatch.Stop(); - - logger.LogTrace($"Finished serializing in {stopwatch.ElapsedMilliseconds}ms"); - textWriter.Flush(); + logger.LogTrace("{timestamp}ms: Creating filtered OpenApi document with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } } - catch(TaskCanceledException) - { - Console.Error.WriteLine("CTRL+C pressed, aborting the operation."); - } - catch (Exception ex) - { - throw new InvalidOperationException($"Could not transform the document, reason: {ex.Message}", ex); - } + + return document; } private static XslCompiledTransform GetFilterTransform() @@ -206,10 +217,10 @@ private static XslCompiledTransform GetFilterTransform() return transform; } - private static Stream ApplyFilter(string csdl, string entitySetOrSingleton, XslCompiledTransform transform) + private static Stream ApplyFilterToCsdl(Stream csdlStream, string entitySetOrSingleton, XslCompiledTransform transform) { Stream stream; - StreamReader inputReader = new(csdl); + StreamReader inputReader = new(csdlStream); XmlReader inputXmlReader = XmlReader.Create(inputReader); MemoryStream filteredStream = new(); StreamWriter writer = new(filteredStream); @@ -225,11 +236,9 @@ private static Stream ApplyFilter(string csdl, string entitySetOrSingleton, XslC /// public static async Task ValidateOpenApiDocument( string openapi, - LogLevel logLevel, + ILogger logger, CancellationToken cancellationToken) { - using var loggerFactory = Logger.ConfigureLogger(logLevel); - var logger = loggerFactory.CreateLogger(); try { if (string.IsNullOrEmpty(openapi)) @@ -250,13 +259,17 @@ public static async Task ValidateOpenApiDocument( logger.LogInformation(statsVisitor.GetStatisticsReport()); } } + catch (TaskCanceledException) + { + Console.Error.WriteLine("CTRL+C pressed, aborting the operation."); + } catch (Exception ex) { throw new InvalidOperationException($"Could not validate the document, reason: {ex.Message}", ex); } } - private static async Task ParseOpenApi(string openApiFile, bool inlineExternal, ILogger logger, Stream stream) + private static async Task ParseOpenApi(string openApiFile, bool inlineExternal, ILogger logger, Stream stream) { ReadResult result; Stopwatch stopwatch = Stopwatch.StartNew(); @@ -486,57 +499,60 @@ private static string GetInputPathExtension(string openapi = null, string csdl = return extension; } - private static ILoggerFactory ConfigureLoggerInstance(LogLevel loglevel) + internal static async Task ShowOpenApiDocument(string openapi, string csdl, string csdlFilter, FileInfo output, ILogger logger, CancellationToken cancellationToken) { - // Configure logger options -#if DEBUG - loglevel = loglevel > LogLevel.Debug ? LogLevel.Debug : loglevel; -#endif - - return Microsoft.Extensions.Logging.LoggerFactory.Create((builder) => { - builder - .AddSimpleConsole(c => { - c.IncludeScopes = true; - }) -#if DEBUG - .AddDebug() -#endif - .SetMinimumLevel(loglevel); - }); - } - - internal static async Task ShowOpenApiDocument(string openapi, FileInfo output, LogLevel logLevel, CancellationToken cancellationToken) - { - using var loggerFactory = Logger.ConfigureLogger(logLevel); - var logger = loggerFactory.CreateLogger(); try { - if (string.IsNullOrEmpty(openapi)) + if (string.IsNullOrEmpty(openapi) && string.IsNullOrEmpty(csdl)) { - throw new ArgumentNullException(nameof(openapi)); + throw new ArgumentException("Please input a file path or URL"); } - using var stream = await GetStream(openapi, logger, cancellationToken); - var result = await ParseOpenApi(openapi, false, logger, stream); + var document = await GetOpenApi(openapi, csdl, csdlFilter, null, false, logger, cancellationToken); using (logger.BeginScope("Creating diagram")) { - // Create OpenApiUrlTree from document + // If output is null, create a HTML file in the user's temporary directory + if (output == null) + { + var tempPath = Path.GetTempPath(); - using var file = new FileStream(output.FullName, FileMode.Create); - using var writer = new StreamWriter(file); - WriteTreeDocument(openapi, result.OpenApiDocument, writer); + output = new FileInfo(Path.Combine(tempPath, "apitree.html")); + using (var file = new FileStream(output.FullName, FileMode.Create)) + { + using var writer = new StreamWriter(file); + WriteTreeDocumentAsHtml(openapi ?? csdl, document, writer); + } + logger.LogTrace("Created Html document with diagram "); - logger.LogTrace("Finished walking through the OpenApi document. "); + // Launch a browser to display the output html file + var process = new Process(); + process.StartInfo.FileName = output.FullName; + process.StartInfo.UseShellExecute = true; + process.Start(); + } + else // Write diagram as Markdown document to output file + { + using (var file = new FileStream(output.FullName, FileMode.Create)) + { + using var writer = new StreamWriter(file); + WriteTreeDocumentAsMarkdown(openapi ?? csdl, document, writer); + } + logger.LogTrace("Created markdown document with diagram "); + } } } + catch (TaskCanceledException) + { + Console.Error.WriteLine("CTRL+C pressed, aborting the operation."); + } catch (Exception ex) { throw new InvalidOperationException($"Could not generate the document, reason: {ex.Message}", ex); } } - private static void LogErrors(ILogger logger, ReadResult result) + private static void LogErrors(ILogger logger, ReadResult result) { var context = result.OpenApiDiagnostic; if (context.Errors.Count != 0) @@ -551,13 +567,13 @@ private static void LogErrors(ILogger logger, ReadResult result) } } - internal static void WriteTreeDocument(string openapiUrl, OpenApiDocument document, StreamWriter writer) + internal static void WriteTreeDocumentAsMarkdown(string openapiUrl, OpenApiDocument document, StreamWriter writer) { var rootNode = OpenApiUrlTreeNode.Create(document, "main"); writer.WriteLine("# " + document.Info.Title); writer.WriteLine(); - writer.WriteLine("OpenAPI: " + openapiUrl); + writer.WriteLine("API Description: " + openapiUrl); writer.WriteLine(@"
"); // write a span for each mermaidcolorscheme @@ -571,5 +587,54 @@ internal static void WriteTreeDocument(string openapiUrl, OpenApiDocument docume rootNode.WriteMermaid(writer); writer.WriteLine("```"); } + + internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument document, StreamWriter writer, bool asHtmlFile = false) + { + var rootNode = OpenApiUrlTreeNode.Create(document, "main"); + + writer.WriteLine(@" + + + + + + +"); + writer.WriteLine("

" + document.Info.Title + "

"); + writer.WriteLine(); + writer.WriteLine($"

API Description: {sourceUrl}

"); + + writer.WriteLine(@"
"); + // write a span for each mermaidcolorscheme + foreach (var style in OpenApiUrlTreeNode.MermaidNodeStyles) + { + writer.WriteLine($"{style.Key.Replace("_", " ")}"); + } + writer.WriteLine("
"); + writer.WriteLine("
"); + writer.WriteLine(""); + rootNode.WriteMermaid(writer); + writer.WriteLine(""); + + // Write script tag to include JS library for rendering markdown + writer.WriteLine(@""); + // Write script tag to include JS library for rendering mermaid + writer.WriteLine("(new LoggerFactory()), new CancellationToken()); var output = File.ReadAllText(fileinfo.FullName); Assert.Contains("graph LR", output); @@ -124,6 +146,22 @@ public void InvokeShowCommand() } + [Fact] + public void InvokeShowCommandWithoutOutput() + { + var rootCommand = Program.CreateRootCommand(); + var args = new string[] { "show", "-d", ".\\UtilityFiles\\SampleOpenApi.yml" }; + var parseResult = rootCommand.Parse(args); + var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler; + var context = new InvocationContext(parseResult); + + handler.Invoke(context); + + var output = File.ReadAllText(Path.Combine(Path.GetTempPath(), "apitree.html")); + Assert.Contains("graph LR", output); + } + + // Relatively useless test to keep the code coverage metrics happy [Fact] public void CreateRootCommand() From 68239cb1f2edf1fd4a886f2f8af5b90df203ab74 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sat, 14 Jan 2023 21:03:57 -0500 Subject: [PATCH 242/752] Used random file in a hidi folder to address security concerns. --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 12 +++++++++--- .../Services/OpenApiServiceTests.cs | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index c54b65db5..2cc188865 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -515,9 +515,15 @@ internal static async Task ShowOpenApiDocument(string openapi, string csdl, stri // If output is null, create a HTML file in the user's temporary directory if (output == null) { - var tempPath = Path.GetTempPath(); + var tempPath = Path.GetTempPath() + "/hidi/"; + if(!File.Exists(tempPath)) + { + Directory.CreateDirectory(tempPath); + } + + var fileName = Path.GetRandomFileName(); - output = new FileInfo(Path.Combine(tempPath, "apitree.html")); + output = new FileInfo(Path.Combine(tempPath, fileName + ".html")); using (var file = new FileStream(output.FullName, FileMode.Create)) { using var writer = new StreamWriter(file); @@ -526,7 +532,7 @@ internal static async Task ShowOpenApiDocument(string openapi, string csdl, stri logger.LogTrace("Created Html document with diagram "); // Launch a browser to display the output html file - var process = new Process(); + using var process = new Process(); process.StartInfo.FileName = output.FullName; process.StartInfo.UseShellExecute = true; process.Start(); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 09ac6fb04..aa49ff520 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -80,6 +80,7 @@ public void ReturnOpenApiConvertSettingsWhenSettingsFileIsProvided(string filePa } } + [Fact] public void ShowCommandGeneratesMermaidDiagramAsMarkdown() { @@ -130,6 +131,22 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() Assert.Contains("graph LR", output); } + [Fact] + public void InvokeTransformCommand() + { + var rootCommand = Program.CreateRootCommand(); + var args = new string[] { "transform", "-d", ".\\UtilityFiles\\SampleOpenApi.yml", "-o", "sample.json" }; + var parseResult = rootCommand.Parse(args); + var handler = rootCommand.Subcommands.Where(c => c.Name == "transform").First().Handler; + var context = new InvocationContext(parseResult); + + handler.Invoke(context); + + var output = File.ReadAllText("sample.json"); + Assert.NotEmpty(output); + } + + [Fact] public void InvokeShowCommand() { From 96e3494511b4d0acdb4d2d73912517ab92cd5014 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 15 Jan 2023 11:11:21 -0500 Subject: [PATCH 243/752] Fixed code smell relating to LogError --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 2cc188865..8d7ea774e 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -567,7 +567,7 @@ private static void LogErrors(ILogger logger, ReadResult result) { foreach (var error in context.Errors) { - logger.LogError(error.ToString()); + logger.LogError($"Detected error during parsing: {error}",error.ToString()); } } } From aed3843187d7353f1af2c2e24f32a79fc8dad596 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Sun, 15 Jan 2023 11:11:48 -0500 Subject: [PATCH 244/752] Added test to call Transform command directly so that code coverage will actually see it. --- .../Services/OpenApiServiceTests.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index aa49ff520..995ce1f02 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -131,6 +131,18 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() Assert.Contains("graph LR", output); } + + [Fact] + public async Task TransformCommandConvertsOpenApi() + { + var fileinfo = new FileInfo("sample.json"); + // create a dummy ILogger instance for testing + await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml",null, null, fileinfo, true, null, null,false,null,false,false,null,null,null,new Logger(new LoggerFactory()), new CancellationToken()); + + var output = File.ReadAllText("sample.json"); + Assert.NotEmpty(output); + } + [Fact] public void InvokeTransformCommand() { From bfc3580cfa5919695ca8704d2526d397871719ca Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 16 Jan 2023 13:18:00 -0500 Subject: [PATCH 245/752] Removed unnecessary test that was breaking --- .../Services/OpenApiServiceTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 995ce1f02..bdb5827b1 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -147,7 +147,7 @@ public async Task TransformCommandConvertsOpenApi() public void InvokeTransformCommand() { var rootCommand = Program.CreateRootCommand(); - var args = new string[] { "transform", "-d", ".\\UtilityFiles\\SampleOpenApi.yml", "-o", "sample.json" }; + var args = new string[] { "transform", "-d", ".\\UtilityFiles\\SampleOpenApi.yml", "-o", "sample.json","--co" }; var parseResult = rootCommand.Parse(args); var handler = rootCommand.Subcommands.Where(c => c.Name == "transform").First().Handler; var context = new InvocationContext(parseResult); From 9e8f8936fa93e03105491a66f46b95d5da100be8 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 16 Jan 2023 13:51:39 -0500 Subject: [PATCH 246/752] This time I included the change --- .../Services/OpenApiServiceTests.cs | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index bdb5827b1..be1ca18e8 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -175,20 +175,6 @@ public void InvokeShowCommand() } - [Fact] - public void InvokeShowCommandWithoutOutput() - { - var rootCommand = Program.CreateRootCommand(); - var args = new string[] { "show", "-d", ".\\UtilityFiles\\SampleOpenApi.yml" }; - var parseResult = rootCommand.Parse(args); - var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler; - var context = new InvocationContext(parseResult); - - handler.Invoke(context); - - var output = File.ReadAllText(Path.Combine(Path.GetTempPath(), "apitree.html")); - Assert.Contains("graph LR", output); - } // Relatively useless test to keep the code coverage metrics happy From ae0bd47bfc9cbada86f869eba79981375f45170f Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 16 Jan 2023 14:47:07 -0500 Subject: [PATCH 247/752] Added more tests to meet the coverage gods --- .../Services/OpenApiServiceTests.cs | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index be1ca18e8..dbfbce221 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -131,6 +131,30 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() Assert.Contains("graph LR", output); } + [Fact] + public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiagram() + { + var fileinfo = new FileInfo("sample.md"); + // create a dummy ILogger instance for testing + await OpenApiService.ShowOpenApiDocument(null, "UtilityFiles\\Todo.xml", "todos", fileinfo, new Logger(new LoggerFactory()), new CancellationToken()); + + var output = File.ReadAllText(fileinfo.FullName); + Assert.Contains("graph LR", output); + } + + [Fact] + public async Task ThrowIfURLIsNotResolvableWhenValidating() + { + var message = Assert.ThrowsAsync(async () => + await OpenApiService.ValidateOpenApiDocument("https://example.org/itdoesnmatter", new Logger(new LoggerFactory()), new CancellationToken())); + } + + [Fact] + public async Task ThrowIfFileDoesNotExistWhenValidating() + { + var message = Assert.ThrowsAsync(async () => + await OpenApiService.ValidateOpenApiDocument("aFileThatBetterNotExist.fake", new Logger(new LoggerFactory()), new CancellationToken())); + } [Fact] public async Task TransformCommandConvertsOpenApi() @@ -175,8 +199,6 @@ public void InvokeShowCommand() } - - // Relatively useless test to keep the code coverage metrics happy [Fact] public void CreateRootCommand() From e6562652d1983e163c29b62f25dcc56d184cda54 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 16 Jan 2023 15:07:01 -0500 Subject: [PATCH 248/752] More sacrifices made --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 24 +++++++++------ .../Services/OpenApiServiceTests.cs | 30 +++++++++++++++++-- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 8d7ea774e..c4653353a 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -55,18 +55,19 @@ public static async Task TransformOpenApiDocument( CancellationToken cancellationToken ) { + if (string.IsNullOrEmpty(openapi) && string.IsNullOrEmpty(csdl)) + { + throw new ArgumentException("Please input a file path or URL"); + } try { - if (string.IsNullOrEmpty(openapi) && string.IsNullOrEmpty(csdl)) - { - throw new ArgumentException("Please input a file path or URL"); - } if (output == null) { var inputExtension = GetInputPathExtension(openapi, csdl); output = new FileInfo($"./output{inputExtension}"); }; + if (cleanoutput && output.Exists) { output.Delete(); @@ -87,7 +88,11 @@ CancellationToken cancellationToken catch (TaskCanceledException) { Console.Error.WriteLine("CTRL+C pressed, aborting the operation."); - } + } + catch (IOException) + { + throw; + } catch (Exception ex) { throw new InvalidOperationException($"Could not transform the document, reason: {ex.Message}", ex); @@ -239,12 +244,13 @@ public static async Task ValidateOpenApiDocument( ILogger logger, CancellationToken cancellationToken) { + if (string.IsNullOrEmpty(openapi)) + { + throw new ArgumentNullException(nameof(openapi)); + } + try { - if (string.IsNullOrEmpty(openapi)) - { - throw new ArgumentNullException(nameof(openapi)); - } using var stream = await GetStream(openapi, logger, cancellationToken); var result = await ParseOpenApi(openapi, false, logger, stream); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index dbfbce221..d397e4163 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -142,20 +142,38 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiag Assert.Contains("graph LR", output); } + [Fact] + public async Task ThrowIfOpenApiUrlIsNotProvidedWhenValidating() + { + await Assert.ThrowsAsync(async () => + await OpenApiService.ValidateOpenApiDocument("", new Logger(new LoggerFactory()), new CancellationToken())); + } + + [Fact] public async Task ThrowIfURLIsNotResolvableWhenValidating() { - var message = Assert.ThrowsAsync(async () => + await Assert.ThrowsAsync(async () => await OpenApiService.ValidateOpenApiDocument("https://example.org/itdoesnmatter", new Logger(new LoggerFactory()), new CancellationToken())); } [Fact] public async Task ThrowIfFileDoesNotExistWhenValidating() { - var message = Assert.ThrowsAsync(async () => + await Assert.ThrowsAsync(async () => await OpenApiService.ValidateOpenApiDocument("aFileThatBetterNotExist.fake", new Logger(new LoggerFactory()), new CancellationToken())); } + [Fact] + public async Task ValidateCommandProcessesOpenApi() + { + // create a dummy ILogger instance for testing + await OpenApiService.ValidateOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", new Logger(new LoggerFactory()), new CancellationToken()); + + Assert.True(true); + } + + [Fact] public async Task TransformCommandConvertsOpenApi() { @@ -167,6 +185,14 @@ public async Task TransformCommandConvertsOpenApi() Assert.NotEmpty(output); } + [Fact] + public async Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty() + { + await Assert.ThrowsAsync(async () => + await OpenApiService.TransformOpenApiDocument(null, null, null, null, true, null, null, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken())); + + } + [Fact] public void InvokeTransformCommand() { From 29904ff3b9a0e0099e9a21737e43c9e52b20a570 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 16 Jan 2023 16:39:59 -0500 Subject: [PATCH 249/752] Will these be the tests that achieve the magical goal? --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 ++-- .../Services/OpenApiServiceTests.cs | 20 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index c4653353a..a952f414b 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -103,8 +103,8 @@ private static void WriteOpenApi(FileInfo output, bool terseOutput, bool inlineL { using (logger.BeginScope("Output")) { - using var outputStream = output?.Create(); - var textWriter = outputStream != null ? new StreamWriter(outputStream) : Console.Out; + using var outputStream = output.Create(); + var textWriter = new StreamWriter(outputStream); var settings = new OpenApiWriterSettings() { diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index d397e4163..11b5bc4f3 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -185,6 +185,26 @@ public async Task TransformCommandConvertsOpenApi() Assert.NotEmpty(output); } + [Fact] + public async Task TransformCommandConvertsOpenApiWithDefaultOutputname() + { + // create a dummy ILogger instance for testing + await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", null, null, null, true, null, null, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); + + var output = File.ReadAllText("output.yml"); + Assert.NotEmpty(output); + } + + [Fact] + public async Task TransformCommandConvertsOpenApiWithDefaultOutputnameAndSwitchFormat() + { + // create a dummy ILogger instance for testing + await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", null, null, null, true, "3.0", OpenApiFormat.Yaml, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); + + var output = File.ReadAllText("output.yml"); + Assert.NotEmpty(output); + } + [Fact] public async Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty() { From c4bc4bd06924f9750f9071b98aae7febecda5ad3 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 16 Jan 2023 17:09:37 -0500 Subject: [PATCH 250/752] I am confidence I have enough tests now --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 6 ++- .../Services/OpenApiServiceTests.cs | 42 ++++++++++++++----- 2 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index a952f414b..64a23dff3 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -505,7 +505,7 @@ private static string GetInputPathExtension(string openapi = null, string csdl = return extension; } - internal static async Task ShowOpenApiDocument(string openapi, string csdl, string csdlFilter, FileInfo output, ILogger logger, CancellationToken cancellationToken) + internal static async Task ShowOpenApiDocument(string openapi, string csdl, string csdlFilter, FileInfo output, ILogger logger, CancellationToken cancellationToken) { try { @@ -542,6 +542,8 @@ internal static async Task ShowOpenApiDocument(string openapi, string csdl, stri process.StartInfo.FileName = output.FullName; process.StartInfo.UseShellExecute = true; process.Start(); + + return output.FullName; } else // Write diagram as Markdown document to output file { @@ -551,6 +553,7 @@ internal static async Task ShowOpenApiDocument(string openapi, string csdl, stri WriteTreeDocumentAsMarkdown(openapi ?? csdl, document, writer); } logger.LogTrace("Created markdown document with diagram "); + return output.FullName; } } } @@ -562,6 +565,7 @@ internal static async Task ShowOpenApiDocument(string openapi, string csdl, stri { throw new InvalidOperationException($"Could not generate the document, reason: {ex.Message}", ex); } + return null; } private static void LogErrors(ILogger logger, ReadResult result) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 11b5bc4f3..ac2048ad1 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -84,11 +84,13 @@ public void ReturnOpenApiConvertSettingsWhenSettingsFileIsProvided(string filePa [Fact] public void ShowCommandGeneratesMermaidDiagramAsMarkdown() { - var openApiDoc = new OpenApiDocument(); - openApiDoc.Info = new OpenApiInfo + var openApiDoc = new OpenApiDocument { - Title = "Test", - Version = "1.0.0" + Info = new OpenApiInfo + { + Title = "Test", + Version = "1.0.0" + } }; var stream = new MemoryStream(); using var writer = new StreamWriter(stream); @@ -101,13 +103,15 @@ public void ShowCommandGeneratesMermaidDiagramAsMarkdown() } [Fact] - public void ShowCommandGeneratesMermaidDiagramAsHtml () + public void ShowCommandGeneratesMermaidDiagramAsHtml() { - var openApiDoc = new OpenApiDocument(); - openApiDoc.Info = new OpenApiInfo + var openApiDoc = new OpenApiDocument { - Title = "Test", - Version = "1.0.0" + Info = new OpenApiInfo + { + Title = "Test", + Version = "1.0.0" + } }; var stream = new MemoryStream(); using var writer = new StreamWriter(stream); @@ -118,7 +122,7 @@ public void ShowCommandGeneratesMermaidDiagramAsHtml () var output = reader.ReadToEnd(); Assert.Contains("graph LR", output); } - + [Fact] public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() @@ -131,6 +135,13 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() Assert.Contains("graph LR", output); } + [Fact] + public async Task ShowCommandGeneratesMermaidHtmlFileWithMermaidDiagram() + { + var filePath = await OpenApiService.ShowOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); + Assert.True(File.Exists(filePath)); + } + [Fact] public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiagram() { @@ -185,6 +196,7 @@ public async Task TransformCommandConvertsOpenApi() Assert.NotEmpty(output); } + [Fact] public async Task TransformCommandConvertsOpenApiWithDefaultOutputname() { @@ -195,6 +207,16 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputname() Assert.NotEmpty(output); } + [Fact] + public async Task TransformCommandConvertsCsdlWithDefaultOutputname() + { + // create a dummy ILogger instance for testing + await OpenApiService.TransformOpenApiDocument(null, "UtilityFiles\\Todo.xml", null, null, true, null, null, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); + + var output = File.ReadAllText("output.yml"); + Assert.NotEmpty(output); + } + [Fact] public async Task TransformCommandConvertsOpenApiWithDefaultOutputnameAndSwitchFormat() { From 3ad732025a2893505de3e2b7193c4f616751f921 Mon Sep 17 00:00:00 2001 From: Darrel Miller Date: Mon, 16 Jan 2023 17:43:45 -0500 Subject: [PATCH 251/752] Added a using to dispose a StreamReader --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 64a23dff3..e63a2b9ba 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -225,7 +225,7 @@ private static XslCompiledTransform GetFilterTransform() private static Stream ApplyFilterToCsdl(Stream csdlStream, string entitySetOrSingleton, XslCompiledTransform transform) { Stream stream; - StreamReader inputReader = new(csdlStream); + using StreamReader inputReader = new(csdlStream, leaveOpen: true); XmlReader inputXmlReader = XmlReader.Create(inputReader); MemoryStream filteredStream = new(); StreamWriter writer = new(filteredStream); From 84e2f3c4b81a6734e62806141226654b2db25122 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 20 Jan 2023 21:01:31 +0000 Subject: [PATCH 252/752] Bump Microsoft.OpenApi.OData from 1.2.0-preview9 to 1.2.0 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.2.0-preview9 to 1.2.0. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 232830c37..a53d697b5 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From be61e2a899f19ff9fb2dac9a1c5e74c3198d1b3e Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 31 Jan 2023 14:43:51 +0300 Subject: [PATCH 253/752] Declare the return type as a task of type int in Main() method for us to get the correct exit code in case of a critical error or unsuccessful operation --- src/Microsoft.OpenApi.Hidi/Program.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 056da9ab2..8d3cc3243 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -15,13 +15,12 @@ namespace Microsoft.OpenApi.Hidi { static class Program { - static async Task Main(string[] args) + static async Task Main(string[] args) { var rootCommand = CreateRootCommand(); // Parse the incoming args and invoke the handler - await rootCommand.InvokeAsync(args); - + return await rootCommand.InvokeAsync(args); } internal static RootCommand CreateRootCommand() From a172ef516ffdca1ae5ff153d872e83edfa09f8af Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 31 Jan 2023 14:44:03 +0300 Subject: [PATCH 254/752] Bump up hidi version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index a53d697b5..072c9d3ee 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.2.0 + 1.2.1 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From dfe43d1b0ab78f2a0185ec22baafc60f69b113d8 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 31 Jan 2023 17:45:04 +0300 Subject: [PATCH 255/752] use platform-specific character for separating directory levels in a path string --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index e63a2b9ba..c9214030b 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -287,7 +287,7 @@ private static async Task ParseOpenApi(string openApiFile, bool inli { RuleSet = ValidationRuleSet.GetDefaultRuleSet(), LoadExternalRefs = inlineExternal, - BaseUrl = openApiFile.StartsWith("http") ? new Uri(openApiFile) : new Uri("file:" + new FileInfo(openApiFile).DirectoryName + "\\") + BaseUrl = openApiFile.StartsWith("http") ? new Uri(openApiFile) : new Uri("file:" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar) } ).ReadAsync(stream); From 9305c0e60ee9a38df325b94e94d50f106ca9eba5 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 31 Jan 2023 17:45:19 +0300 Subject: [PATCH 256/752] Update test with correct operationId --- .../Services/OpenApiServiceTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index ac2048ad1..f95acd879 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -38,8 +38,8 @@ public async Task ReturnConvertedCSDLFile() } [Theory] - [InlineData("Todos.Todo.UpdateTodoById",null, 1)] - [InlineData("Todos.Todo.ListTodo",null, 1)] + [InlineData("Todos.Todo.UpdateTodo",null, 1)] + [InlineData("Todos.Todo.ListTodo", null, 1)] [InlineData(null, "Todos.Todo", 4)] public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount) { From e0e32a8366d6b68071e3dbd36d79993880106e31 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 1 Feb 2023 10:21:52 -0500 Subject: [PATCH 257/752] - fixes a bug where the protocol definition would fail on linux OS --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 072c9d3ee..b30d770de 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.2.1 + 1.2.2 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index c9214030b..fa0b5ff51 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -285,9 +285,10 @@ private static async Task ParseOpenApi(string openApiFile, bool inli result = await new OpenApiStreamReader(new OpenApiReaderSettings { - RuleSet = ValidationRuleSet.GetDefaultRuleSet(), LoadExternalRefs = inlineExternal, - BaseUrl = openApiFile.StartsWith("http") ? new Uri(openApiFile) : new Uri("file:" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar) + BaseUrl = openApiFile.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? + new Uri(openApiFile) : + new Uri("file://" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar) } ).ReadAsync(stream); From 65130f985fac01daa6c77de75540fd6936871bb8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Feb 2023 21:57:34 +0000 Subject: [PATCH 258/752] Bump Microsoft.OData.Edm from 7.14.0 to 7.14.1 Bumps Microsoft.OData.Edm from 7.14.0 to 7.14.1. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b30d770de..6ba69e598 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -42,7 +42,7 @@ - + From 9c4ce637b6924c8abab88d436068d9c0c71d1e9f Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 20 Feb 2023 15:11:44 -0500 Subject: [PATCH 259/752] - adds missing cancellation token parameter and passes it along --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index fa0b5ff51..9fdca3f66 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -162,7 +162,7 @@ private static async Task GetOpenApi(string openapi, string csd else { stream = await GetStream(openapi, logger, cancellationToken); - var result = await ParseOpenApi(openapi, inlineExternal, logger, stream); + var result = await ParseOpenApi(openapi, inlineExternal, logger, stream, cancellationToken); document = result.OpenApiDocument; } @@ -253,7 +253,7 @@ public static async Task ValidateOpenApiDocument( { using var stream = await GetStream(openapi, logger, cancellationToken); - var result = await ParseOpenApi(openapi, false, logger, stream); + var result = await ParseOpenApi(openapi, false, logger, stream, cancellationToken); using (logger.BeginScope("Calculating statistics")) { @@ -275,7 +275,7 @@ public static async Task ValidateOpenApiDocument( } } - private static async Task ParseOpenApi(string openApiFile, bool inlineExternal, ILogger logger, Stream stream) + private static async Task ParseOpenApi(string openApiFile, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken) { ReadResult result; Stopwatch stopwatch = Stopwatch.StartNew(); @@ -290,7 +290,7 @@ private static async Task ParseOpenApi(string openApiFile, bool inli new Uri(openApiFile) : new Uri("file://" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar) } - ).ReadAsync(stream); + ).ReadAsync(stream, cancellationToken); logger.LogTrace("{timestamp}ms: Completed parsing.", stopwatch.ElapsedMilliseconds); From 561a98e1f1079a3f147d56afda4250a337fe24f7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Feb 2023 21:57:55 +0000 Subject: [PATCH 260/752] Bump Microsoft.NET.Test.Sdk from 17.4.1 to 17.5.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.4.1 to 17.5.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.4.1...v17.5.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index aaaa66cba..f9b1a0f2c 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -13,7 +13,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + From 2a52726fb69ea5e6fd1f2e287e4fe0f7802ddf99 Mon Sep 17 00:00:00 2001 From: Irvine Sunday <40403681+irvinesunday@users.noreply.github.com> Date: Tue, 28 Feb 2023 15:57:01 +0300 Subject: [PATCH 261/752] [Upgrade] Bumps up conversion lib version Bumps up the `Microsoft.OpenApi.OData` lib. `v1.2.0` to `v1.3.0-preview2` --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 6ba69e598..cc275d5fa 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From 2aa0224d9c8db96f5ea6462cd422bbb203364bc2 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 28 Feb 2023 08:40:35 -0500 Subject: [PATCH 262/752] - bumps hidi version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index cc275d5fa..7d41d9e90 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.2.2 + 1.2.3 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From a5798edbf379e70c563c13753d56464dfe40181a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Mar 2023 21:15:34 +0000 Subject: [PATCH 263/752] Bump Microsoft.OData.Edm from 7.14.1 to 7.15.0 Bumps Microsoft.OData.Edm from 7.14.1 to 7.15.0. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7d41d9e90..2e74545e2 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -42,7 +42,7 @@ - + From ebcc6a356a1c422aa4c4062e9bcae51766ac2d70 Mon Sep 17 00:00:00 2001 From: Charles Wahome Date: Mon, 6 Mar 2023 14:40:20 +0300 Subject: [PATCH 264/752] settings will be passed by the apps that need to override --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 22 +------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 9fdca3f66..4d535ee02 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -324,27 +324,7 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl, stri var edmModel = CsdlReader.Parse(XElement.Parse(csdlText).CreateReader()); var config = GetConfiguration(settingsFile); - var settings = new OpenApiConvertSettings() - { - AddSingleQuotesForStringParameters = true, - AddEnumDescriptionExtension = true, - DeclarePathParametersOnPathItem = true, - EnableKeyAsSegment = true, - EnableOperationId = true, - ErrorResponsesAsDefault = false, - PrefixEntityTypeNameBeforeKey = true, - TagDepth = 2, - EnablePagination = true, - EnableDiscriminatorValue = true, - EnableDerivedTypesReferencesForRequestBody = false, - EnableDerivedTypesReferencesForResponses = false, - ShowRootPath = false, - ShowLinks = false, - ExpandDerivedTypesNavigationProperties = false, - EnableCount = true, - UseSuccessStatusCodeRange = true, - EnableTypeDisambiguationForDefaultValueOfOdataTypeProperty = true - }; + var settings = new OpenApiConvertSettings(); config.GetSection("OpenApiConvertSettings").Bind(settings); OpenApiDocument document = edmModel.ConvertToOpenApi(settings); From b6997c4e70f119f26bd9201e3ac31c4a266526d2 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 7 Mar 2023 15:28:52 +0300 Subject: [PATCH 265/752] Bump lib versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 2e74545e2..98f250626 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.2.3 + 1.2.4 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From 74b289aa8cc46293c83af25327a05e94adc407b3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Mar 2023 21:57:19 +0000 Subject: [PATCH 266/752] Bump Microsoft.OpenApi.OData from 1.3.0-preview2 to 1.3.0-preview3 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.3.0-preview2 to 1.3.0-preview3. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 98f250626..ff90f5379 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From 9a1dad30bfe010813df7930f5f31346e0f6ea124 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Mar 2023 21:57:16 +0000 Subject: [PATCH 267/752] Bump Microsoft.OpenApi.OData from 1.3.0-preview3 to 1.3.0-preview4 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.3.0-preview3 to 1.3.0-preview4. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index ff90f5379..d21a07947 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From e10e2af16b4060fe50abfd97dd385aa912867eaa Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 29 Mar 2023 15:44:35 +0300 Subject: [PATCH 268/752] Adds a metadata version parameter as a commandline option --- .../Handlers/TransformCommandHandler.cs | 4 +++- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 19 ++++++++++++------- src/Microsoft.OpenApi.Hidi/Program.cs | 7 ++++++- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs index d0a49c209..e00cd7efa 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs @@ -19,6 +19,7 @@ internal class TransformCommandHandler : ICommandHandler public Option OutputOption { get; set; } public Option CleanOutputOption { get; set; } public Option VersionOption { get; set; } + public Option MetadataVersionOption { get; set; } public Option FormatOption { get; set; } public Option TerseOutputOption { get; set; } public Option SettingsFileOption { get; set; } @@ -41,6 +42,7 @@ public async Task InvokeAsync(InvocationContext context) FileInfo output = context.ParseResult.GetValueForOption(OutputOption); bool cleanOutput = context.ParseResult.GetValueForOption(CleanOutputOption); string? version = context.ParseResult.GetValueForOption(VersionOption); + string metadataVersion = context.ParseResult.GetValueForOption(MetadataVersionOption); OpenApiFormat? format = context.ParseResult.GetValueForOption(FormatOption); bool terseOutput = context.ParseResult.GetValueForOption(TerseOutputOption); string settingsFile = context.ParseResult.GetValueForOption(SettingsFileOption); @@ -57,7 +59,7 @@ public async Task InvokeAsync(InvocationContext context) var logger = loggerFactory.CreateLogger(); try { - await OpenApiService.TransformOpenApiDocument(openapi, csdl, csdlFilter, output, cleanOutput, version, format, terseOutput, settingsFile, inlineLocal, inlineExternal, filterbyoperationids, filterbytags, filterbycollection, logger, cancellationToken); + await OpenApiService.TransformOpenApiDocument(openapi, csdl, csdlFilter, output, cleanOutput, version, metadataVersion, format, terseOutput, settingsFile, inlineLocal, inlineExternal, filterbyoperationids, filterbytags, filterbycollection, logger, cancellationToken); return 0; } diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 4d535ee02..5d5ec95d4 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; -using System.Linq; using System.Net; using System.Net.Http; using System.Security; @@ -20,7 +19,6 @@ using Microsoft.OpenApi.OData; using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Services; -using Microsoft.OpenApi.Validations; using Microsoft.OpenApi.Writers; using static Microsoft.OpenApi.Hidi.OpenApiSpecVersionHelper; using System.Threading; @@ -43,6 +41,7 @@ public static async Task TransformOpenApiDocument( FileInfo output, bool cleanoutput, string? version, + string metadataVersion, OpenApiFormat? format, bool terseOutput, string settingsFile, @@ -81,7 +80,7 @@ CancellationToken cancellationToken OpenApiFormat openApiFormat = format ?? (!string.IsNullOrEmpty(openapi) ? GetOpenApiFormat(openapi, logger) : OpenApiFormat.Yaml); OpenApiSpecVersion openApiVersion = version != null ? TryParseOpenApiSpecVersion(version) : OpenApiSpecVersion.OpenApi3_0; - OpenApiDocument document = await GetOpenApi(openapi, csdl, csdlFilter, settingsFile, inlineExternal, logger, cancellationToken); + OpenApiDocument document = await GetOpenApi(openapi, csdl, csdlFilter, settingsFile, inlineExternal, logger, cancellationToken, metadataVersion); document = await FilterOpenApiDocument(filterbyoperationids, filterbytags, filterbycollection, document, logger, cancellationToken); WriteOpenApi(output, terseOutput, inlineLocal, inlineExternal, openApiFormat, openApiVersion, document, logger); } @@ -132,11 +131,11 @@ private static void WriteOpenApi(FileInfo output, bool terseOutput, bool inlineL } // Get OpenAPI document either from OpenAPI or CSDL - private static async Task GetOpenApi(string openapi, string csdl, string csdlFilter, string settingsFile, bool inlineExternal, ILogger logger, CancellationToken cancellationToken) + private static async Task GetOpenApi(string openapi, string csdl, string csdlFilter, string settingsFile, bool inlineExternal, ILogger logger, CancellationToken cancellationToken, string metadataVersion = null) { OpenApiDocument document; Stream stream; - + if (!string.IsNullOrEmpty(csdl)) { var stopwatch = new Stopwatch(); @@ -154,7 +153,7 @@ private static async Task GetOpenApi(string openapi, string csd stream = null; } - document = await ConvertCsdlToOpenApi(filteredStream ?? stream, settingsFile, cancellationToken); + document = await ConvertCsdlToOpenApi(filteredStream ?? stream, metadataVersion, settingsFile, cancellationToken); stopwatch.Stop(); logger.LogTrace("{timestamp}ms: Generated OpenAPI with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } @@ -317,7 +316,7 @@ internal static IConfiguration GetConfiguration(string settingsFile) /// /// The CSDL stream. /// An OpenAPI document. - public static async Task ConvertCsdlToOpenApi(Stream csdl, string settingsFile = null, CancellationToken token = default) + public static async Task ConvertCsdlToOpenApi(Stream csdl, string metadataVersion = null, string settingsFile = null, CancellationToken token = default) { using var reader = new StreamReader(csdl); var csdlText = await reader.ReadToEndAsync(token); @@ -325,6 +324,12 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl, stri var config = GetConfiguration(settingsFile); var settings = new OpenApiConvertSettings(); + + if (!string.IsNullOrEmpty(metadataVersion)) + { + settings.SemVerVersion = metadataVersion; + } + config.GetSection("OpenApiConvertSettings").Bind(settings); OpenApiDocument document = edmModel.ConvertToOpenApi(settings); diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 8d3cc3243..9929983ee 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -46,9 +46,12 @@ internal static RootCommand CreateRootCommand() var versionOption = new Option("--version", "OpenAPI specification version"); versionOption.AddAlias("-v"); + var metadataVersionOption = new Option("--metadata-version", "Graph metadata version to use. Defaults to v1.0"); + metadataVersionOption.AddAlias("--mv"); + var formatOption = new Option("--format", "File format"); formatOption.AddAlias("-f"); - + var terseOutputOption = new Option("--terse-output", "Produce terse json output"); terseOutputOption.AddAlias("--to"); @@ -93,6 +96,7 @@ internal static RootCommand CreateRootCommand() outputOption, cleanOutputOption, versionOption, + metadataVersionOption, formatOption, terseOutputOption, settingsFileOption, @@ -112,6 +116,7 @@ internal static RootCommand CreateRootCommand() OutputOption = outputOption, CleanOutputOption = cleanOutputOption, VersionOption = versionOption, + MetadataVersionOption = metadataVersionOption, FormatOption = formatOption, TerseOutputOption = terseOutputOption, SettingsFileOption = settingsFileOption, From 4a540802640267167159c260f91e7d55cc0c6a82 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 29 Mar 2023 15:44:49 +0300 Subject: [PATCH 269/752] Bump lib to latest version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index d21a07947..dc0c3a0cc 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From 90cf6b6566a8cea63b1d5b6123949d54cc232565 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 29 Mar 2023 16:22:19 +0300 Subject: [PATCH 270/752] Clean up tests --- .../Services/OpenApiServiceTests.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index f95acd879..85910465e 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -190,7 +190,7 @@ public async Task TransformCommandConvertsOpenApi() { var fileinfo = new FileInfo("sample.json"); // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml",null, null, fileinfo, true, null, null,false,null,false,false,null,null,null,new Logger(new LoggerFactory()), new CancellationToken()); + await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml",null, null, fileinfo, true, null, null, null,false,null,false,false,null,null,null,new Logger(new LoggerFactory()), new CancellationToken()); var output = File.ReadAllText("sample.json"); Assert.NotEmpty(output); @@ -201,7 +201,7 @@ public async Task TransformCommandConvertsOpenApi() public async Task TransformCommandConvertsOpenApiWithDefaultOutputname() { // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", null, null, null, true, null, null, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); + await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", null, null, null, true, null, null, null, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); var output = File.ReadAllText("output.yml"); Assert.NotEmpty(output); @@ -211,7 +211,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputname() public async Task TransformCommandConvertsCsdlWithDefaultOutputname() { // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocument(null, "UtilityFiles\\Todo.xml", null, null, true, null, null, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); + await OpenApiService.TransformOpenApiDocument(null, "UtilityFiles\\Todo.xml", null, null, true, null, null, null, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); var output = File.ReadAllText("output.yml"); Assert.NotEmpty(output); @@ -221,7 +221,7 @@ public async Task TransformCommandConvertsCsdlWithDefaultOutputname() public async Task TransformCommandConvertsOpenApiWithDefaultOutputnameAndSwitchFormat() { // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", null, null, null, true, "3.0", OpenApiFormat.Yaml, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); + await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", null, null, null, true, "3.0", null, OpenApiFormat.Yaml, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); var output = File.ReadAllText("output.yml"); Assert.NotEmpty(output); @@ -231,7 +231,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputnameAndSwitchF public async Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty() { await Assert.ThrowsAsync(async () => - await OpenApiService.TransformOpenApiDocument(null, null, null, null, true, null, null, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken())); + await OpenApiService.TransformOpenApiDocument(null, null, null, null, true, null, null, null, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken())); } From 5ee3b85177b9f10ee59c190bf787946043f16bb9 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 29 Mar 2023 17:02:51 +0300 Subject: [PATCH 271/752] Update path count for test to pass --- .../Services/OpenApiServiceTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 85910465e..9081c49f5 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -38,9 +38,9 @@ public async Task ReturnConvertedCSDLFile() } [Theory] - [InlineData("Todos.Todo.UpdateTodo",null, 1)] + [InlineData("Todos.Todo.UpdateTodo", null, 1)] [InlineData("Todos.Todo.ListTodo", null, 1)] - [InlineData(null, "Todos.Todo", 4)] + [InlineData(null, "Todos.Todo", 5)] public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount) { // Arrange From 38aefea31e2e72eeaa2196182238d9c1911040f5 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 29 Mar 2023 17:16:32 +0300 Subject: [PATCH 272/752] Update src/Microsoft.OpenApi.Hidi/Program.cs Remove unnecessary section in description Co-authored-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index 9929983ee..5c5bf691a 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -46,7 +46,7 @@ internal static RootCommand CreateRootCommand() var versionOption = new Option("--version", "OpenAPI specification version"); versionOption.AddAlias("-v"); - var metadataVersionOption = new Option("--metadata-version", "Graph metadata version to use. Defaults to v1.0"); + var metadataVersionOption = new Option("--metadata-version", "Graph metadata version to use."); metadataVersionOption.AddAlias("--mv"); var formatOption = new Option("--format", "File format"); From a9c0f50db5996672f7998ebb98dbac19e92d4cac Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 30 Mar 2023 13:26:01 +0300 Subject: [PATCH 273/752] Update lib versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index dc0c3a0cc..a018775cb 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.2.4 + 1.2.5-preview1 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From 272aae36cba8a076cfed455b6d77e17e734e0efb Mon Sep 17 00:00:00 2001 From: Irvine Sunday <40403681+irvinesunday@users.noreply.github.com> Date: Wed, 5 Apr 2023 16:52:11 +0300 Subject: [PATCH 274/752] Update conversion lib. version to `1.4.0-preview1` --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index a018775cb..8ac62a9a2 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From 061e2fcda6365f027068ff06502cad90ea99213e Mon Sep 17 00:00:00 2001 From: Irvine Sunday <40403681+irvinesunday@users.noreply.github.com> Date: Wed, 5 Apr 2023 16:55:43 +0300 Subject: [PATCH 275/752] Bump up hidi version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 8ac62a9a2..092c782a7 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.2.5-preview1 + 1.2.5-preview2 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From 8fda2d31def65ce2b0cb48364d09eb9e20d0665a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Apr 2023 21:57:27 +0000 Subject: [PATCH 276/752] Bump Microsoft.OpenApi.OData from 1.4.0-preview1 to 1.4.0-preview2 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.4.0-preview1 to 1.4.0-preview2. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 092c782a7..aad865a3a 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -1,4 +1,4 @@ - + Exe @@ -43,7 +43,7 @@ - + From eb4f6b70e3bce8aa160d4c5709172059036fb57a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Apr 2023 21:57:29 +0000 Subject: [PATCH 277/752] Bump Microsoft.OpenApi.OData from 1.4.0-preview2 to 1.4.0-preview3 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.4.0-preview2 to 1.4.0-preview3. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index aad865a3a..0986f3216 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From e52ab5ae89656861345d15ef95d73d222b830d10 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Apr 2023 21:57:10 +0000 Subject: [PATCH 278/752] Bump Microsoft.OpenApi.OData from 1.4.0-preview3 to 1.4.0-preview4 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.4.0-preview3 to 1.4.0-preview4. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 0986f3216..19ea9a867 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From f1e802a3712dd8a7899d6febee1eb20f3ce57046 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Apr 2023 21:57:09 +0000 Subject: [PATCH 279/752] Bump Microsoft.OpenApi.OData from 1.4.0-preview4 to 1.4.0-preview5 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.4.0-preview4 to 1.4.0-preview5. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 19ea9a867..e131a5021 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From ab076cfe1f168602bd8bf3e152ac8d4c535957a2 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 26 Apr 2023 13:24:16 +0300 Subject: [PATCH 280/752] Resolve conflicts --- .../UtilityFiles/OpenApiDocumentMock.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 58b85d91d..c38fb1508 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -1,9 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System.Collections.Generic; -using System.Security.Policy; -using Microsoft.OpenApi.Any; +using System.Text.Json.Nodes; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; @@ -599,7 +598,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new Dictionary { { - "x-ms-docs-key-type", new OpenApiString("call") + "x-ms-docs-key-type", new ExtensionTypeCaster("call") } } } @@ -616,7 +615,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new Dictionary { { - "x-ms-docs-operation-type", new OpenApiString("action") + "x-ms-docs-operation-type", new ExtensionTypeCaster("action") } } } @@ -654,7 +653,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new Dictionary { { - "x-ms-docs-key-type", new OpenApiString("group") + "x-ms-docs-key-type", new ExtensionTypeCaster("group") } } }, @@ -671,7 +670,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new Dictionary { { - "x-ms-docs-key-type", new OpenApiString("event") + "x-ms-docs-key-type", new ExtensionTypeCaster("event") } } } @@ -706,7 +705,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new Dictionary { { - "x-ms-docs-operation-type", new OpenApiString("function") + "x-ms-docs-operation-type", new ExtensionTypeCaster("function") } } } From ccd72d761f677cf74016fa2c613e08abc1a11dd6 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 26 Apr 2023 13:24:16 +0300 Subject: [PATCH 281/752] Resolve conflicts --- .../UtilityFiles/OpenApiDocumentMock.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 58b85d91d..c38fb1508 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -1,9 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System.Collections.Generic; -using System.Security.Policy; -using Microsoft.OpenApi.Any; +using System.Text.Json.Nodes; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; @@ -599,7 +598,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new Dictionary { { - "x-ms-docs-key-type", new OpenApiString("call") + "x-ms-docs-key-type", new ExtensionTypeCaster("call") } } } @@ -616,7 +615,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new Dictionary { { - "x-ms-docs-operation-type", new OpenApiString("action") + "x-ms-docs-operation-type", new ExtensionTypeCaster("action") } } } @@ -654,7 +653,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new Dictionary { { - "x-ms-docs-key-type", new OpenApiString("group") + "x-ms-docs-key-type", new ExtensionTypeCaster("group") } } }, @@ -671,7 +670,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new Dictionary { { - "x-ms-docs-key-type", new OpenApiString("event") + "x-ms-docs-key-type", new ExtensionTypeCaster("event") } } } @@ -706,7 +705,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new Dictionary { { - "x-ms-docs-operation-type", new OpenApiString("function") + "x-ms-docs-operation-type", new ExtensionTypeCaster("function") } } } From 337fbb11d8fcf1d773c5836cf770f8142925a011 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 27 Apr 2023 21:57:07 +0000 Subject: [PATCH 282/752] Bump Microsoft.OpenApi.OData from 1.4.0-preview5 to 1.4.0-preview6 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.4.0-preview5 to 1.4.0-preview6. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index e131a5021..2cf28b26a 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From 391645dde804fe32adf3f01063c717e533d2eae2 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 2 May 2023 15:40:36 +0300 Subject: [PATCH 283/752] Clean up code and refactor failing tests --- .../Services/OpenApiServiceTests.cs | 55 ------------------- 1 file changed, 55 deletions(-) delete mode 100644 test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs deleted file mode 100644 index af5437aa1..000000000 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. - -using System; -using System.IO; -using System.Threading.Tasks; -using Microsoft.OpenApi.Hidi; -using Microsoft.OpenApi.Services; -using Xunit; - -namespace Microsoft.OpenApi.Tests.Services -{ - public class OpenApiServiceTests - { - [Fact] - public async Task ReturnConvertedCSDLFile() - { - // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml"); - var fileInput = new FileInfo(filePath); - var csdlStream = fileInput.OpenRead(); - - // Act - var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream); - var expectedPathCount = 5; - - // Assert - Assert.NotNull(openApiDoc); - Assert.NotEmpty(openApiDoc.Paths); - Assert.Equal(expectedPathCount, openApiDoc.Paths.Count); - } - - [Theory] - [InlineData("Todos.Todo.UpdateTodo",null, 1)] - [InlineData("Todos.Todo.ListTodo",null, 1)] - [InlineData(null, "Todos.Todo", 4)] - public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount) - { - // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml"); - var fileInput = new FileInfo(filePath); - var csdlStream = fileInput.OpenRead(); - - // Act - var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream); - var predicate = OpenApiFilterService.CreatePredicate(operationIds, tags); - var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(openApiDoc, predicate); - - // Assert - Assert.NotNull(subsetOpenApiDocument); - Assert.NotEmpty(subsetOpenApiDocument.Paths); - Assert.Equal(expectedPathCount, subsetOpenApiDocument.Paths.Count); - } - } -} From 71f4ef481832189e564c03551e84970325a08eba Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 2 May 2023 21:57:12 +0000 Subject: [PATCH 284/752] Bump Microsoft.OpenApi.OData from 1.4.0-preview6 to 1.4.0-preview7 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.4.0-preview6 to 1.4.0-preview7. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 2cf28b26a..77a215d96 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From badeaf3d9a1c238b70b4b7c68297f21d68a5d237 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Wed, 3 May 2023 10:16:12 +0300 Subject: [PATCH 285/752] Bump up lib. version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 77a215d96..e370c84bb 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.2.5-preview2 + 1.2.5-preview3 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET @@ -43,7 +43,7 @@ - + From 3d27883b7fc808c23e19f8f10542647f8276467e Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Mon, 8 May 2023 16:20:24 -0700 Subject: [PATCH 286/752] Add OpenAPI formatter for PS --- .../Formatters/PowerShellFormatter.cs | 210 ++++++++++++++++++ .../Handlers/TransformCommandHandler.cs | 4 +- .../Microsoft.OpenApi.Hidi.csproj | 1 + src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 69 +++--- src/Microsoft.OpenApi.Hidi/Program.cs | 14 +- .../Services/OpenApiServiceTests.cs | 26 +-- 6 files changed, 272 insertions(+), 52 deletions(-) create mode 100644 src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs new file mode 100644 index 000000000..df8fbb948 --- /dev/null +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -0,0 +1,210 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; +using Humanizer; +using Humanizer.Inflections; +using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Services; + +namespace Microsoft.OpenApi.Hidi.Formatters +{ + internal class PowerShellFormatter : OpenApiVisitorBase + { + private const string DefaultPutPrefix = ".Update"; + private const string PowerShellPutPrefix = ".Set"; + private readonly Stack _schemaLoop = new(); + private static readonly Regex s_oDataCastRegex = new("(.*(?<=[a-z]))\\.(As(?=[A-Z]).*)", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); + private static readonly Regex s_hashSuffixRegex = new(@"^[^-]+", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); + private static readonly Regex s_oDataRefRegex = new("(?<=[a-z])Ref(?=[A-Z])", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); + + static PowerShellFormatter() + { + // Add singularization exclusions. + // TODO: Read exclusions from a user provided file. + Vocabularies.Default.AddSingular("(drive)s$", "$1"); // drives does not properly singularize to drive. + Vocabularies.Default.AddSingular("(data)$", "$1"); // exclude the following from singularization. + Vocabularies.Default.AddSingular("(delta)$", "$1"); + Vocabularies.Default.AddSingular("(quota)$", "$1"); + Vocabularies.Default.AddSingular("(statistics)$", "$1"); + } + + //TODO: FHL for PS + // Fixes (Order matters): + // 1. Singularize operationId operationIdSegments. + // 2. Add '_' to verb in an operationId. + // 3. Fix odata cast operationIds. + // 4. Fix hash suffix in operationIds. + // 5. Fix Put operation id should have -> {xxx}_Set{Yyy} + // 5. Fix anyOf and oneOf schema. + // 6. Add AdditionalProperties to object schemas. + + public override void Visit(OpenApiSchema schema) + { + AddAddtionalPropertiesToSchema(schema); + ResolveAnyOfSchema(schema); + ResolveOneOfSchema(schema); + + base.Visit(schema); + } + + public override void Visit(OpenApiPathItem pathItem) + { + if (pathItem.Operations.ContainsKey(OperationType.Put)) + { + var operationId = pathItem.Operations[OperationType.Put].OperationId; + pathItem.Operations[OperationType.Put].OperationId = ResolvePutOperationId(operationId); + } + + base.Visit(pathItem); + } + + public override void Visit(OpenApiOperation operation) + { + if (operation.OperationId == null) + throw new ArgumentNullException(nameof(operation.OperationId), $"OperationId is required {PathString}"); + + var operationId = operation.OperationId; + + operationId = RemoveHashSuffix(operationId); + operationId = ResolveODataCastOperationId(operationId); + operationId = ResolveByRefOperationId(operationId); + + + var operationIdSegments = operationId.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries).ToList(); + operationId = SingularizeAndDeduplicateOperationId(operationIdSegments); + + operation.OperationId = operationId; + base.Visit(operation); + } + + private void AddAddtionalPropertiesToSchema(OpenApiSchema schema) + { + if (schema != null && !_schemaLoop.Contains(schema) && "object".Equals(schema?.Type, StringComparison.OrdinalIgnoreCase)) + { + schema.AdditionalProperties = new OpenApiSchema() { Type = "object" }; + + /* Because 'additionalProperties' are now being walked, + * we need a way to keep track of visited schemas to avoid + * endlessly creating and walking them in an infinite recursion. + */ + _schemaLoop.Push(schema.AdditionalProperties); + } + } + + private static void ResolveOneOfSchema(OpenApiSchema schema) + { + if (schema.OneOf?.Any() ?? false) + { + var newSchema = schema.OneOf.FirstOrDefault(); + schema.OneOf = null; + FlattenSchema(schema, newSchema); + } + } + + private static void ResolveAnyOfSchema(OpenApiSchema schema) + { + if (schema.AnyOf?.Any() ?? false) + { + var newSchema = schema.AnyOf.FirstOrDefault(); + schema.AnyOf = null; + FlattenSchema(schema, newSchema); + } + } + + private static string ResolvePutOperationId(string operationId) + { + return operationId.Contains(DefaultPutPrefix) ? + operationId.Replace(DefaultPutPrefix, PowerShellPutPrefix) : operationId; + } + + private static string ResolveByRefOperationId(string operationId) + { + // Update $ref path operationId name + // Ref key word is enclosed between lower-cased and upper-cased letters + // Ex.: applications_GetRefCreatedOnBehalfOf to applications_GetCreatedOnBehalfOfByRef + return s_oDataRefRegex.Match(operationId).Success ? $"{s_oDataRefRegex.Replace(operationId, string.Empty)}ByRef" : operationId; + } + + private static string ResolveODataCastOperationId(string operationId) + { + var match = s_oDataCastRegex.Match(operationId); + return match.Success ? $"{match.Groups[1]}{match.Groups[2]}" : operationId; + } + + private static string SingularizeAndDeduplicateOperationId(IList operationIdSegments) + { + var segmentsCount = operationIdSegments.Count; + var lastSegmentIndex = segmentsCount - 1; + var singularizedSegments = new List(); + + for (int x = 0; x < segmentsCount; x++) + { + var segment = operationIdSegments[x].Singularize(inputIsKnownToBePlural: false); + + // If a segment name is contained in the previous segment, the latter is considered a duplicate. + // The last segment is ignored as a rule. + if ((x > 0 && x < lastSegmentIndex) && singularizedSegments.Last().Equals(segment, StringComparison.OrdinalIgnoreCase)) + continue; + + singularizedSegments.Add(segment); + } + return string.Join(".", singularizedSegments); + } + + private static string RemoveHashSuffix(string operationId) + { + // Remove hash suffix values from OperationIds. + return s_hashSuffixRegex.Match(operationId).Value; + } + + private static void FlattenSchema(OpenApiSchema schema, OpenApiSchema newSchema) + { + if (newSchema != null) + { + if (newSchema.Reference != null) + { + schema.Reference = newSchema.Reference; + schema.UnresolvedReference = true; + } + else + { + // Copies schema properties based on https://github.com/microsoft/OpenAPI.NET.OData/pull/264. + CopySchema(schema, newSchema); + } + } + } + + private static void CopySchema(OpenApiSchema schema, OpenApiSchema newSchema) + { + schema.Title ??= newSchema.Title; + schema.Type ??= newSchema.Type; + schema.Format ??= newSchema.Format; + schema.Description ??= newSchema.Description; + schema.Maximum ??= newSchema.Maximum; + schema.ExclusiveMaximum ??= newSchema.ExclusiveMaximum; + schema.Minimum ??= newSchema.Minimum; + schema.ExclusiveMinimum ??= newSchema.ExclusiveMinimum; + schema.MaxLength ??= newSchema.MaxLength; + schema.MinLength ??= newSchema.MinLength; + schema.Pattern ??= newSchema.Pattern; + schema.MultipleOf ??= newSchema.MultipleOf; + schema.Not ??= newSchema.Not; + schema.Required ??= newSchema.Required; + schema.Items ??= newSchema.Items; + schema.MaxItems ??= newSchema.MaxItems; + schema.MinItems ??= newSchema.MinItems; + schema.UniqueItems ??= newSchema.UniqueItems; + schema.Properties ??= newSchema.Properties; + schema.MaxProperties ??= newSchema.MaxProperties; + schema.MinProperties ??= newSchema.MinProperties; + schema.Discriminator ??= newSchema.Discriminator; + schema.ExternalDocs ??= newSchema.ExternalDocs; + schema.Enum ??= newSchema.Enum; + schema.ReadOnly = !schema.ReadOnly ? newSchema.ReadOnly : schema.ReadOnly; + schema.WriteOnly = !schema.WriteOnly ? newSchema.WriteOnly : schema.WriteOnly; + schema.Nullable = !schema.Nullable ? newSchema.Nullable : schema.Nullable; + schema.Deprecated = !schema.Deprecated ? newSchema.Deprecated : schema.Deprecated; + } + } +} diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs index e00cd7efa..1c4262ba5 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs @@ -29,6 +29,7 @@ internal class TransformCommandHandler : ICommandHandler public Option FilterByCollectionOption { get; set; } public Option InlineLocalOption { get; set; } public Option InlineExternalOption { get; set; } + public Option LanguageFormatOption { get; set; } public int Invoke(InvocationContext context) { @@ -49,6 +50,7 @@ public async Task InvokeAsync(InvocationContext context) LogLevel logLevel = context.ParseResult.GetValueForOption(LogLevelOption); bool inlineLocal = context.ParseResult.GetValueForOption(InlineLocalOption); bool inlineExternal = context.ParseResult.GetValueForOption(InlineExternalOption); + string? languageFormatOption = context.ParseResult.GetValueForOption(LanguageFormatOption); string filterbyoperationids = context.ParseResult.GetValueForOption(FilterByOperationIdsOption); string filterbytags = context.ParseResult.GetValueForOption(FilterByTagsOption); string filterbycollection = context.ParseResult.GetValueForOption(FilterByCollectionOption); @@ -59,7 +61,7 @@ public async Task InvokeAsync(InvocationContext context) var logger = loggerFactory.CreateLogger(); try { - await OpenApiService.TransformOpenApiDocument(openapi, csdl, csdlFilter, output, cleanOutput, version, metadataVersion, format, terseOutput, settingsFile, inlineLocal, inlineExternal, filterbyoperationids, filterbytags, filterbycollection, logger, cancellationToken); + await OpenApiService.TransformOpenApiDocument(openapi, csdl, csdlFilter, output, cleanOutput, version, metadataVersion, format, terseOutput, settingsFile, inlineLocal, inlineExternal, languageFormatOption, filterbyoperationids, filterbytags, filterbycollection, logger, cancellationToken); return 0; } diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index e370c84bb..2cc6ceae6 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -37,6 +37,7 @@ + diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 5d5ec95d4..73d12806c 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -26,6 +26,7 @@ using System.Xml; using System.Reflection; using Microsoft.Extensions.Configuration; +using Microsoft.OpenApi.Hidi.Formatters; namespace Microsoft.OpenApi.Hidi { @@ -47,6 +48,7 @@ public static async Task TransformOpenApiDocument( string settingsFile, bool inlineLocal, bool inlineExternal, + string? languageFormatOption, string filterbyoperationids, string filterbytags, string filterbycollection, @@ -82,6 +84,13 @@ CancellationToken cancellationToken OpenApiDocument document = await GetOpenApi(openapi, csdl, csdlFilter, settingsFile, inlineExternal, logger, cancellationToken, metadataVersion); document = await FilterOpenApiDocument(filterbyoperationids, filterbytags, filterbycollection, document, logger, cancellationToken); + if (!string.IsNullOrWhiteSpace(languageFormatOption) && languageFormatOption.Equals("PowerShell", StringComparison.InvariantCultureIgnoreCase)) + { + // PowerShell Walker. + var powerShellFormatter = new PowerShellFormatter(); + var walker = new OpenApiWalker(powerShellFormatter); + walker.Walk(document); + } WriteOpenApi(output, terseOutput, inlineLocal, inlineExternal, openApiFormat, openApiVersion, document, logger); } catch (TaskCanceledException) @@ -98,7 +107,7 @@ CancellationToken cancellationToken } } - private static void WriteOpenApi(FileInfo output, bool terseOutput, bool inlineLocal, bool inlineExternal, OpenApiFormat openApiFormat, OpenApiSpecVersion openApiVersion, OpenApiDocument document, ILogger logger) + private static void WriteOpenApi(FileInfo output, bool terseOutput, bool inlineLocal, bool inlineExternal, OpenApiFormat openApiFormat, OpenApiSpecVersion openApiVersion, OpenApiDocument document, ILogger logger) { using (logger.BeginScope("Output")) { @@ -135,7 +144,7 @@ private static async Task GetOpenApi(string openapi, string csd { OpenApiDocument document; Stream stream; - + if (!string.IsNullOrEmpty(csdl)) { var stopwatch = new Stopwatch(); @@ -168,7 +177,7 @@ private static async Task GetOpenApi(string openapi, string csd return document; } - private static async Task FilterOpenApiDocument(string filterbyoperationids, string filterbytags, string filterbycollection, OpenApiDocument document, ILogger logger, CancellationToken cancellationToken) + private static async Task FilterOpenApiDocument(string filterbyoperationids, string filterbytags, string filterbycollection, OpenApiDocument document, ILogger logger, CancellationToken cancellationToken) { using (logger.BeginScope("Filter")) { @@ -239,8 +248,8 @@ private static Stream ApplyFilterToCsdl(Stream csdlStream, string entitySetOrSin /// Implementation of the validate command /// public static async Task ValidateOpenApiDocument( - string openapi, - ILogger logger, + string openapi, + ILogger logger, CancellationToken cancellationToken) { if (string.IsNullOrEmpty(openapi)) @@ -285,7 +294,7 @@ private static async Task ParseOpenApi(string openApiFile, bool inli result = await new OpenApiStreamReader(new OpenApiReaderSettings { LoadExternalRefs = inlineExternal, - BaseUrl = openApiFile.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? + BaseUrl = openApiFile.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? new Uri(openApiFile) : new Uri("file://" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar) } @@ -296,7 +305,7 @@ private static async Task ParseOpenApi(string openApiFile, bool inli LogErrors(logger, result); stopwatch.Stop(); } - + return result; } @@ -310,7 +319,7 @@ internal static IConfiguration GetConfiguration(string settingsFile) return config; } - + /// /// Converts CSDL to OpenAPI /// @@ -329,7 +338,7 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl, stri { settings.SemVerVersion = metadataVersion; } - + config.GetSection("OpenApiConvertSettings").Bind(settings); OpenApiDocument document = edmModel.ConvertToOpenApi(settings); @@ -354,7 +363,7 @@ public static OpenApiDocument FixReferences(OpenApiDocument document) return doc; } - + /// /// Takes in a file stream, parses the stream into a JsonDocument and gets a list of paths and Http methods /// @@ -377,13 +386,13 @@ public static Dictionary> ParseJsonCollectionFile(Stream st private static Dictionary> EnumerateJsonDocument(JsonElement itemElement, Dictionary> paths) { var itemsArray = itemElement.GetProperty("item"); - + foreach (var item in itemsArray.EnumerateArray()) { - if(item.ValueKind == JsonValueKind.Object) + if (item.ValueKind == JsonValueKind.Object) { - if(item.TryGetProperty("request", out var request)) - { + if (item.TryGetProperty("request", out var request)) + { // Fetch list of methods and urls from collection, store them in a dictionary var path = request.GetProperty("url").GetProperty("raw").ToString(); var method = request.GetProperty("method").ToString(); @@ -395,11 +404,11 @@ private static Dictionary> EnumerateJsonDocument(JsonElemen { paths[path].Add(method); } - } - else - { + } + else + { EnumerateJsonDocument(item, paths); - } + } } else { @@ -508,11 +517,11 @@ internal static async Task ShowOpenApiDocument(string openapi, string cs if (output == null) { var tempPath = Path.GetTempPath() + "/hidi/"; - if(!File.Exists(tempPath)) + if (!File.Exists(tempPath)) { Directory.CreateDirectory(tempPath); - } - + } + var fileName = Path.GetRandomFileName(); output = new FileInfo(Path.Combine(tempPath, fileName + ".html")); @@ -528,7 +537,7 @@ internal static async Task ShowOpenApiDocument(string openapi, string cs process.StartInfo.FileName = output.FullName; process.StartInfo.UseShellExecute = true; process.Start(); - + return output.FullName; } else // Write diagram as Markdown document to output file @@ -540,7 +549,7 @@ internal static async Task ShowOpenApiDocument(string openapi, string cs } logger.LogTrace("Created markdown document with diagram "); return output.FullName; - } + } } } catch (TaskCanceledException) @@ -563,7 +572,7 @@ private static void LogErrors(ILogger logger, ReadResult result) { foreach (var error in context.Errors) { - logger.LogError($"Detected error during parsing: {error}",error.ToString()); + logger.LogError($"Detected error during parsing: {error}", error.ToString()); } } } @@ -581,7 +590,7 @@ internal static void WriteTreeDocumentAsMarkdown(string openapiUrl, OpenApiDocum // write a span for each mermaidcolorscheme foreach (var style in OpenApiUrlTreeNode.MermaidNodeStyles) { - writer.WriteLine($"{style.Key.Replace("_"," ")}"); + writer.WriteLine($"{style.Key.Replace("_", " ")}"); } writer.WriteLine("
"); writer.WriteLine(); @@ -609,7 +618,7 @@ internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument d writer.WriteLine("

" + document.Info.Title + "

"); writer.WriteLine(); writer.WriteLine($"

API Description: {sourceUrl}

"); - + writer.WriteLine(@"
"); // write a span for each mermaidcolorscheme foreach (var style in OpenApiUrlTreeNode.MermaidNodeStyles) @@ -622,8 +631,8 @@ internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument d rootNode.WriteMermaid(writer); writer.WriteLine(""); - // Write script tag to include JS library for rendering markdown - writer.WriteLine(@""); - // Write script tag to include JS library for rendering mermaid - writer.WriteLine("("--format", "File format"); formatOption.AddAlias("-f"); - + var terseOutputOption = new Option("--terse-output", "Produce terse json output"); terseOutputOption.AddAlias("--to"); @@ -76,6 +73,9 @@ internal static RootCommand CreateRootCommand() var inlineExternalOption = new Option("--inline-external", "Inline external $ref instances"); inlineExternalOption.AddAlias("--ie"); + // TODO: Move to settings file (--settings-path). + var languageFormatOption = new Option("--language-style", "Language to format the OpenAPI document. e.g. powershell"); + var validateCommand = new Command("validate") { descriptionOption, @@ -105,7 +105,8 @@ internal static RootCommand CreateRootCommand() filterByTagsOption, filterByCollectionOption, inlineLocalOption, - inlineExternalOption + inlineExternalOption, + languageFormatOption }; transformCommand.Handler = new TransformCommandHandler @@ -125,7 +126,8 @@ internal static RootCommand CreateRootCommand() FilterByTagsOption = filterByTagsOption, FilterByCollectionOption = filterByCollectionOption, InlineLocalOption = inlineLocalOption, - InlineExternalOption = inlineExternalOption + InlineExternalOption = inlineExternalOption, + LanguageFormatOption = languageFormatOption }; var showCommand = new Command("show") diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 9081c49f5..50a85fb15 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -3,16 +3,12 @@ using System.CommandLine; using System.CommandLine.Invocation; -using System.Text; -using Castle.Core.Logging; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Hidi; -using Microsoft.OpenApi.Hidi.Handlers; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.OData; using Microsoft.OpenApi.Services; -using Microsoft.VisualStudio.TestPlatform.Utilities; using Xunit; namespace Microsoft.OpenApi.Tests.Services @@ -36,7 +32,7 @@ public async Task ReturnConvertedCSDLFile() Assert.NotEmpty(openApiDoc.Paths); Assert.Equal(expectedPathCount, openApiDoc.Paths.Count); } - + [Theory] [InlineData("Todos.Todo.UpdateTodo", null, 1)] [InlineData("Todos.Todo.ListTodo", null, 1)] @@ -47,7 +43,7 @@ public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocumen var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml"); var fileInput = new FileInfo(filePath); var csdlStream = fileInput.OpenRead(); - + // Act var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream); var predicate = OpenApiFilterService.CreatePredicate(operationIds, tags); @@ -58,7 +54,7 @@ public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocumen Assert.NotEmpty(subsetOpenApiDocument.Paths); Assert.Equal(expectedPathCount, subsetOpenApiDocument.Paths.Count); } - + [Theory] [InlineData("UtilityFiles/appsettingstest.json")] [InlineData(null)] @@ -122,7 +118,7 @@ public void ShowCommandGeneratesMermaidDiagramAsHtml() var output = reader.ReadToEnd(); Assert.Contains("graph LR", output); } - + [Fact] public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() @@ -190,18 +186,18 @@ public async Task TransformCommandConvertsOpenApi() { var fileinfo = new FileInfo("sample.json"); // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml",null, null, fileinfo, true, null, null, null,false,null,false,false,null,null,null,new Logger(new LoggerFactory()), new CancellationToken()); + await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", null, null, fileinfo, true, null, null, null, false, null, false, false, null, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); var output = File.ReadAllText("sample.json"); Assert.NotEmpty(output); } - + [Fact] public async Task TransformCommandConvertsOpenApiWithDefaultOutputname() { // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", null, null, null, true, null, null, null, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); + await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", null, null, null, true, null, null, null, false, null, false, false, null, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); var output = File.ReadAllText("output.yml"); Assert.NotEmpty(output); @@ -211,7 +207,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputname() public async Task TransformCommandConvertsCsdlWithDefaultOutputname() { // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocument(null, "UtilityFiles\\Todo.xml", null, null, true, null, null, null, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); + await OpenApiService.TransformOpenApiDocument(null, "UtilityFiles\\Todo.xml", null, null, true, null, null, null, false, null, false, false, null, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); var output = File.ReadAllText("output.yml"); Assert.NotEmpty(output); @@ -221,7 +217,7 @@ public async Task TransformCommandConvertsCsdlWithDefaultOutputname() public async Task TransformCommandConvertsOpenApiWithDefaultOutputnameAndSwitchFormat() { // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", null, null, null, true, "3.0", null, OpenApiFormat.Yaml, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); + await OpenApiService.TransformOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", null, null, null, true, "3.0", null, OpenApiFormat.Yaml, false, null, false, false, null, null, null, null, new Logger(new LoggerFactory()), new CancellationToken()); var output = File.ReadAllText("output.yml"); Assert.NotEmpty(output); @@ -231,7 +227,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputnameAndSwitchF public async Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty() { await Assert.ThrowsAsync(async () => - await OpenApiService.TransformOpenApiDocument(null, null, null, null, true, null, null, null, false, null, false, false, null, null, null, new Logger(new LoggerFactory()), new CancellationToken())); + await OpenApiService.TransformOpenApiDocument(null, null, null, null, true, null, null, null, false, null, false, false, null, null, null, null, new Logger(new LoggerFactory()), new CancellationToken())); } @@ -239,7 +235,7 @@ await Assert.ThrowsAsync(async () => public void InvokeTransformCommand() { var rootCommand = Program.CreateRootCommand(); - var args = new string[] { "transform", "-d", ".\\UtilityFiles\\SampleOpenApi.yml", "-o", "sample.json","--co" }; + var args = new string[] { "transform", "-d", ".\\UtilityFiles\\SampleOpenApi.yml", "-o", "sample.json", "--co" }; var parseResult = rootCommand.Parse(args); var handler = rootCommand.Subcommands.Where(c => c.Name == "transform").First().Handler; var context = new InvocationContext(parseResult); From d5ad5784b9cc6d43658b821794447c9c1994faaf Mon Sep 17 00:00:00 2001 From: Peter Ombwa Date: Tue, 9 May 2023 17:01:26 -0700 Subject: [PATCH 287/752] Use strongly typed config and options --- .../Extensions/CommandExtensions.cs | 19 +++ .../Handlers/ShowCommandHandler.cs | 25 ++-- .../Handlers/TransformCommandHandler.cs | 49 ++----- .../Handlers/ValidateCommandHandler.cs | 19 +-- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 88 ++++-------- .../Options/CommandOptions.cs | 93 ++++++++++++ .../Options/FilterOptions.cs | 12 ++ .../Options/HidiOptions.cs | 62 ++++++++ src/Microsoft.OpenApi.Hidi/Program.cs | 134 ++---------------- .../Utilities/SettingsUtilities.cs | 32 +++++ .../Services/OpenApiServiceTests.cs | 58 ++++++-- 11 files changed, 335 insertions(+), 256 deletions(-) create mode 100644 src/Microsoft.OpenApi.Hidi/Extensions/CommandExtensions.cs create mode 100644 src/Microsoft.OpenApi.Hidi/Options/CommandOptions.cs create mode 100644 src/Microsoft.OpenApi.Hidi/Options/FilterOptions.cs create mode 100644 src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs create mode 100644 src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/CommandExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/CommandExtensions.cs new file mode 100644 index 000000000..9d5077432 --- /dev/null +++ b/src/Microsoft.OpenApi.Hidi/Extensions/CommandExtensions.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System.Collections.Generic; +using System.CommandLine; + +namespace Microsoft.OpenApi.Hidi.Extensions +{ + internal static class CommandExtensions + { + public static void AddOptions(this Command command, IReadOnlyList
"); writer.WriteLine(); @@ -609,7 +609,7 @@ internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument d writer.WriteLine("

" + document.Info.Title + "

"); writer.WriteLine(); writer.WriteLine($"

API Description: {sourceUrl}

"); - + writer.WriteLine(@"
"); // write a span for each mermaidcolorscheme foreach (var style in OpenApiUrlTreeNode.MermaidNodeStyles) @@ -622,8 +622,8 @@ internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument d rootNode.WriteMermaid(writer); writer.WriteLine(""); - // Write script tag to include JS library for rendering markdown - writer.WriteLine(@""); - // Write script tag to include JS library for rendering mermaid - writer.WriteLine("("--format", "File format"); formatOption.AddAlias("-f"); - + var terseOutputOption = new Option("--terse-output", "Produce terse json output"); terseOutputOption.AddAlias("--to"); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 176fb20d1..ec1722e76 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System; -using System.IO; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Hidi; using Microsoft.OpenApi.Models; diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index fbf11b25c..dd175f04e 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -1,10 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System.Text.Json.Nodes; using Json.Schema; using Microsoft.OpenApi.Any; -using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; @@ -186,7 +184,7 @@ public static OpenApiDocument CreateOpenApiDocument() Required = true, Schema31 = new JsonSchemaBuilder().Type(SchemaValueType.String) } - } + } }, ["/users"] = new OpenApiPathItem() { @@ -221,14 +219,14 @@ public static OpenApiDocument CreateOpenApiDocument() Schema31 = new JsonSchemaBuilder() .Title("Collection of user") .Type(SchemaValueType.Object) - .Properties(("value", + .Properties(("value", new JsonSchemaBuilder() .Type(SchemaValueType.Array) .Items(new JsonSchemaBuilder() .Ref("microsoft.graph.user") .Build()) .Build())) - .Build() + .Build() } } } @@ -407,7 +405,7 @@ public static OpenApiDocument CreateOpenApiDocument() new JsonSchemaBuilder() .Type(SchemaValueType.String) .Build()) - .Build() + .Build() } } } @@ -482,7 +480,7 @@ public static OpenApiDocument CreateOpenApiDocument() Schema31 = new JsonSchemaBuilder() .Title("Collection of hostSecurityProfile") .Type(SchemaValueType.Object) - .Properties(("value1", + .Properties(("value1", new JsonSchemaBuilder() .Type(SchemaValueType.Array) .Items(new JsonSchemaBuilder().Ref("microsoft.graph.networkInterface").Build()) From 88bb03bb7fbea9026cc8f3fc08a07fde0b39bb86 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Jun 2023 21:57:06 +0000 Subject: [PATCH 323/752] Bump Microsoft.OData.Edm from 7.16.0 to 7.17.0 Bumps Microsoft.OData.Edm from 7.16.0 to 7.17.0. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 004aa48cd..3a5ff6880 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From 9715a4dcda1a4a881390638e9eb02e0c14b9c628 Mon Sep 17 00:00:00 2001 From: Mike Kistler Date: Mon, 26 Jun 2023 20:30:15 -0500 Subject: [PATCH 324/752] Fix hardcoded non-portable path separators --- .../Services/OpenApiFilterServiceTests.cs | 8 ++--- .../Services/OpenApiServiceTests.cs | 33 ++++++++++--------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 3733ad848..3c039b9aa 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -51,7 +51,7 @@ public void ReturnFilteredOpenApiDocumentBasedOnOperationIdsAndTags(string opera public void ReturnFilteredOpenApiDocumentBasedOnPostmanCollection() { // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver2.json"); + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver2.json"); var fileInput = new FileInfo(filePath); var stream = fileInput.OpenRead(); @@ -107,7 +107,7 @@ public void TestPredicateFiltersUsingRelativeRequestUrls() public void ShouldParseNestedPostmanCollection() { // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver3.json"); + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver3.json"); var fileInput = new FileInfo(filePath); var stream = fileInput.OpenRead(); @@ -124,7 +124,7 @@ public void ShouldParseNestedPostmanCollection() public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument() { // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver1.json"); + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver1.json"); var fileInput = new FileInfo(filePath); var stream = fileInput.OpenRead(); @@ -141,7 +141,7 @@ public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument() public void ContinueProcessingWhenUrlsInCollectionAreMissingFromSourceDocument() { // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\postmanCollection_ver4.json"); + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver4.json"); var fileInput = new FileInfo(filePath); var stream = fileInput.OpenRead(); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index c092da510..49f1bbd96 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -30,7 +30,7 @@ public OpenApiServiceTests() public async Task ReturnConvertedCSDLFile() { // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml"); + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "Todo.xml"); var fileInput = new FileInfo(filePath); var csdlStream = fileInput.OpenRead(); // Act @@ -50,7 +50,7 @@ public async Task ReturnConvertedCSDLFile() public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount) { // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\Todo.xml"); + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "Todo.xml"); var fileInput = new FileInfo(filePath); var csdlStream = fileInput.OpenRead(); @@ -137,7 +137,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() // create a dummy ILogger instance for testing var options = new HidiOptions() { - OpenApi = "UtilityFiles\\SampleOpenApi.yml", + OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), Output = new FileInfo("sample.md") }; @@ -152,7 +152,7 @@ public async Task ShowCommandGeneratesMermaidHtmlFileWithMermaidDiagram() { var options = new HidiOptions() { - OpenApi = "UtilityFiles\\SampleOpenApi.yml" + OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml") }; var filePath = await OpenApiService.ShowOpenApiDocument(options, _logger, new CancellationToken()); Assert.True(File.Exists(filePath)); @@ -163,7 +163,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiag { var options = new HidiOptions() { - Csdl = "UtilityFiles\\Todo.xml", + Csdl = Path.Combine("UtilityFiles", "Todo.xml"), CsdlFilter = "todos", Output = new FileInfo("sample.md") }; @@ -201,7 +201,7 @@ await Assert.ThrowsAsync(async () => public async Task ValidateCommandProcessesOpenApi() { // create a dummy ILogger instance for testing - await OpenApiService.ValidateOpenApiDocument("UtilityFiles\\SampleOpenApi.yml", _logger, new CancellationToken()); + await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger, new CancellationToken()); Assert.True(true); } @@ -212,7 +212,7 @@ public async Task TransformCommandConvertsOpenApi() { HidiOptions options = new HidiOptions { - OpenApi = "UtilityFiles\\SampleOpenApi.yml", + OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), Output = new FileInfo("sample.json"), CleanOutput = true, TerseOutput = false, @@ -232,7 +232,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputname() { HidiOptions options = new HidiOptions { - OpenApi = "UtilityFiles\\SampleOpenApi.yml", + OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), CleanOutput = true, TerseOutput = false, InlineLocal = false, @@ -250,7 +250,7 @@ public async Task TransformCommandConvertsCsdlWithDefaultOutputname() { HidiOptions options = new HidiOptions { - Csdl = "UtilityFiles\\Todo.xml", + Csdl = Path.Combine("UtilityFiles", "Todo.xml"), CleanOutput = true, TerseOutput = false, InlineLocal = false, @@ -268,7 +268,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputnameAndSwitchF { HidiOptions options = new HidiOptions { - OpenApi = "UtilityFiles\\SampleOpenApi.yml", + OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), CleanOutput = true, Version = "3.0", OpenApiFormat = OpenApiFormat.Yaml, @@ -301,10 +301,10 @@ await Assert.ThrowsAsync(async () => [Fact] public async Task TransformToPowerShellCompliantOpenApi() { - var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles\\examplepowershellsettings.json"); + var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "examplepowershellsettings.json"); HidiOptions options = new HidiOptions { - OpenApi = "UtilityFiles\\SampleOpenApi.yml", + OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), CleanOutput = true, Version = "3.0", OpenApiFormat = OpenApiFormat.Yaml, @@ -324,7 +324,8 @@ public async Task TransformToPowerShellCompliantOpenApi() public void InvokeTransformCommand() { var rootCommand = Program.CreateRootCommand(); - var args = new string[] { "transform", "-d", ".\\UtilityFiles\\SampleOpenApi.yml", "-o", "sample.json", "--co" }; + var openapi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); + var args = new string[] { "transform", "-d", openapi, "-o", "sample.json", "--co" }; var parseResult = rootCommand.Parse(args); var handler = rootCommand.Subcommands.Where(c => c.Name == "transform").First().Handler; var context = new InvocationContext(parseResult); @@ -340,7 +341,8 @@ public void InvokeTransformCommand() public void InvokeShowCommand() { var rootCommand = Program.CreateRootCommand(); - var args = new string[] { "show", "-d", ".\\UtilityFiles\\SampleOpenApi.yml", "-o", "sample.md" }; + var openapi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); + var args = new string[] { "show", "-d", openapi, "-o", "sample.md" }; var parseResult = rootCommand.Parse(args); var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler; var context = new InvocationContext(parseResult); @@ -355,7 +357,8 @@ public void InvokeShowCommand() public void InvokePluginCommand() { var rootCommand = Program.CreateRootCommand(); - var args = new string[] { "plugin", "-m", ".\\UtilityFiles\\exampleapimanifest.json", "--of", AppDomain.CurrentDomain.BaseDirectory }; + var manifest = Path.Combine(".", "UtilityFiles", "exampleapimanifest.json"); + var args = new string[] { "plugin", "-m", manifest, "--of", AppDomain.CurrentDomain.BaseDirectory }; var parseResult = rootCommand.Parse(args); var handler = rootCommand.Subcommands.Where(c => c.Name == "plugin").First().Handler; var context = new InvocationContext(parseResult); From 4ead8513d5cd6babcfa7291c0af234a0662f54a1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Jun 2023 21:57:18 +0000 Subject: [PATCH 325/752] Bump Microsoft.NET.Test.Sdk from 17.6.2 to 17.6.3 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.6.2 to 17.6.3. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.6.2...v17.6.3) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 87fade6cd..deae3d05b 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -1,4 +1,4 @@ - + net7.0 @@ -13,7 +13,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + From 13ec70ad95f8b0aca1323fecb8d5c5989ff5842a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Jul 2023 21:18:02 +0000 Subject: [PATCH 326/752] Bump xunit from 2.4.2 to 2.5.0 Bumps [xunit](https://github.com/xunit/xunit) from 2.4.2 to 2.5.0. - [Commits](https://github.com/xunit/xunit/compare/2.4.2...2.5.0) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index deae3d05b..c65467a92 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From f1788965380f9abcf450336c9a8b9e5e577f30bd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 8 Jul 2023 01:17:00 +0000 Subject: [PATCH 327/752] Bump xunit.runner.visualstudio from 2.4.5 to 2.5.0 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.4.5 to 2.5.0. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/v2.4.5...2.5.0) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index c65467a92..baeed8767 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -16,7 +16,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 5f115a51e1a4cb2835ac9f514c09e96fd8dae66b Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 18 Jul 2023 13:06:54 +0200 Subject: [PATCH 328/752] Rename Schema31 to Schema --- .../UtilityFiles/OpenApiDocumentMock.cs | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index dd175f04e..860d2eaf8 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -84,7 +84,7 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema31 = new JsonSchemaBuilder().Type(SchemaValueType.String) + Schema = new JsonSchemaBuilder().Type(SchemaValueType.String) } } }, @@ -100,7 +100,7 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema31 = new JsonSchemaBuilder().Type(SchemaValueType.Array) + Schema = new JsonSchemaBuilder().Type(SchemaValueType.Array) } } } @@ -118,7 +118,7 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema31 = new JsonSchemaBuilder().Type(SchemaValueType.String) + Schema = new JsonSchemaBuilder().Type(SchemaValueType.String) } } } @@ -149,7 +149,7 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema31 = new JsonSchemaBuilder().Type(SchemaValueType.String) + Schema = new JsonSchemaBuilder().Type(SchemaValueType.String) } } }, @@ -165,7 +165,7 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema31 = new JsonSchemaBuilder().Type(SchemaValueType.Array) + Schema = new JsonSchemaBuilder().Type(SchemaValueType.Array) } } } @@ -182,7 +182,7 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema31 = new JsonSchemaBuilder().Type(SchemaValueType.String) + Schema = new JsonSchemaBuilder().Type(SchemaValueType.String) } } }, @@ -216,7 +216,7 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema31 = new JsonSchemaBuilder() + Schema = new JsonSchemaBuilder() .Title("Collection of user") .Type(SchemaValueType.Object) .Properties(("value", @@ -267,7 +267,7 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema31 = new JsonSchemaBuilder().Ref("microsoft.graph.user").Build() + Schema = new JsonSchemaBuilder().Ref("microsoft.graph.user").Build() } } } @@ -330,7 +330,7 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Query, Required = true, Description = "Select properties to be returned", - Schema31 = new JsonSchemaBuilder().Type(SchemaValueType.Array).Build() + Schema = new JsonSchemaBuilder().Type(SchemaValueType.Array).Build() // missing explode parameter } }, @@ -346,7 +346,7 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema31 = new JsonSchemaBuilder().Ref("microsoft.graph.message").Build() + Schema = new JsonSchemaBuilder().Ref("microsoft.graph.message").Build() } } } @@ -384,7 +384,7 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Required = true, Description = "key: id of administrativeUnit", - Schema31 = new JsonSchemaBuilder().Type(SchemaValueType.String).Build() + Schema = new JsonSchemaBuilder().Type(SchemaValueType.String).Build() } } }, @@ -400,7 +400,7 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema31 = new JsonSchemaBuilder() + Schema = new JsonSchemaBuilder() .AnyOf( new JsonSchemaBuilder() .Type(SchemaValueType.String) @@ -477,7 +477,7 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema31 = new JsonSchemaBuilder() + Schema = new JsonSchemaBuilder() .Title("Collection of hostSecurityProfile") .Type(SchemaValueType.Object) .Properties(("value1", @@ -522,7 +522,7 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Description = "key: id of call", Required = true, - Schema31 = new JsonSchemaBuilder().Type(SchemaValueType.String).Build(), + Schema = new JsonSchemaBuilder().Type(SchemaValueType.String).Build(), Extensions = new Dictionary { { @@ -574,7 +574,7 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Description = "key: id of group", Required = true, - Schema31 = new JsonSchemaBuilder().Type(SchemaValueType.String).Build(), + Schema = new JsonSchemaBuilder().Type(SchemaValueType.String).Build(), Extensions = new Dictionary { { "x-ms-docs-key-type", new OpenApiAny("group") } } }, new OpenApiParameter() @@ -583,7 +583,7 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Description = "key: id of event", Required = true, - Schema31 = new JsonSchemaBuilder().Type(SchemaValueType.String).Build(), + Schema = new JsonSchemaBuilder().Type(SchemaValueType.String).Build(), Extensions = new Dictionary { { "x-ms-docs-key-type", new OpenApiAny("event") } } } }, @@ -599,7 +599,7 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema31 = new JsonSchemaBuilder().Type(SchemaValueType.Array).Ref("microsoft.graph.event").Build() + Schema = new JsonSchemaBuilder().Type(SchemaValueType.Array).Ref("microsoft.graph.event").Build() } } } @@ -639,7 +639,7 @@ public static OpenApiDocument CreateOpenApiDocument() }, Components = new OpenApiComponents { - Schemas31 = new Dictionary + Schemas = new Dictionary { { "microsoft.graph.networkInterface", new JsonSchemaBuilder() From ceff33e7d2dce476ffcdded2b9dad088874ffd9e Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Fri, 21 Jul 2023 09:53:04 +0200 Subject: [PATCH 329/752] Bump lib versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 3a5ff6880..d595f961b 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.2.5 + 1.2.6 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From 4a5932b6d1819382fd8eae770742640cb77b37e7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Aug 2023 21:05:58 +0000 Subject: [PATCH 330/752] Bump Microsoft.NET.Test.Sdk from 17.6.3 to 17.7.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.6.3 to 17.7.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.6.3...v17.7.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index baeed8767..c32c062b1 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -13,7 +13,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + From 74fbcc4fc501980eab1c615b0cf4e2237e8c2d79 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Aug 2023 21:30:21 +0000 Subject: [PATCH 331/752] Bump Moq from 4.18.4 to 4.20.1 Bumps [Moq](https://github.com/moq/moq) from 4.18.4 to 4.20.1. - [Release notes](https://github.com/moq/moq/releases) - [Changelog](https://github.com/moq/moq/blob/main/CHANGELOG.md) - [Commits](https://github.com/moq/moq/compare/v4.18.4...v4.20.1) --- updated-dependencies: - dependency-name: Moq dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index c32c062b1..cd5f77b4b 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ all - + runtime; build; native; contentfiles; analyzers; buildtransitive From ad14292f83d442501547ac889a574b4aab623b25 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Aug 2023 21:39:59 +0000 Subject: [PATCH 332/752] Bump Moq from 4.20.1 to 4.20.2 Bumps [Moq](https://github.com/moq/moq) from 4.20.1 to 4.20.2. - [Release notes](https://github.com/moq/moq/releases) - [Changelog](https://github.com/moq/moq/blob/main/CHANGELOG.md) - [Commits](https://github.com/moq/moq/compare/v4.20.1...v4.20.2) --- updated-dependencies: - dependency-name: Moq dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index cd5f77b4b..7950e42f1 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ all - + runtime; build; native; contentfiles; analyzers; buildtransitive From b996e65e3f5b5acb5e14a45a35fb42ce055695c3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 11 Aug 2023 21:05:52 +0000 Subject: [PATCH 333/752] Bump Moq from 4.20.2 to 4.20.69 Bumps [Moq](https://github.com/moq/moq) from 4.20.2 to 4.20.69. - [Release notes](https://github.com/moq/moq/releases) - [Changelog](https://github.com/moq/moq/blob/main/CHANGELOG.md) - [Commits](https://github.com/moq/moq/compare/v4.20.2...v4.20.69) --- updated-dependencies: - dependency-name: Moq dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 7950e42f1..584942b15 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ all - + runtime; build; native; contentfiles; analyzers; buildtransitive From 13f363870521a3896ed99e00e459b388ab578ad3 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 16 Aug 2023 12:46:27 +0300 Subject: [PATCH 334/752] More code cleanup --- .../UtilityFiles/OpenApiDocumentMock.cs | 52 +++++++++---------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 860d2eaf8..7ff07be0a 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -217,16 +217,16 @@ public static OpenApiDocument CreateOpenApiDocument() new OpenApiMediaType { Schema = new JsonSchemaBuilder() - .Title("Collection of user") - .Type(SchemaValueType.Object) - .Properties(("value", - new JsonSchemaBuilder() - .Type(SchemaValueType.Array) - .Items(new JsonSchemaBuilder() - .Ref("microsoft.graph.user") - .Build()) - .Build())) - .Build() + .Title("Collection of user") + .Type(SchemaValueType.Object) + .Properties(("value", + new JsonSchemaBuilder() + .Type(SchemaValueType.Array) + .Items(new JsonSchemaBuilder() + .Ref("microsoft.graph.user") + .Build()) + .Build())) + .Build() } } } @@ -401,11 +401,11 @@ public static OpenApiDocument CreateOpenApiDocument() new OpenApiMediaType { Schema = new JsonSchemaBuilder() - .AnyOf( - new JsonSchemaBuilder() - .Type(SchemaValueType.String) - .Build()) - .Build() + .AnyOf( + new JsonSchemaBuilder() + .Type(SchemaValueType.String) + .Build()) + .Build() } } } @@ -478,14 +478,13 @@ public static OpenApiDocument CreateOpenApiDocument() new OpenApiMediaType { Schema = new JsonSchemaBuilder() - .Title("Collection of hostSecurityProfile") - .Type(SchemaValueType.Object) - .Properties(("value1", - new JsonSchemaBuilder() - .Type(SchemaValueType.Array) - .Items(new JsonSchemaBuilder().Ref("microsoft.graph.networkInterface").Build()) - .Build())) - .Build() + .Title("Collection of hostSecurityProfile") + .Type(SchemaValueType.Object) + .Properties(("value1", + new JsonSchemaBuilder() + .Type(SchemaValueType.Array) + .Items(new JsonSchemaBuilder().Ref("microsoft.graph.networkInterface")))) + .Build() } } } @@ -645,9 +644,10 @@ public static OpenApiDocument CreateOpenApiDocument() "microsoft.graph.networkInterface", new JsonSchemaBuilder() .Title("networkInterface") .Type(SchemaValueType.Object) - .Properties(("description", new JsonSchemaBuilder() - .Type(SchemaValueType.String) - .Description("Description of the NIC (e.g. Ethernet adapter, Wireless LAN adapter Local Area Connection <#>, etc.).").Build())) + .Properties( + ("description", new JsonSchemaBuilder() + .Type(SchemaValueType.String) + .Description("Description of the NIC (e.g. Ethernet adapter, Wireless LAN adapter Local Area Connection <#>, etc.)."))) .Build() } } From 5f5b2366599d0f42c857a81dfe64bccd1bf4717d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Aug 2023 21:22:10 +0000 Subject: [PATCH 335/752] Bump Microsoft.NET.Test.Sdk from 17.7.0 to 17.7.1 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.7.0 to 17.7.1. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.7.0...v17.7.1) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 584942b15..baa54313b 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -13,7 +13,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + From 3d2542fef0be862f3d34e3d63bdf5ec4027b30e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 21:19:42 +0000 Subject: [PATCH 336/752] Bump Microsoft.NET.Test.Sdk from 17.7.1 to 17.7.2 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.7.1 to 17.7.2. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.7.1...v17.7.2) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index baa54313b..ebe55934f 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -13,7 +13,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + From d7206fe56df196aca159515ab7fc9a3821384c8e Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Thu, 31 Aug 2023 23:25:22 +0300 Subject: [PATCH 337/752] Bump up lib versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index d595f961b..294219e5f 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.2.6 + 1.2.7 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From 7a5f667f28287ef312b47ac05d64643dcbe3c321 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Fri, 1 Sep 2023 17:10:22 +0300 Subject: [PATCH 338/752] Bump hidi version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 294219e5f..dd617aef8 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.2.7 + 1.2.8 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET @@ -44,7 +44,7 @@ - + From 7754f5bfc5acf608df82cc53b8a6471ba0b87340 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Sep 2023 21:56:31 +0000 Subject: [PATCH 339/752] Bump Microsoft.OpenApi.OData from 1.5.0-preview3 to 1.5.0-preview4 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.5.0-preview3 to 1.5.0-preview4. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index dd617aef8..b61c2e437 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -44,7 +44,7 @@ - + From a80e372d32efe79915d2d89b8822bc09d387d875 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 6 Sep 2023 14:06:42 -0400 Subject: [PATCH 340/752] - bumps patch for microsoft extensions Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b61c2e437..25dfeb57d 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.2.8 + 1.2.9 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From d1194c0fe630f809cbb1ea4f25d4a2ccf0a97f09 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 6 Sep 2023 21:51:40 +0000 Subject: [PATCH 341/752] Bump Microsoft.OData.Edm from 7.17.0 to 7.18.0 Bumps Microsoft.OData.Edm from 7.17.0 to 7.18.0. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b61c2e437..cca01bd04 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -43,7 +43,7 @@ - + From 9623afed695bc9d6b341b2a6c829149f576929a3 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Tue, 12 Sep 2023 15:37:24 +0300 Subject: [PATCH 342/752] Pass JsonSchema by reference So that changes can be bubbled up --- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index e76911100..5c995d8fa 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -20,7 +20,7 @@ public override void Visit(OpenApiParameter parameter) public int SchemaCount { get; set; } = 0; - public override void Visit(JsonSchema schema) + public override void Visit(ref JsonSchema schema) { SchemaCount++; } From 21eef085ab9eff4c977f5c127378e2772ff40182 Mon Sep 17 00:00:00 2001 From: waldekmastykarz Date: Thu, 14 Sep 2023 16:36:38 +0200 Subject: [PATCH 343/752] Fixes null reference exception. Closes #1342 --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 78f48cd4c..9797ecd65 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -151,7 +151,7 @@ private static OpenApiDocument ApplyFilters(HidiOptions options, ILogger logger, } else if (postmanCollection != null) { - requestUrls = EnumerateJsonDocument(postmanCollection.RootElement, requestUrls); + requestUrls = EnumerateJsonDocument(postmanCollection.RootElement, new()); logger.LogTrace("Finished fetching the list of paths and Http methods defined in the Postman collection."); } From 320659513e88caadbc5af7dce0390ffc10b699e0 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 14 Sep 2023 15:25:53 -0400 Subject: [PATCH 344/752] - enables NRT for main hidi project --- .../Extensions/OpenApiExtensibleExtensions.cs | 4 +- .../Extensions/StringExtensions.cs | 9 +- .../Formatters/PowerShellFormatter.cs | 6 +- .../Handlers/PluginCommandHandler.cs | 3 +- .../Handlers/ShowCommandHandler.cs | 3 +- .../Handlers/TransformCommandHandler.cs | 3 +- .../Handlers/ValidateCommandHandler.cs | 4 +- .../Microsoft.OpenApi.Hidi.csproj | 11 ++- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 94 ++++++++++--------- .../Options/FilterOptions.cs | 8 +- .../Options/HidiOptions.cs | 23 ++--- .../Utilities/SettingsUtilities.cs | 7 +- .../Services/OpenApiFilterServiceTests.cs | 2 +- .../Services/OpenApiServiceTests.cs | 16 ++-- 14 files changed, 111 insertions(+), 82 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs index 194d122b8..faf03c3f0 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs @@ -12,13 +12,13 @@ internal static class OpenApiExtensibleExtensions /// A dictionary of . /// The key corresponding to the . /// A value matching the provided extensionKey. Return null when extensionKey is not found. - public static string GetExtension(this IDictionary extensions, string extensionKey) + internal static string GetExtension(this IDictionary extensions, string extensionKey) { if (extensions.TryGetValue(extensionKey, out var value) && value is OpenApiString castValue) { return castValue.Value; } - return default; + return string.Empty; } } } diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs index e5c4b81c4..99208a1d4 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs @@ -12,13 +12,16 @@ internal static class StringExtensions /// /// Checks if the specified searchValue is equal to the target string based on the specified . /// - /// The target string to commpare to. + /// The target string to compare to. /// The search string to seek. /// The to use. This defaults to . /// true if the searchValue parameter occurs within this string; otherwise, false. - public static bool IsEquals(this string target, string searchValue, StringComparison comparison = StringComparison.OrdinalIgnoreCase) + public static bool IsEquals(this string? target, string? searchValue, StringComparison comparison = StringComparison.OrdinalIgnoreCase) { - if (string.IsNullOrWhiteSpace(target) || string.IsNullOrWhiteSpace(searchValue)) + if (string.IsNullOrWhiteSpace(target) && string.IsNullOrWhiteSpace(searchValue)) + { + return true; + } else if (string.IsNullOrWhiteSpace(target)) { return false; } diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index 02a2e1947..f876e4008 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -191,9 +191,8 @@ private void AddAdditionalPropertiesToSchema(OpenApiSchema schema) private static void ResolveOneOfSchema(OpenApiSchema schema) { - if (schema.OneOf?.Any() ?? false) + if (schema.OneOf?.FirstOrDefault() is {} newSchema) { - var newSchema = schema.OneOf.FirstOrDefault(); schema.OneOf = null; FlattenSchema(schema, newSchema); } @@ -201,9 +200,8 @@ private static void ResolveOneOfSchema(OpenApiSchema schema) private static void ResolveAnyOfSchema(OpenApiSchema schema) { - if (schema.AnyOf?.Any() ?? false) + if (schema.AnyOf?.FirstOrDefault() is {} newSchema) { - var newSchema = schema.AnyOf.FirstOrDefault(); schema.AnyOf = null; FlattenSchema(schema, newSchema); } diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs index aae0285f0..ae090207c 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs @@ -5,6 +5,7 @@ using System.CommandLine.Invocation; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Hidi.Options; @@ -24,7 +25,7 @@ public int Invoke(InvocationContext context) public async Task InvokeAsync(InvocationContext context) { HidiOptions hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); - CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetService(typeof(CancellationToken)); + CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); using var loggerFactory = Logger.ConfigureLogger(hidiOptions.LogLevel); var logger = loggerFactory.CreateLogger(); diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs index eea087e36..7db17fea9 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs @@ -5,6 +5,7 @@ using System.CommandLine.Invocation; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Hidi.Options; @@ -24,7 +25,7 @@ public int Invoke(InvocationContext context) public async Task InvokeAsync(InvocationContext context) { HidiOptions hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); - CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetService(typeof(CancellationToken)); + CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); using var loggerFactory = Logger.ConfigureLogger(hidiOptions.LogLevel); var logger = loggerFactory.CreateLogger(); diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs index 85e9c05f6..440c20e0b 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs @@ -5,6 +5,7 @@ using System.CommandLine.Invocation; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Hidi.Options; @@ -24,7 +25,7 @@ public int Invoke(InvocationContext context) public async Task InvokeAsync(InvocationContext context) { HidiOptions hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); - CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetService(typeof(CancellationToken)); + CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); using var loggerFactory = Logger.ConfigureLogger(hidiOptions.LogLevel); var logger = loggerFactory.CreateLogger(); diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs index 29e0a9518..8bb5676bc 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs @@ -5,6 +5,7 @@ using System.CommandLine.Invocation; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Hidi.Options; @@ -26,11 +27,12 @@ public int Invoke(InvocationContext context) public async Task InvokeAsync(InvocationContext context) { HidiOptions hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); - CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetService(typeof(CancellationToken)); + CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); using var loggerFactory = Logger.ConfigureLogger(hidiOptions.LogLevel); var logger = loggerFactory.CreateLogger(); try { + if (hidiOptions.OpenApi is null) throw new InvalidOperationException("OpenApi file is required"); await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken); return 0; } diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index fd0d9325e..7e8c8937c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -3,8 +3,10 @@ Exe net7.0 - 9.0 + latest + true true + enable http://go.microsoft.com/fwlink/?LinkID=288890 https://github.com/Microsoft/OpenAPI.NET MIT @@ -26,6 +28,9 @@ true true + NU5048 + true + readme.md @@ -62,4 +67,8 @@ + + + + diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 9797ecd65..71a0ff2f7 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -23,6 +23,7 @@ using Microsoft.OpenApi.ApiManifest; using Microsoft.OpenApi.ApiManifest.OpenAI; using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Hidi.Extensions; using Microsoft.OpenApi.Hidi.Formatters; using Microsoft.OpenApi.Hidi.Options; using Microsoft.OpenApi.Hidi.Utilities; @@ -69,20 +70,18 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l OpenApiSpecVersion openApiVersion = options.Version != null ? TryParseOpenApiSpecVersion(options.Version) : OpenApiSpecVersion.OpenApi3_0; // If ApiManifest is provided, set the referenced OpenAPI document - var apiDependency = await FindApiDependency(options.FilterOptions?.FilterByApiManifest, logger, cancellationToken); + var apiDependency = await FindApiDependency(options.FilterOptions.FilterByApiManifest, logger, cancellationToken); if (apiDependency != null) { options.OpenApi = apiDependency.ApiDescripionUrl; } // If Postman Collection is provided, load it - JsonDocument postmanCollection = null; - if (!String.IsNullOrEmpty(options.FilterOptions?.FilterByCollection)) + JsonDocument? postmanCollection = null; + if (!string.IsNullOrEmpty(options.FilterOptions?.FilterByCollection)) { - using (var collectionStream = await GetStream(options.FilterOptions.FilterByCollection, logger, cancellationToken)) - { - postmanCollection = JsonDocument.Parse(collectionStream); - } + using var collectionStream = await GetStream(options.FilterOptions.FilterByCollection, logger, cancellationToken); + postmanCollection = JsonDocument.Parse(collectionStream); } // Load OpenAPI document @@ -94,7 +93,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l } var languageFormat = options.SettingsConfig?.GetSection("LanguageFormat")?.Value; - if (Extensions.StringExtensions.IsEquals(languageFormat, "PowerShell")) + if ("PowerShell".IsEquals(languageFormat)) { // PowerShell Walker. var powerShellFormatter = new PowerShellFormatter(); @@ -117,16 +116,16 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l } } - private static async Task FindApiDependency(string apiManifestPath, ILogger logger, CancellationToken cancellationToken) + private static async Task FindApiDependency(string? apiManifestPath, ILogger logger, CancellationToken cancellationToken) { - ApiDependency apiDependency = null; + ApiDependency? apiDependency = null; // If API Manifest is provided, load it, use it get the OpenAPI path - ApiManifestDocument apiManifest = null; + ApiManifestDocument? apiManifest = null; if (!string.IsNullOrEmpty(apiManifestPath)) { // Extract fragment identifier if passed as the name of the ApiDependency var apiManifestRef = apiManifestPath.Split('#'); - string apiDependencyName = null; + var apiDependencyName = string.Empty; if (apiManifestRef.Length > 1) { apiDependencyName = apiManifestRef[1]; @@ -136,15 +135,15 @@ private static async Task FindApiDependency(string apiManifestPat apiManifest = ApiManifestDocument.Load(JsonDocument.Parse(fileStream).RootElement); } - apiDependency = apiDependencyName != null ? apiManifest.ApiDependencies[apiDependencyName] : apiManifest.ApiDependencies.First().Value; + apiDependency = !string.IsNullOrEmpty(apiDependencyName) && apiManifest.ApiDependencies.TryGetValue(apiDependencyName, out var dependency) ? dependency : apiManifest.ApiDependencies.First().Value; } return apiDependency; } - private static OpenApiDocument ApplyFilters(HidiOptions options, ILogger logger, ApiDependency apiDependency, JsonDocument postmanCollection, OpenApiDocument document) + private static OpenApiDocument ApplyFilters(HidiOptions options, ILogger logger, ApiDependency? apiDependency, JsonDocument? postmanCollection, OpenApiDocument document) { - Dictionary> requestUrls = null; + Dictionary> requestUrls; if (apiDependency != null) { requestUrls = GetRequestUrlsFromManifest(apiDependency); @@ -154,6 +153,11 @@ private static OpenApiDocument ApplyFilters(HidiOptions options, ILogger logger, requestUrls = EnumerateJsonDocument(postmanCollection.RootElement, new()); logger.LogTrace("Finished fetching the list of paths and Http methods defined in the Postman collection."); } + else + { + requestUrls = new(); + logger.LogTrace("No filter options provided."); + } logger.LogTrace("Creating predicate from filter options."); var predicate = FilterOpenApiDocument(options.FilterOptions.FilterByOperationIds, @@ -177,6 +181,7 @@ private static void WriteOpenApi(HidiOptions options, OpenApiFormat openApiForma { using (logger.BeginScope("Output")) { + if (options.Output is null) throw new InvalidOperationException("Output file path is null"); using var outputStream = options.Output.Create(); var textWriter = new StreamWriter(outputStream); @@ -206,7 +211,7 @@ private static void WriteOpenApi(HidiOptions options, OpenApiFormat openApiForma } // Get OpenAPI document either from OpenAPI or CSDL - private static async Task GetOpenApi(HidiOptions options, ILogger logger, CancellationToken cancellationToken, string metadataVersion = null) + private static async Task GetOpenApi(HidiOptions options, ILogger logger, CancellationToken cancellationToken, string? metadataVersion = null) { OpenApiDocument document; @@ -219,14 +224,13 @@ private static async Task GetOpenApi(HidiOptions options, ILogg { stopwatch.Start(); stream = await GetStream(options.Csdl, logger, cancellationToken); - Stream filteredStream = null; + Stream? filteredStream = null; if (!string.IsNullOrEmpty(options.CsdlFilter)) { XslCompiledTransform transform = GetFilterTransform(); filteredStream = ApplyFilterToCsdl(stream, options.CsdlFilter, transform); filteredStream.Position = 0; stream.Dispose(); - stream = null; } document = await ConvertCsdlToOpenApi(filteredStream ?? stream, metadataVersion, options.SettingsConfig, cancellationToken); @@ -234,40 +238,41 @@ private static async Task GetOpenApi(HidiOptions options, ILogg logger.LogTrace("{timestamp}ms: Generated OpenAPI with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } } - else + else if (!string.IsNullOrEmpty(options.OpenApi)) { stream = await GetStream(options.OpenApi, logger, cancellationToken); var result = await ParseOpenApi(options.OpenApi, options.InlineExternal, logger, stream, cancellationToken); document = result.OpenApiDocument; } + else throw new InvalidOperationException("No input file path or URL provided"); return document; } - private static Func FilterOpenApiDocument(string filterbyoperationids, string filterbytags, Dictionary> requestUrls, OpenApiDocument document, ILogger logger) + private static Func? FilterOpenApiDocument(string? filterByOperationIds, string? filterByTags, Dictionary> requestUrls, OpenApiDocument document, ILogger logger) { - Func predicate = null; + Func? predicate = null; using (logger.BeginScope("Create Filter")) { // Check if filter options are provided, then slice the OpenAPI document - if (!string.IsNullOrEmpty(filterbyoperationids) && !string.IsNullOrEmpty(filterbytags)) + if (!string.IsNullOrEmpty(filterByOperationIds) && !string.IsNullOrEmpty(filterByTags)) { throw new InvalidOperationException("Cannot filter by operationIds and tags at the same time."); } - if (!string.IsNullOrEmpty(filterbyoperationids)) + if (!string.IsNullOrEmpty(filterByOperationIds)) { logger.LogTrace("Creating predicate based on the operationIds supplied."); - predicate = OpenApiFilterService.CreatePredicate(tags: filterbyoperationids); + predicate = OpenApiFilterService.CreatePredicate(tags: filterByOperationIds); } - if (!string.IsNullOrEmpty(filterbytags)) + if (!string.IsNullOrEmpty(filterByTags)) { logger.LogTrace("Creating predicate based on the tags supplied."); - predicate = OpenApiFilterService.CreatePredicate(tags: filterbytags); + predicate = OpenApiFilterService.CreatePredicate(tags: filterByTags); } - if (requestUrls != null) + if (requestUrls.Any()) { logger.LogTrace("Creating predicate based on the paths and Http methods defined in the Postman collection."); predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: document); @@ -281,13 +286,13 @@ private static Dictionary> GetRequestUrlsFromManifest(ApiDe { // Get the request URLs from the API Dependencies in the API manifest var requests = apiDependency - .Requests.Where(static r => !r.Exclude) - .Select(static r => new { UriTemplate = r.UriTemplate, Method = r.Method }) + .Requests.Where(static r => !r.Exclude && !string.IsNullOrEmpty(r.UriTemplate) && !string.IsNullOrEmpty(r.Method)) + .Select(static r => new { UriTemplate = r.UriTemplate!, Method = r.Method! }) .GroupBy(static r => r.UriTemplate) .ToDictionary(static g => g.Key, static g => g.Select(static r => r.Method).ToList()); // This makes the assumption that the UriTemplate in the ApiManifest matches exactly the UriTemplate in the OpenAPI document // This does not need to be the case. The URI template in the API manifest could map to a set of OpenAPI paths. - // Additional logic will be required to handle this scenario. I sugggest we build this into the OpenAPI.Net library at some point. + // Additional logic will be required to handle this scenario. I suggest we build this into the OpenAPI.Net library at some point. return requests; } @@ -295,7 +300,7 @@ private static XslCompiledTransform GetFilterTransform() { XslCompiledTransform transform = new(); Assembly assembly = typeof(OpenApiService).GetTypeInfo().Assembly; - Stream xslt = assembly.GetManifestResourceStream("Microsoft.OpenApi.Hidi.CsdlFilter.xslt"); + using var xslt = assembly.GetManifestResourceStream("Microsoft.OpenApi.Hidi.CsdlFilter.xslt") ?? throw new InvalidOperationException("Could not find the Microsoft.OpenApi.Hidi.CsdlFilter.xslt file in the assembly. Check build configuration."); transform.Load(new XmlTextReader(new StreamReader(xslt))); return transform; } @@ -318,20 +323,20 @@ private static Stream ApplyFilterToCsdl(Stream csdlStream, string entitySetOrSin /// Implementation of the validate command /// public static async Task ValidateOpenApiDocument( - string openapi, + string openApi, ILogger logger, CancellationToken cancellationToken) { - if (string.IsNullOrEmpty(openapi)) + if (string.IsNullOrEmpty(openApi)) { - throw new ArgumentNullException(nameof(openapi)); + throw new ArgumentNullException(nameof(openApi)); } try { - using var stream = await GetStream(openapi, logger, cancellationToken); + using var stream = await GetStream(openApi, logger, cancellationToken); - var result = await ParseOpenApi(openapi, false, logger, stream, cancellationToken); + var result = await ParseOpenApi(openApi, false, logger, stream, cancellationToken); using (logger.BeginScope("Calculating statistics")) { @@ -384,7 +389,7 @@ private static async Task ParseOpenApi(string openApiFile, bool inli /// /// The CSDL stream. /// An OpenAPI document. - public static async Task ConvertCsdlToOpenApi(Stream csdl, string metadataVersion = null, IConfiguration settings = null, CancellationToken token = default) + public static async Task ConvertCsdlToOpenApi(Stream csdl, string? metadataVersion = null, IConfiguration? settings = null, CancellationToken token = default) { using var reader = new StreamReader(csdl); var csdlText = await reader.ReadToEndAsync(token); @@ -535,9 +540,9 @@ private static OpenApiFormat GetOpenApiFormat(string input, ILogger logger) return !input.StartsWith("http") && Path.GetExtension(input) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml; } - private static string GetInputPathExtension(string openapi = null, string csdl = null) + private static string GetInputPathExtension(string? openapi = null, string? csdl = null) { - var extension = String.Empty; + var extension = string.Empty; if (!string.IsNullOrEmpty(openapi)) { extension = Path.GetExtension(openapi); @@ -550,7 +555,7 @@ private static string GetInputPathExtension(string openapi = null, string csdl = return extension; } - internal static async Task ShowOpenApiDocument(HidiOptions options, ILogger logger, CancellationToken cancellationToken) + internal static async Task ShowOpenApiDocument(HidiOptions options, ILogger logger, CancellationToken cancellationToken) { try { @@ -564,6 +569,11 @@ internal static async Task ShowOpenApiDocument(HidiOptions options, ILog using (logger.BeginScope("Creating diagram")) { // If output is null, create a HTML file in the user's temporary directory + var sourceUrl = (string.IsNullOrEmpty(options.OpenApi), string.IsNullOrEmpty(options.Csdl)) switch { + (false, _) => options.OpenApi!, + (_, false) => options.Csdl!, + _ => throw new InvalidOperationException("No input file path or URL provided") + }; if (options.Output == null) { var tempPath = Path.GetTempPath() + "/hidi/"; @@ -578,7 +588,7 @@ internal static async Task ShowOpenApiDocument(HidiOptions options, ILog using (var file = new FileStream(output.FullName, FileMode.Create)) { using var writer = new StreamWriter(file); - WriteTreeDocumentAsHtml(options.OpenApi ?? options.Csdl, document, writer); + WriteTreeDocumentAsHtml(sourceUrl, document, writer); } logger.LogTrace("Created Html document with diagram "); @@ -595,7 +605,7 @@ internal static async Task ShowOpenApiDocument(HidiOptions options, ILog using (var file = new FileStream(options.Output.FullName, FileMode.Create)) { using var writer = new StreamWriter(file); - WriteTreeDocumentAsMarkdown(options.OpenApi ?? options.Csdl, document, writer); + WriteTreeDocumentAsMarkdown(sourceUrl, document, writer); } logger.LogTrace("Created markdown document with diagram "); return options.Output.FullName; diff --git a/src/Microsoft.OpenApi.Hidi/Options/FilterOptions.cs b/src/Microsoft.OpenApi.Hidi/Options/FilterOptions.cs index ffdb568de..d82a064f7 100644 --- a/src/Microsoft.OpenApi.Hidi/Options/FilterOptions.cs +++ b/src/Microsoft.OpenApi.Hidi/Options/FilterOptions.cs @@ -5,9 +5,9 @@ namespace Microsoft.OpenApi.Hidi.Options { internal class FilterOptions { - public string FilterByOperationIds { get; internal set; } - public string FilterByTags { get; internal set; } - public string FilterByCollection { get; internal set; } - public string FilterByApiManifest { get; internal set; } + public string? FilterByOperationIds { get; internal set; } + public string? FilterByTags { get; internal set; } + public string? FilterByCollection { get; internal set; } + public string? FilterByApiManifest { get; internal set; } } } diff --git a/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs b/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs index a7f16d872..9f5a109f7 100644 --- a/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs +++ b/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs @@ -11,21 +11,22 @@ namespace Microsoft.OpenApi.Hidi.Options { internal class HidiOptions { - public string OpenApi { get; set; } - public string Csdl { get; set; } - public string CsdlFilter { get; set; } - public FileInfo Output { get; set; } - public string OutputFolder { get; set; } + private const string defaultOutputFolderValue = "./"; + public string? OpenApi { get; set; } + public string? Csdl { get; set; } + public string? CsdlFilter { get; set; } + public FileInfo? Output { get; set; } + public string OutputFolder { get; set; } = defaultOutputFolderValue; public bool CleanOutput { get; set; } - public string Version { get; set; } - public string MetadataVersion { get; set; } + public string? Version { get; set; } + public string? MetadataVersion { get; set; } public OpenApiFormat? OpenApiFormat { get; set; } public bool TerseOutput { get; set; } - public IConfiguration SettingsConfig { get; set; } + public IConfiguration? SettingsConfig { get; set; } public LogLevel LogLevel { get; set; } public bool InlineLocal { get; set; } public bool InlineExternal { get; set; } - public FilterOptions FilterOptions { get; set; } + public FilterOptions FilterOptions { get; set; } = new(); public HidiOptions(ParseResult parseResult, CommandOptions options) { @@ -43,13 +44,13 @@ private void ParseHidiOptions(ParseResult parseResult, CommandOptions options) CsdlFilter = parseResult.GetValueForOption(options.CsdlFilterOption); Csdl = parseResult.GetValueForOption(options.CsdlOption); Output = parseResult.GetValueForOption(options.OutputOption); - OutputFolder = parseResult.GetValueForOption(options.OutputFolderOption); + OutputFolder = parseResult.GetValueForOption(options.OutputFolderOption) is string outputFolderOptionValue && !string.IsNullOrEmpty(outputFolderOptionValue) ? outputFolderOptionValue : defaultOutputFolderValue; CleanOutput = parseResult.GetValueForOption(options.CleanOutputOption); Version = parseResult.GetValueForOption(options.VersionOption); MetadataVersion = parseResult.GetValueForOption(options.MetadataVersionOption); OpenApiFormat = parseResult.GetValueForOption(options.FormatOption); TerseOutput = parseResult.GetValueForOption(options.TerseOutputOption); - SettingsConfig = SettingsUtilities.GetConfiguration(parseResult.GetValueForOption(options.SettingsFileOption)); + SettingsConfig = parseResult.GetValueForOption(options.SettingsFileOption) is string configOptionValue && !string.IsNullOrEmpty(configOptionValue) ? SettingsUtilities.GetConfiguration(configOptionValue) : null; LogLevel = parseResult.GetValueForOption(options.LogLevelOption); InlineLocal = parseResult.GetValueForOption(options.InlineLocalOption); InlineExternal = parseResult.GetValueForOption(options.InlineExternalOption); diff --git a/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs b/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs index 6e00e2ba3..1d261e5f3 100644 --- a/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs +++ b/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs @@ -8,9 +8,10 @@ namespace Microsoft.OpenApi.Hidi.Utilities { internal static class SettingsUtilities { - internal static IConfiguration GetConfiguration(string settingsFile = null) + internal static IConfiguration GetConfiguration(string? settingsFile = null) { - settingsFile ??= "appsettings.json"; + if (string.IsNullOrEmpty(settingsFile)) + settingsFile = "appsettings.json"; IConfiguration config = new ConfigurationBuilder() .AddJsonFile(settingsFile, true) @@ -19,7 +20,7 @@ internal static IConfiguration GetConfiguration(string settingsFile = null) return config; } - internal static OpenApiConvertSettings GetOpenApiConvertSettings(IConfiguration config, string metadataVersion = null) + internal static OpenApiConvertSettings GetOpenApiConvertSettings(IConfiguration config, string? metadataVersion = null) { if (config == null) { throw new System.ArgumentNullException(nameof(config)); } var settings = new OpenApiConvertSettings(); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 3c039b9aa..34cdd3a0a 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -183,7 +183,7 @@ public void ReturnsPathParametersOnSlicingBasedOnOperationIdsOrTags(string opera foreach (var pathItem in subsetOpenApiDocument.Paths) { Assert.True(pathItem.Value.Parameters.Any()); - Assert.Equal(1, pathItem.Value.Parameters.Count); + Assert.Single(pathItem.Value.Parameters); } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 49f1bbd96..647cac321 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -228,7 +228,7 @@ public async Task TransformCommandConvertsOpenApi() [Fact] - public async Task TransformCommandConvertsOpenApiWithDefaultOutputname() + public async Task TransformCommandConvertsOpenApiWithDefaultOutputName() { HidiOptions options = new HidiOptions { @@ -246,7 +246,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputname() } [Fact] - public async Task TransformCommandConvertsCsdlWithDefaultOutputname() + public async Task TransformCommandConvertsCsdlWithDefaultOutputName() { HidiOptions options = new HidiOptions { @@ -264,7 +264,7 @@ public async Task TransformCommandConvertsCsdlWithDefaultOutputname() } [Fact] - public async Task TransformCommandConvertsOpenApiWithDefaultOutputnameAndSwitchFormat() + public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchFormat() { HidiOptions options = new HidiOptions { @@ -367,10 +367,12 @@ public void InvokePluginCommand() using var jsDoc = JsonDocument.Parse(File.ReadAllText("ai-plugin.json")); var openAiManifest = OpenAIPluginManifest.Load(jsDoc.RootElement); - - Assert.Equal("Mastodon - Subset", openAiManifest?.NameForHuman); - Assert.Equal("openapi", openAiManifest?.Api.Type); - Assert.Equal("./openapi.json", openAiManifest?.Api.Url); + + Assert.NotNull(openAiManifest); + Assert.Equal("Mastodon - Subset", openAiManifest.NameForHuman); + Assert.NotNull(openAiManifest.Api); + Assert.Equal("openapi", openAiManifest.Api.Type); + Assert.Equal("./openapi.json", openAiManifest.Api.Url); } From f4511cac6e0a0c368db01f5171f51b58e4c346da Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 14 Sep 2023 16:00:22 -0400 Subject: [PATCH 345/752] - enables all mode analysis Signed-off-by: Vincent Biret --- .../Formatters/PowerShellFormatter.cs | 4 +- .../Handlers/PluginCommandHandler.cs | 2 +- .../Handlers/ShowCommandHandler.cs | 2 +- .../Handlers/TransformCommandHandler.cs | 2 +- .../Handlers/ValidateCommandHandler.cs | 2 +- src/Microsoft.OpenApi.Hidi/Logger.cs | 2 +- .../Microsoft.OpenApi.Hidi.csproj | 3 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 88 +++++++++---------- src/Microsoft.OpenApi.Hidi/Program.cs | 2 +- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 18 ++-- .../Microsoft.OpenApi.Hidi.Tests.csproj | 3 + .../Services/OpenApiServiceTests.cs | 24 +++-- 12 files changed, 80 insertions(+), 72 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index f876e4008..450a05d21 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -88,7 +88,7 @@ public override void Visit(OpenApiOperation operation) private static string ResolveVerbSegmentInOpertationId(string operationId) { var charPos = operationId.LastIndexOf('.', operationId.Length - 1); - if (operationId.Contains('_') || charPos < 0) + if (operationId.Contains('_', StringComparison.OrdinalIgnoreCase) || charPos < 0) return operationId; var newOperationId = new StringBuilder(operationId); newOperationId[charPos] = '_'; @@ -99,7 +99,7 @@ private static string ResolveVerbSegmentInOpertationId(string operationId) private static string ResolvePutOperationId(string operationId) { return operationId.Contains(DefaultPutPrefix, StringComparison.OrdinalIgnoreCase) ? - operationId.Replace(DefaultPutPrefix, PowerShellPutPrefix) : operationId; + operationId.Replace(DefaultPutPrefix, PowerShellPutPrefix, StringComparison.Ordinal) : operationId; } private static string ResolveByRefOperationId(string operationId) diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs index ae090207c..0fcb86df2 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs @@ -31,7 +31,7 @@ public async Task InvokeAsync(InvocationContext context) var logger = loggerFactory.CreateLogger(); try { - await OpenApiService.PluginManifest(hidiOptions, logger, cancellationToken); + await OpenApiService.PluginManifest(hidiOptions, logger, cancellationToken).ConfigureAwait(false); return 0; } diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs index 7db17fea9..a6a161dc2 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs @@ -31,7 +31,7 @@ public async Task InvokeAsync(InvocationContext context) var logger = loggerFactory.CreateLogger(); try { - await OpenApiService.ShowOpenApiDocument(hidiOptions, logger, cancellationToken); + await OpenApiService.ShowOpenApiDocument(hidiOptions, logger, cancellationToken).ConfigureAwait(false); return 0; } diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs index 440c20e0b..f173024cc 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs @@ -31,7 +31,7 @@ public async Task InvokeAsync(InvocationContext context) var logger = loggerFactory.CreateLogger(); try { - await OpenApiService.TransformOpenApiDocument(hidiOptions, logger, cancellationToken); + await OpenApiService.TransformOpenApiDocument(hidiOptions, logger, cancellationToken).ConfigureAwait(false); return 0; } diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs index 8bb5676bc..153ec707e 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs @@ -33,7 +33,7 @@ public async Task InvokeAsync(InvocationContext context) try { if (hidiOptions.OpenApi is null) throw new InvalidOperationException("OpenApi file is required"); - await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken); + await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false); return 0; } catch (Exception ex) diff --git a/src/Microsoft.OpenApi.Hidi/Logger.cs b/src/Microsoft.OpenApi.Hidi/Logger.cs index 2b02e9600..717ca1a41 100644 --- a/src/Microsoft.OpenApi.Hidi/Logger.cs +++ b/src/Microsoft.OpenApi.Hidi/Logger.cs @@ -5,7 +5,7 @@ namespace Microsoft.OpenApi.Hidi { - public class Logger + public static class Logger { public static ILoggerFactory ConfigureLogger(LogLevel logLevel) { diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7e8c8937c..b02f89003 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -28,9 +28,10 @@ true true - NU5048 + NU5048;CA1848; true readme.md + All diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 71a0ff2f7..809e3ecf9 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -70,7 +70,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l OpenApiSpecVersion openApiVersion = options.Version != null ? TryParseOpenApiSpecVersion(options.Version) : OpenApiSpecVersion.OpenApi3_0; // If ApiManifest is provided, set the referenced OpenAPI document - var apiDependency = await FindApiDependency(options.FilterOptions.FilterByApiManifest, logger, cancellationToken); + var apiDependency = await FindApiDependency(options.FilterOptions.FilterByApiManifest, logger, cancellationToken).ConfigureAwait(false); if (apiDependency != null) { options.OpenApi = apiDependency.ApiDescripionUrl; @@ -80,12 +80,12 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l JsonDocument? postmanCollection = null; if (!string.IsNullOrEmpty(options.FilterOptions?.FilterByCollection)) { - using var collectionStream = await GetStream(options.FilterOptions.FilterByCollection, logger, cancellationToken); + using var collectionStream = await GetStream(options.FilterOptions.FilterByCollection, logger, cancellationToken).ConfigureAwait(false); postmanCollection = JsonDocument.Parse(collectionStream); } // Load OpenAPI document - OpenApiDocument document = await GetOpenApi(options, logger, cancellationToken, options.MetadataVersion); + OpenApiDocument document = await GetOpenApi(options, logger, cancellationToken, options.MetadataVersion).ConfigureAwait(false); if (options.FilterOptions != null) { @@ -104,7 +104,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l } catch (TaskCanceledException) { - Console.Error.WriteLine("CTRL+C pressed, aborting the operation."); + await Console.Error.WriteLineAsync("CTRL+C pressed, aborting the operation.").ConfigureAwait(false); } catch (IOException) { @@ -130,7 +130,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l { apiDependencyName = apiManifestRef[1]; } - using (var fileStream = await GetStream(apiManifestRef[0], logger, cancellationToken)) + using (var fileStream = await GetStream(apiManifestRef[0], logger, cancellationToken).ConfigureAwait(false)) { apiManifest = ApiManifestDocument.Load(JsonDocument.Parse(fileStream).RootElement); } @@ -171,7 +171,7 @@ private static OpenApiDocument ApplyFilters(HidiOptions options, ILogger logger, stopwatch.Start(); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); stopwatch.Stop(); - logger.LogTrace("{timestamp}ms: Creating filtered OpenApi document with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); + logger.LogTrace("{Timestamp}ms: Creating filtered OpenApi document with {Paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } return document; @@ -183,7 +183,7 @@ private static void WriteOpenApi(HidiOptions options, OpenApiFormat openApiForma { if (options.Output is null) throw new InvalidOperationException("Output file path is null"); using var outputStream = options.Output.Create(); - var textWriter = new StreamWriter(outputStream); + using var textWriter = new StreamWriter(outputStream); var settings = new OpenApiWriterSettings() { @@ -205,7 +205,7 @@ private static void WriteOpenApi(HidiOptions options, OpenApiFormat openApiForma document.Serialize(writer, openApiVersion); stopwatch.Stop(); - logger.LogTrace($"Finished serializing in {stopwatch.ElapsedMilliseconds}ms"); + logger.LogTrace("Finished serializing in {ElapsedMilliseconds}ms", stopwatch.ElapsedMilliseconds); textWriter.Flush(); } } @@ -220,28 +220,28 @@ private static async Task GetOpenApi(HidiOptions options, ILogg if (!string.IsNullOrEmpty(options.Csdl)) { var stopwatch = new Stopwatch(); - using (logger.BeginScope("Convert CSDL: {csdl}", options.Csdl)) + using (logger.BeginScope("Convert CSDL: {Csdl}", options.Csdl)) { stopwatch.Start(); - stream = await GetStream(options.Csdl, logger, cancellationToken); + stream = await GetStream(options.Csdl, logger, cancellationToken).ConfigureAwait(false); Stream? filteredStream = null; if (!string.IsNullOrEmpty(options.CsdlFilter)) { XslCompiledTransform transform = GetFilterTransform(); filteredStream = ApplyFilterToCsdl(stream, options.CsdlFilter, transform); filteredStream.Position = 0; - stream.Dispose(); + await stream.DisposeAsync().ConfigureAwait(false); } - document = await ConvertCsdlToOpenApi(filteredStream ?? stream, metadataVersion, options.SettingsConfig, cancellationToken); + document = await ConvertCsdlToOpenApi(filteredStream ?? stream, metadataVersion, options.SettingsConfig, cancellationToken).ConfigureAwait(false); stopwatch.Stop(); - logger.LogTrace("{timestamp}ms: Generated OpenAPI with {paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); + logger.LogTrace("{Timestamp}ms: Generated OpenAPI with {Paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } } else if (!string.IsNullOrEmpty(options.OpenApi)) { - stream = await GetStream(options.OpenApi, logger, cancellationToken); - var result = await ParseOpenApi(options.OpenApi, options.InlineExternal, logger, stream, cancellationToken); + stream = await GetStream(options.OpenApi, logger, cancellationToken).ConfigureAwait(false); + var result = await ParseOpenApi(options.OpenApi, options.InlineExternal, logger, stream, cancellationToken).ConfigureAwait(false); document = result.OpenApiDocument; } else throw new InvalidOperationException("No input file path or URL provided"); @@ -301,22 +301,22 @@ private static XslCompiledTransform GetFilterTransform() XslCompiledTransform transform = new(); Assembly assembly = typeof(OpenApiService).GetTypeInfo().Assembly; using var xslt = assembly.GetManifestResourceStream("Microsoft.OpenApi.Hidi.CsdlFilter.xslt") ?? throw new InvalidOperationException("Could not find the Microsoft.OpenApi.Hidi.CsdlFilter.xslt file in the assembly. Check build configuration."); - transform.Load(new XmlTextReader(new StreamReader(xslt))); + using var streamReader = new StreamReader(xslt); + using var textReader = new XmlTextReader(streamReader); + transform.Load(textReader); return transform; } private static Stream ApplyFilterToCsdl(Stream csdlStream, string entitySetOrSingleton, XslCompiledTransform transform) { - Stream stream; using StreamReader inputReader = new(csdlStream, leaveOpen: true); - XmlReader inputXmlReader = XmlReader.Create(inputReader); + using XmlReader inputXmlReader = XmlReader.Create(inputReader); MemoryStream filteredStream = new(); - StreamWriter writer = new(filteredStream); + using StreamWriter writer = new(filteredStream, leaveOpen: true); XsltArgumentList args = new(); args.AddParam("entitySetOrSingleton", "", entitySetOrSingleton); transform.Transform(inputXmlReader, args, writer); - stream = filteredStream; - return stream; + return filteredStream; } /// @@ -334,9 +334,9 @@ public static async Task ValidateOpenApiDocument( try { - using var stream = await GetStream(openApi, logger, cancellationToken); + using var stream = await GetStream(openApi, logger, cancellationToken).ConfigureAwait(false); - var result = await ParseOpenApi(openApi, false, logger, stream, cancellationToken); + var result = await ParseOpenApi(openApi, false, logger, stream, cancellationToken).ConfigureAwait(false); using (logger.BeginScope("Calculating statistics")) { @@ -345,12 +345,14 @@ public static async Task ValidateOpenApiDocument( walker.Walk(result.OpenApiDocument); logger.LogTrace("Finished walking through the OpenApi document. Generating a statistics report.."); + #pragma warning disable CA2254 logger.LogInformation(statsVisitor.GetStatisticsReport()); + #pragma warning restore CA2254 } } catch (TaskCanceledException) { - Console.Error.WriteLine("CTRL+C pressed, aborting the operation."); + await Console.Error.WriteLineAsync("CTRL+C pressed, aborting the operation.").ConfigureAwait(false); } catch (Exception ex) { @@ -362,7 +364,7 @@ private static async Task ParseOpenApi(string openApiFile, bool inli { ReadResult result; Stopwatch stopwatch = Stopwatch.StartNew(); - using (logger.BeginScope("Parsing OpenAPI: {openApiFile}", openApiFile)) + using (logger.BeginScope("Parsing OpenAPI: {OpenApiFile}", openApiFile)) { stopwatch.Start(); @@ -373,9 +375,9 @@ private static async Task ParseOpenApi(string openApiFile, bool inli new Uri(openApiFile) : new Uri("file://" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar) } - ).ReadAsync(stream, cancellationToken); + ).ReadAsync(stream, cancellationToken).ConfigureAwait(false); - logger.LogTrace("{timestamp}ms: Completed parsing.", stopwatch.ElapsedMilliseconds); + logger.LogTrace("{Timestamp}ms: Completed parsing.", stopwatch.ElapsedMilliseconds); LogErrors(logger, result); stopwatch.Stop(); @@ -392,7 +394,7 @@ private static async Task ParseOpenApi(string openApiFile, bool inli public static async Task ConvertCsdlToOpenApi(Stream csdl, string? metadataVersion = null, IConfiguration? settings = null, CancellationToken token = default) { using var reader = new StreamReader(csdl); - var csdlText = await reader.ReadToEndAsync(token); + var csdlText = await reader.ReadToEndAsync(token).ConfigureAwait(false); var edmModel = CsdlReader.Parse(XElement.Parse(csdlText).CreateReader()); settings ??= SettingsUtilities.GetConfiguration(); @@ -485,19 +487,15 @@ private static async Task GetStream(string input, ILogger logger, Cancel var stopwatch = new Stopwatch(); stopwatch.Start(); - if (input.StartsWith("http")) + if (input.StartsWith("http", StringComparison.OrdinalIgnoreCase)) { try { - var httpClientHandler = new HttpClientHandler() - { - SslProtocols = System.Security.Authentication.SslProtocols.Tls12, - }; - using var httpClient = new HttpClient(httpClientHandler) + using var httpClient = new HttpClient { DefaultRequestVersion = HttpVersion.Version20 }; - stream = await httpClient.GetStreamAsync(input, cancellationToken); + stream = await httpClient.GetStreamAsync(new Uri(input), cancellationToken).ConfigureAwait(false); } catch (HttpRequestException ex) { @@ -523,7 +521,7 @@ ex is SecurityException || } } stopwatch.Stop(); - logger.LogTrace("{timestamp}ms: Read file {input}", stopwatch.ElapsedMilliseconds, input); + logger.LogTrace("{Timestamp}ms: Read file {Input}", stopwatch.ElapsedMilliseconds, input); } return stream; } @@ -537,7 +535,7 @@ ex is SecurityException || private static OpenApiFormat GetOpenApiFormat(string input, ILogger logger) { logger.LogTrace("Getting the OpenApi format"); - return !input.StartsWith("http") && Path.GetExtension(input) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml; + return !input.StartsWith("http", StringComparison.OrdinalIgnoreCase) && Path.GetExtension(input) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml; } private static string GetInputPathExtension(string? openapi = null, string? csdl = null) @@ -564,7 +562,7 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl throw new ArgumentException("Please input a file path or URL"); } - var document = await GetOpenApi(options, logger, cancellationToken); + var document = await GetOpenApi(options, logger, cancellationToken).ConfigureAwait(false); using (logger.BeginScope("Creating diagram")) { @@ -614,7 +612,7 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl } catch (TaskCanceledException) { - Console.Error.WriteLine("CTRL+C pressed, aborting the operation."); + await Console.Error.WriteLineAsync("CTRL+C pressed, aborting the operation.").ConfigureAwait(false); } catch (Exception ex) { @@ -632,7 +630,7 @@ private static void LogErrors(ILogger logger, ReadResult result) { foreach (var error in context.Errors) { - logger.LogError("Detected error during parsing: {error}", error.ToString()); + logger.LogError("Detected error during parsing: {Error}", error.ToString()); } } } @@ -650,7 +648,7 @@ internal static void WriteTreeDocumentAsMarkdown(string openapiUrl, OpenApiDocum // write a span for each mermaidcolorscheme foreach (var style in OpenApiUrlTreeNode.MermaidNodeStyles) { - writer.WriteLine($"{style.Key.Replace("_", " ")}"); + writer.WriteLine($"{style.Key.Replace("_", " ", StringComparison.OrdinalIgnoreCase)}"); } writer.WriteLine("
"); writer.WriteLine(); @@ -683,7 +681,7 @@ internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument d // write a span for each mermaidcolorscheme foreach (var style in OpenApiUrlTreeNode.MermaidNodeStyles) { - writer.WriteLine($"{style.Key.Replace("_", " ")}"); + writer.WriteLine($"{style.Key.Replace("_", " ", StringComparison.OrdinalIgnoreCase)}"); } writer.WriteLine("
"); writer.WriteLine("
"); @@ -708,17 +706,17 @@ internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument d writer.WriteLine(" Main(string[] args) var rootCommand = CreateRootCommand(); // Parse the incoming args and invoke the handler - return await rootCommand.InvokeAsync(args); + return await rootCommand.InvokeAsync(args).ConfigureAwait(false); } internal static RootCommand CreateRootCommand() diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index b05b0de7c..871f88dca 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -10,63 +10,63 @@ namespace Microsoft.OpenApi.Hidi { internal class StatsVisitor : OpenApiVisitorBase { - public int ParameterCount { get; set; } = 0; + public int ParameterCount { get; set; } public override void Visit(OpenApiParameter parameter) { ParameterCount++; } - public int SchemaCount { get; set; } = 0; + public int SchemaCount { get; set; } public override void Visit(OpenApiSchema schema) { SchemaCount++; } - public int HeaderCount { get; set; } = 0; + public int HeaderCount { get; set; } public override void Visit(IDictionary headers) { HeaderCount++; } - public int PathItemCount { get; set; } = 0; + public int PathItemCount { get; set; } public override void Visit(OpenApiPathItem pathItem) { PathItemCount++; } - public int RequestBodyCount { get; set; } = 0; + public int RequestBodyCount { get; set; } public override void Visit(OpenApiRequestBody requestBody) { RequestBodyCount++; } - public int ResponseCount { get; set; } = 0; + public int ResponseCount { get; set; } public override void Visit(OpenApiResponses response) { ResponseCount++; } - public int OperationCount { get; set; } = 0; + public int OperationCount { get; set; } public override void Visit(OpenApiOperation operation) { OperationCount++; } - public int LinkCount { get; set; } = 0; + public int LinkCount { get; set; } public override void Visit(OpenApiLink operation) { LinkCount++; } - public int CallbackCount { get; set; } = 0; + public int CallbackCount { get; set; } public override void Visit(OpenApiCallback callback) { diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index ebe55934f..4f37314b1 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -6,6 +6,9 @@ enable false + true + All + CA2007 diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 647cac321..b1fcd24d3 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -17,13 +17,14 @@ namespace Microsoft.OpenApi.Hidi.Tests { - public class OpenApiServiceTests + public sealed class OpenApiServiceTests : IDisposable { private readonly ILogger _logger; + private readonly LoggerFactory _loggerFactory = new(); public OpenApiServiceTests() { - _logger = new Logger(new LoggerFactory()); + _logger = new Logger(_loggerFactory); } [Fact] @@ -105,7 +106,7 @@ public void ShowCommandGeneratesMermaidDiagramAsMarkdown() stream.Position = 0; using var reader = new StreamReader(stream); var output = reader.ReadToEnd(); - Assert.Contains("graph LR", output); + Assert.Contains("graph LR", output, StringComparison.Ordinal); } [Fact] @@ -126,7 +127,7 @@ public void ShowCommandGeneratesMermaidDiagramAsHtml() stream.Position = 0; using var reader = new StreamReader(stream); var output = reader.ReadToEnd(); - Assert.Contains("graph LR", output); + Assert.Contains("graph LR", output, StringComparison.Ordinal); } @@ -144,7 +145,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() await OpenApiService.ShowOpenApiDocument(options, _logger, new CancellationToken()); var output = File.ReadAllText(options.Output.FullName); - Assert.Contains("graph LR", output); + Assert.Contains("graph LR", output, StringComparison.Ordinal); } [Fact] @@ -172,7 +173,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiag await OpenApiService.ShowOpenApiDocument(options, _logger, new CancellationToken()); var output = File.ReadAllText(options.Output.FullName); - Assert.Contains("graph LR", output); + Assert.Contains("graph LR", output, StringComparison.Ordinal); } [Fact] @@ -341,8 +342,8 @@ public void InvokeTransformCommand() public void InvokeShowCommand() { var rootCommand = Program.CreateRootCommand(); - var openapi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); - var args = new string[] { "show", "-d", openapi, "-o", "sample.md" }; + var openApi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); + var args = new string[] { "show", "-d", openApi, "-o", "sample.md" }; var parseResult = rootCommand.Parse(args); var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler; var context = new InvocationContext(parseResult); @@ -350,7 +351,7 @@ public void InvokeShowCommand() handler!.Invoke(context); var output = File.ReadAllText("sample.md"); - Assert.Contains("graph LR", output); + Assert.Contains("graph LR", output, StringComparison.Ordinal); } [Fact] @@ -383,5 +384,10 @@ public void CreateRootCommand() var rootCommand = Program.CreateRootCommand(); Assert.NotNull(rootCommand); } + + public void Dispose() + { + _loggerFactory.Dispose(); + } } } From 363cc26fdea3f2d0114bb8e8ff7c064da678cb04 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 15 Sep 2023 08:10:48 -0400 Subject: [PATCH 346/752] - fixes hidi release build --- .../Handlers/PluginCommandHandler.cs | 8 ++++++++ .../Handlers/ShowCommandHandler.cs | 8 ++++++++ .../Handlers/TransformCommandHandler.cs | 8 ++++++++ .../Handlers/ValidateCommandHandler.cs | 10 +++++++++- 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs index 0fcb86df2..2c7e921bb 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs @@ -35,16 +35,24 @@ public async Task InvokeAsync(InvocationContext context) return 0; } +#if RELEASE +#pragma warning disable CA1031 // Do not catch general exception types +#endif catch (Exception ex) { #if DEBUG logger.LogCritical(ex, "Command failed"); throw; // so debug tools go straight to the source of the exception when attached #else +#pragma warning disable CA2254 logger.LogCritical(ex.Message); +#pragma warning restore CA2254 return 1; #endif } +#if RELEASE +#pragma warning restore CA1031 // Do not catch general exception types +#endif } } } diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs index a6a161dc2..054912302 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs @@ -35,16 +35,24 @@ public async Task InvokeAsync(InvocationContext context) return 0; } +#if RELEASE +#pragma warning disable CA1031 // Do not catch general exception types +#endif catch (Exception ex) { #if DEBUG logger.LogCritical(ex, "Command failed"); throw; // so debug tools go straight to the source of the exception when attached #else +#pragma warning disable CA2254 logger.LogCritical( ex.Message); +#pragma warning restore CA2254 return 1; #endif } +#if RELEASE +#pragma warning restore CA1031 // Do not catch general exception types +#endif } } } diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs index f173024cc..293fefec9 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs @@ -35,16 +35,24 @@ public async Task InvokeAsync(InvocationContext context) return 0; } +#if RELEASE +#pragma warning disable CA1031 // Do not catch general exception types +#endif catch (Exception ex) { #if DEBUG logger.LogCritical(ex, "Command failed"); throw; // so debug tools go straight to the source of the exception when attached #else +#pragma warning disable CA2254 logger.LogCritical( ex.Message); +#pragma warning restore CA2254 return 1; #endif } +#if RELEASE +#pragma warning restore CA1031 // Do not catch general exception types +#endif } } } diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs index 153ec707e..4351a04cb 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs @@ -36,16 +36,24 @@ public async Task InvokeAsync(InvocationContext context) await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false); return 0; } +#if RELEASE +#pragma warning disable CA1031 // Do not catch general exception types +#endif catch (Exception ex) { #if DEBUG logger.LogCritical(ex, "Command failed"); throw; // so debug tools go straight to the source of the exception when attached #else - logger.LogCritical( ex.Message); +#pragma warning disable CA2254 + logger.LogCritical(ex.Message); +#pragma warning restore CA2254 return 1; #endif } +#if RELEASE +#pragma warning restore CA1031 // Do not catch general exception types +#endif } } } From d2784e4d274c066ed9b4ca306c9d1015bbec793b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 18 Sep 2023 09:50:12 -0400 Subject: [PATCH 347/752] - removes publish trimmed since it'd break functionality Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs b/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs index 1d261e5f3..6264270a6 100644 --- a/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs +++ b/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs @@ -20,7 +20,7 @@ internal static IConfiguration GetConfiguration(string? settingsFile = null) return config; } - internal static OpenApiConvertSettings GetOpenApiConvertSettings(IConfiguration config, string? metadataVersion = null) + internal static OpenApiConvertSettings GetOpenApiConvertSettings(IConfiguration config, string? metadataVersion) { if (config == null) { throw new System.ArgumentNullException(nameof(config)); } var settings = new OpenApiConvertSettings(); From ae58eb5d1006f64f53a544db79a2a6c5e78a6566 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Sep 2023 21:01:18 +0000 Subject: [PATCH 348/752] Bump xunit.runner.visualstudio from 2.5.0 to 2.5.1 Bumps [xunit.runner.visualstudio](https://github.com/xunit/xunit) from 2.5.0 to 2.5.1. - [Commits](https://github.com/xunit/xunit/compare/2.5.0...2.5.1) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index ebe55934f..8c6bdd9c0 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -16,7 +16,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 344a66435c23974044b3e4fc02b36116fdc627f3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Sep 2023 21:05:44 +0000 Subject: [PATCH 349/752] Bump xunit from 2.5.0 to 2.5.1 Bumps [xunit](https://github.com/xunit/xunit) from 2.5.0 to 2.5.1. - [Commits](https://github.com/xunit/xunit/compare/2.5.0...2.5.1) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 8c6bdd9c0..706e899f1 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 6c6b4b6003c8cda6414eed216e3339b5fb3d80f4 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 19 Sep 2023 07:56:02 -0400 Subject: [PATCH 350/752] - fixes readme path to the correct hidi readme --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b02f89003..3d20c3d9f 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -69,7 +69,7 @@ - + From a1033a6733c613e3bfaea0f8a6138e394f2384f2 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 19 Sep 2023 09:29:44 -0400 Subject: [PATCH 351/752] - fixes an issue where executable release would fail because of warn as error --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 3d20c3d9f..f1ac21781 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -28,7 +28,7 @@ true true - NU5048;CA1848; + $(NoWarn);NU5048;NU5104;CA1848; true readme.md All From 669c2258055bc74077d7c81e7df021b2e5d4f432 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Tue, 26 Sep 2023 16:43:26 +0300 Subject: [PATCH 352/752] Bump lib versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index f1ac21781..ced9d9c3c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -17,7 +17,7 @@ Microsoft.OpenApi.Hidi hidi ./../../artifacts - 1.2.9 + 1.3.0 OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET From 53c491ecd585b30f7227b2cbff5105f320c08f95 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 30 Sep 2023 22:29:02 +1000 Subject: [PATCH 353/752] fix some warnings --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 13 +++++++------ .../Services/OpenApiServiceTests.cs | 14 +++++++------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 809e3ecf9..b3e66cfe2 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -81,7 +81,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l if (!string.IsNullOrEmpty(options.FilterOptions?.FilterByCollection)) { using var collectionStream = await GetStream(options.FilterOptions.FilterByCollection, logger, cancellationToken).ConfigureAwait(false); - postmanCollection = JsonDocument.Parse(collectionStream); + postmanCollection = await JsonDocument.ParseAsync(collectionStream, cancellationToken: cancellationToken).ConfigureAwait(false); } // Load OpenAPI document @@ -132,7 +132,8 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l } using (var fileStream = await GetStream(apiManifestRef[0], logger, cancellationToken).ConfigureAwait(false)) { - apiManifest = ApiManifestDocument.Load(JsonDocument.Parse(fileStream).RootElement); + var document = await JsonDocument.ParseAsync(fileStream, cancellationToken: cancellationToken).ConfigureAwait(false); + apiManifest = ApiManifestDocument.Load(document.RootElement); } apiDependency = !string.IsNullOrEmpty(apiDependencyName) && apiManifest.ApiDependencies.TryGetValue(apiDependencyName, out var dependency) ? dependency : apiManifest.ApiDependencies.First().Value; @@ -453,13 +454,13 @@ private static Dictionary> EnumerateJsonDocument(JsonElemen // Fetch list of methods and urls from collection, store them in a dictionary var path = request.GetProperty("url").GetProperty("raw").ToString(); var method = request.GetProperty("method").ToString(); - if (!paths.ContainsKey(path)) + if (paths.TryGetValue(path, out var value)) { - paths.Add(path, new List { method }); + value.Add(method); } else { - paths[path].Add(method); + paths.Add(path, new List {method}); } } else @@ -755,7 +756,7 @@ internal static async Task PluginManifest(HidiOptions options, ILogger logger, C using var file = new FileStream(manifestFile.FullName, FileMode.Create); using var jsonWriter = new Utf8JsonWriter(file, new JsonWriterOptions { Indented = true }); manifest.Write(jsonWriter); - jsonWriter.Flush(); + await jsonWriter.FlushAsync(cancellationToken).ConfigureAwait(false); } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index b1fcd24d3..9d73c8db6 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -144,7 +144,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() await OpenApiService.ShowOpenApiDocument(options, _logger, new CancellationToken()); - var output = File.ReadAllText(options.Output.FullName); + var output = await File.ReadAllTextAsync(options.Output.FullName); Assert.Contains("graph LR", output, StringComparison.Ordinal); } @@ -172,7 +172,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiag // create a dummy ILogger instance for testing await OpenApiService.ShowOpenApiDocument(options, _logger, new CancellationToken()); - var output = File.ReadAllText(options.Output.FullName); + var output = await File.ReadAllTextAsync(options.Output.FullName); Assert.Contains("graph LR", output, StringComparison.Ordinal); } @@ -223,7 +223,7 @@ public async Task TransformCommandConvertsOpenApi() // create a dummy ILogger instance for testing await OpenApiService.TransformOpenApiDocument(options, _logger, new CancellationToken()); - var output = File.ReadAllText("sample.json"); + var output = await File.ReadAllTextAsync("sample.json"); Assert.NotEmpty(output); } @@ -242,7 +242,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputName() // create a dummy ILogger instance for testing await OpenApiService.TransformOpenApiDocument(options, _logger, new CancellationToken()); - var output = File.ReadAllText("output.yml"); + var output = await File.ReadAllTextAsync("output.yml"); Assert.NotEmpty(output); } @@ -260,7 +260,7 @@ public async Task TransformCommandConvertsCsdlWithDefaultOutputName() // create a dummy ILogger instance for testing await OpenApiService.TransformOpenApiDocument(options, _logger, new CancellationToken()); - var output = File.ReadAllText("output.yml"); + var output = await File.ReadAllTextAsync("output.yml"); Assert.NotEmpty(output); } @@ -280,7 +280,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchF // create a dummy ILogger instance for testing await OpenApiService.TransformOpenApiDocument(options, _logger, new CancellationToken()); - var output = File.ReadAllText("output.yml"); + var output = await File.ReadAllTextAsync("output.yml"); Assert.NotEmpty(output); } @@ -317,7 +317,7 @@ public async Task TransformToPowerShellCompliantOpenApi() // create a dummy ILogger instance for testing await OpenApiService.TransformOpenApiDocument(options, _logger, new CancellationToken()); - var output = File.ReadAllText("output.yml"); + var output = await File.ReadAllTextAsync("output.yml"); Assert.NotEmpty(output); } From 273ee6d3c449e060bded0a5b1c5605e083426def Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 30 Sep 2023 22:45:54 +1000 Subject: [PATCH 354/752] remove csproj settings that are convention based on project name --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index ced9d9c3c..ae373f6c8 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -13,8 +13,6 @@ true Microsoft Microsoft - Microsoft.OpenApi.Hidi - Microsoft.OpenApi.Hidi hidi ./../../artifacts 1.3.0 @@ -23,8 +21,6 @@ OpenAPI .NET https://github.com/Microsoft/OpenAPI.NET https://github.com/microsoft/OpenAPI.NET/releases - Microsoft.OpenApi.Hidi - Microsoft.OpenApi.Hidi true true From 740c0c163646d648334406d674e6d1a265e8fa9d Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 30 Sep 2023 22:47:29 +1000 Subject: [PATCH 355/752] move Authors and company to props --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index ae373f6c8..be2da6fc8 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -11,8 +11,6 @@ https://github.com/Microsoft/OpenAPI.NET MIT true - Microsoft - Microsoft hidi ./../../artifacts 1.3.0 From d439496c46b209d43e2e629e7b65bbe6fd5a139e Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 30 Sep 2023 22:48:20 +1000 Subject: [PATCH 356/752] move license to props --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index be2da6fc8..0bd41b287 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,6 @@ enable http://go.microsoft.com/fwlink/?LinkID=288890 https://github.com/Microsoft/OpenAPI.NET - MIT true hidi ./../../artifacts From bcc67eb8cf8fe430af4bb90d9e51b1155e025fce Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 30 Sep 2023 22:48:57 +1000 Subject: [PATCH 357/752] move PackageRequireLicenseAcceptance to props --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 0bd41b287..7a8caaf7b 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,6 @@ enable http://go.microsoft.com/fwlink/?LinkID=288890 https://github.com/Microsoft/OpenAPI.NET - true hidi ./../../artifacts 1.3.0 From 04b7138bd71e2a5f782d8395b4342ae9977352de Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 30 Sep 2023 22:49:52 +1000 Subject: [PATCH 358/752] move RepositoryUrl to props --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7a8caaf7b..036b8c8c8 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,6 @@ OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET - https://github.com/Microsoft/OpenAPI.NET https://github.com/microsoft/OpenAPI.NET/releases true From 3e86cbd46fd5e6005abc9532289cd0eb8dbc4cdd Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 30 Sep 2023 22:50:26 +1000 Subject: [PATCH 359/752] move PackageReleaseNotes to props --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 036b8c8c8..71de68838 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -15,7 +15,6 @@ OpenAPI.NET CLI tool for slicing OpenAPI documents © Microsoft Corporation. All rights reserved. OpenAPI .NET - https://github.com/microsoft/OpenAPI.NET/releases true true From ab641a288e66888d089f7354cb5e4fa1a6162fa9 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 30 Sep 2023 22:51:20 +1000 Subject: [PATCH 360/752] move TreatWarningsAsErrors to props --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 1 - .../Microsoft.OpenApi.Hidi.Tests.csproj | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 71de68838..6435a5256 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -19,7 +19,6 @@ true $(NoWarn);NU5048;NU5104;CA1848; - true readme.md All diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 3f719eda8..89789bbb9 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -6,7 +6,6 @@ enable false - true All CA2007 From e69c31e3fb6d118151618e0d4d06075161c8f1c9 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 30 Sep 2023 22:52:51 +1000 Subject: [PATCH 361/752] move PackageIconUrl and PackageProjectUrl to props --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 6435a5256..7806fbd3d 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -7,8 +7,6 @@ true true enable - http://go.microsoft.com/fwlink/?LinkID=288890 - https://github.com/Microsoft/OpenAPI.NET hidi ./../../artifacts 1.3.0 From 9f3a362bd74b5fbf58b6458270095aebd87da0bb Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 30 Sep 2023 22:53:36 +1000 Subject: [PATCH 362/752] move Copyright to props --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7806fbd3d..14d5125ae 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -11,7 +11,6 @@ ./../../artifacts 1.3.0 OpenAPI.NET CLI tool for slicing OpenAPI documents - © Microsoft Corporation. All rights reserved. OpenAPI .NET true From 8081be8dc42fb93e4fb608237b1275851a6b092a Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 30 Sep 2023 22:54:10 +1000 Subject: [PATCH 363/752] move PackageTags to props --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 14d5125ae..fd1520481 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -11,7 +11,6 @@ ./../../artifacts 1.3.0 OpenAPI.NET CLI tool for slicing OpenAPI documents - OpenAPI .NET true true From f9d521cf935533de8d0f94653abef12dccd03b3d Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sat, 30 Sep 2023 22:57:08 +1000 Subject: [PATCH 364/752] simplify PrivateAssets all --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 89789bbb9..1f2ec91e3 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -11,21 +11,12 @@ - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - - - runtime; build; native; contentfiles; analyzers; buildtransitive - all - + + From 7da2e80f4f744a6b7d8dc22591f34b29d970aac7 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Mon, 2 Oct 2023 19:09:30 +1100 Subject: [PATCH 365/752] use some pattern matiching --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index b3e66cfe2..8d6471e88 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -510,13 +510,15 @@ private static async Task GetStream(string input, ILogger logger, Cancel var fileInput = new FileInfo(input); stream = fileInput.OpenRead(); } - catch (Exception ex) when (ex is FileNotFoundException || - ex is PathTooLongException || - ex is DirectoryNotFoundException || - ex is IOException || - ex is UnauthorizedAccessException || - ex is SecurityException || - ex is NotSupportedException) + catch (Exception ex) when ( + ex is + FileNotFoundException or + PathTooLongException or + DirectoryNotFoundException or + IOException or + UnauthorizedAccessException or + SecurityException or + NotSupportedException) { throw new InvalidOperationException($"Could not open the file at {input}", ex); } From 1bc16de395b0496fdaa9336fdf7d30a9f542458a Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Mon, 2 Oct 2023 19:14:05 +1100 Subject: [PATCH 366/752] elide some asyncs --- src/Microsoft.OpenApi.Hidi/Program.cs | 4 ++-- .../Services/OpenApiServiceTests.cs | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index b8508ab5f..9fe8a3014 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -12,12 +12,12 @@ namespace Microsoft.OpenApi.Hidi { static class Program { - static async Task Main(string[] args) + static Task Main(string[] args) { var rootCommand = CreateRootCommand(); // Parse the incoming args and invoke the handler - return await rootCommand.InvokeAsync(args).ConfigureAwait(false); + return rootCommand.InvokeAsync(args); } internal static RootCommand CreateRootCommand() diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 9d73c8db6..24169045f 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -177,25 +177,25 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiag } [Fact] - public async Task ThrowIfOpenApiUrlIsNotProvidedWhenValidating() + public Task ThrowIfOpenApiUrlIsNotProvidedWhenValidating() { - await Assert.ThrowsAsync(async () => - await OpenApiService.ValidateOpenApiDocument("", _logger, new CancellationToken())); + return Assert.ThrowsAsync(() => + OpenApiService.ValidateOpenApiDocument("", _logger, new CancellationToken())); } [Fact] - public async Task ThrowIfURLIsNotResolvableWhenValidating() + public Task ThrowIfURLIsNotResolvableWhenValidating() { - await Assert.ThrowsAsync(async () => - await OpenApiService.ValidateOpenApiDocument("https://example.org/itdoesnmatter", _logger, new CancellationToken())); + return Assert.ThrowsAsync(() => + OpenApiService.ValidateOpenApiDocument("https://example.org/itdoesnmatter", _logger, new CancellationToken())); } [Fact] - public async Task ThrowIfFileDoesNotExistWhenValidating() + public Task ThrowIfFileDoesNotExistWhenValidating() { - await Assert.ThrowsAsync(async () => - await OpenApiService.ValidateOpenApiDocument("aFileThatBetterNotExist.fake", _logger, new CancellationToken())); + return Assert.ThrowsAsync(() => + OpenApiService.ValidateOpenApiDocument("aFileThatBetterNotExist.fake", _logger, new CancellationToken())); } [Fact] @@ -285,7 +285,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchF } [Fact] - public async Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty() + public Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty() { HidiOptions options = new HidiOptions { @@ -294,8 +294,8 @@ public async Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty() InlineLocal = false, InlineExternal = false, }; - await Assert.ThrowsAsync(async () => - await OpenApiService.TransformOpenApiDocument(options, _logger, new CancellationToken())); + return Assert.ThrowsAsync(() => + OpenApiService.TransformOpenApiDocument(options, _logger, new CancellationToken())); } From 28d37b68a0e305350286d1fe1a6f78f907d3d5bb Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Mon, 2 Oct 2023 19:18:24 +1100 Subject: [PATCH 367/752] remove some redundant braces --- .../Formatters/PowerShellFormatter.cs | 2 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 +- src/Microsoft.OpenApi.Hidi/Program.cs | 2 +- .../Formatters/PowerShellFormatterTests.cs | 15 +- .../Services/OpenApiFilterServiceTests.cs | 7 +- .../Services/OpenApiServiceTests.cs | 6 +- .../UtilityFiles/OpenApiDocumentMock.cs | 134 +++++++++--------- 7 files changed, 86 insertions(+), 84 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index 450a05d21..4db55a05e 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -179,7 +179,7 @@ private void AddAdditionalPropertiesToSchema(OpenApiSchema schema) { if (schema != null && !_schemaLoop.Contains(schema) && "object".Equals(schema.Type, StringComparison.OrdinalIgnoreCase)) { - schema.AdditionalProperties = new OpenApiSchema() { Type = "object" }; + schema.AdditionalProperties = new OpenApiSchema { Type = "object" }; /* Because 'additionalProperties' are now being walked, * we need a way to keep track of visited schemas to avoid diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index b3e66cfe2..63a8bbb94 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -186,7 +186,7 @@ private static void WriteOpenApi(HidiOptions options, OpenApiFormat openApiForma using var outputStream = options.Output.Create(); using var textWriter = new StreamWriter(outputStream); - var settings = new OpenApiWriterSettings() + var settings = new OpenApiWriterSettings { InlineLocalReferences = options.InlineLocal, InlineExternalReferences = options.InlineExternal @@ -738,7 +738,7 @@ internal static async Task PluginManifest(HidiOptions options, ILogger logger, C WriteOpenApi(options, OpenApiFormat.Json, OpenApiSpecVersion.OpenApi3_0, document, logger); // Create OpenAIPluginManifest from ApiDependency and OpenAPI document - var manifest = new OpenAIPluginManifest() + var manifest = new OpenAIPluginManifest { NameForHuman = document.Info.Title, DescriptionForHuman = document.Info.Description, diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index b8508ab5f..faf09352f 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -22,7 +22,7 @@ static async Task Main(string[] args) internal static RootCommand CreateRootCommand() { - var rootCommand = new RootCommand() { }; + var rootCommand = new RootCommand { }; var commandOptions = new CommandOptions(); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index a22348897..c261a8e46 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -21,14 +21,15 @@ public class PowerShellFormatterTests public void FormatOperationIdsInOpenAPIDocument(string operationId, string expectedOperationId, OperationType operationType, string path = "/foo") { // Arrange - var openApiDocument = new OpenApiDocument() + var openApiDocument = new OpenApiDocument { Info = new() { Title = "Test", Version = "1.0" }, - Servers = new List() { new() { Url = "https://localhost/" } }, + Servers = new List { new() { Url = "https://localhost/" } }, Paths = new() { { path, new() { - Operations = new Dictionary() { + Operations = new Dictionary + { { operationType, new() { OperationId = operationId } } } } @@ -92,14 +93,14 @@ public void ResolveFunctionParameters() private static OpenApiDocument GetSampleOpenApiDocument() { - return new OpenApiDocument() + return new OpenApiDocument { Info = new() { Title = "Test", Version = "1.0" }, - Servers = new List() { new() { Url = "https://localhost/" } }, + Servers = new List { new() { Url = "https://localhost/" } }, Paths = new() { { "/foo", new() { - Operations = new Dictionary() + Operations = new Dictionary { { OperationType.Get, new() @@ -107,7 +108,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() OperationId = "Foo.GetFoo", Parameters = new List { - new OpenApiParameter() + new OpenApiParameter { Name = "ids", In = ParameterLocation.Query, diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 34cdd3a0a..32d3db3b4 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -70,14 +70,15 @@ public void ReturnFilteredOpenApiDocumentBasedOnPostmanCollection() [Fact] public void TestPredicateFiltersUsingRelativeRequestUrls() { - var openApiDocument = new OpenApiDocument() + var openApiDocument = new OpenApiDocument { Info = new() { Title = "Test", Version = "1.0" }, - Servers = new List() { new() { Url = "https://localhost/" } }, + Servers = new List { new() { Url = "https://localhost/" } }, Paths = new() { {"/foo", new() { - Operations = new Dictionary() { + Operations = new Dictionary + { { OperationType.Get, new() }, { OperationType.Patch, new() }, { OperationType.Post, new() } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 9d73c8db6..fb2349e52 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -136,7 +136,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() { // create a dummy ILogger instance for testing - var options = new HidiOptions() + var options = new HidiOptions { OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), Output = new FileInfo("sample.md") @@ -151,7 +151,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() [Fact] public async Task ShowCommandGeneratesMermaidHtmlFileWithMermaidDiagram() { - var options = new HidiOptions() + var options = new HidiOptions { OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml") }; @@ -162,7 +162,7 @@ public async Task ShowCommandGeneratesMermaidHtmlFileWithMermaidDiagram() [Fact] public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiagram() { - var options = new HidiOptions() + var options = new HidiOptions { Csdl = Path.Combine("UtilityFiles", "Todo.xml"), CsdlFilter = "todos", diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 58b85d91d..3fc77fc01 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -22,9 +22,9 @@ public static OpenApiDocument CreateOpenApiDocument() { var applicationJsonMediaType = "application/json"; - var document = new OpenApiDocument() + var document = new OpenApiDocument { - Info = new OpenApiInfo() + Info = new OpenApiInfo { Title = "People", Version = "v1.0" @@ -36,7 +36,7 @@ public static OpenApiDocument CreateOpenApiDocument() Url = "https://graph.microsoft.com/v1.0" } }, - Paths = new OpenApiPaths() + Paths = new OpenApiPaths { ["/"] = new OpenApiPathItem() // root path { @@ -46,10 +46,10 @@ public static OpenApiDocument CreateOpenApiDocument() OperationType.Get, new OpenApiOperation { OperationId = "graphService.GetGraphService", - Responses = new OpenApiResponses() + Responses = new OpenApiResponses { { - "200",new OpenApiResponse() + "200",new OpenApiResponse { Description = "OK" } @@ -59,7 +59,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/reports/microsoft.graph.getTeamsUserActivityCounts(period={period})"] = new OpenApiPathItem() + ["/reports/microsoft.graph.getTeamsUserActivityCounts(period={period})"] = new OpenApiPathItem { Operations = new Dictionary { @@ -69,7 +69,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag() + new OpenApiTag { Name = "reports.Functions" } @@ -80,22 +80,22 @@ public static OpenApiDocument CreateOpenApiDocument() Parameters = new List { { - new OpenApiParameter() + new OpenApiParameter { Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new OpenApiSchema() + Schema = new OpenApiSchema { Type = "string" } } } }, - Responses = new OpenApiResponses() + Responses = new OpenApiResponses { { - "200", new OpenApiResponse() + "200", new OpenApiResponse { Description = "Success", Content = new Dictionary @@ -120,12 +120,12 @@ public static OpenApiDocument CreateOpenApiDocument() Parameters = new List { { - new OpenApiParameter() + new OpenApiParameter { Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new OpenApiSchema() + Schema = new OpenApiSchema { Type = "string" } @@ -133,7 +133,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/reports/microsoft.graph.getTeamsUserActivityUserDetail(date={date})"] = new OpenApiPathItem() + ["/reports/microsoft.graph.getTeamsUserActivityUserDetail(date={date})"] = new OpenApiPathItem { Operations = new Dictionary { @@ -143,7 +143,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag() + new OpenApiTag { Name = "reports.Functions" } @@ -154,22 +154,22 @@ public static OpenApiDocument CreateOpenApiDocument() Parameters = new List { { - new OpenApiParameter() + new OpenApiParameter { Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new OpenApiSchema() + Schema = new OpenApiSchema { Type = "string" } } } }, - Responses = new OpenApiResponses() + Responses = new OpenApiResponses { { - "200", new OpenApiResponse() + "200", new OpenApiResponse { Description = "Success", Content = new Dictionary @@ -198,14 +198,14 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new OpenApiSchema() + Schema = new OpenApiSchema { Type = "string" } } } }, - ["/users"] = new OpenApiPathItem() + ["/users"] = new OpenApiPathItem { Operations = new Dictionary { @@ -215,7 +215,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag() + new OpenApiTag { Name = "users.user" } @@ -223,10 +223,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, OperationId = "users.user.ListUser", Summary = "Get entities from users", - Responses = new OpenApiResponses() + Responses = new OpenApiResponses { { - "200", new OpenApiResponse() + "200", new OpenApiResponse { Description = "Retrieved entities", Content = new Dictionary @@ -268,7 +268,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/users/{user-id}"] = new OpenApiPathItem() + ["/users/{user-id}"] = new OpenApiPathItem { Operations = new Dictionary { @@ -278,7 +278,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag() + new OpenApiTag { Name = "users.user" } @@ -286,10 +286,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, OperationId = "users.user.GetUser", Summary = "Get entity from users by key", - Responses = new OpenApiResponses() + Responses = new OpenApiResponses { { - "200", new OpenApiResponse() + "200", new OpenApiResponse { Description = "Retrieved entity", Content = new Dictionary @@ -320,7 +320,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag() + new OpenApiTag { Name = "users.user" } @@ -328,10 +328,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, OperationId = "users.user.UpdateUser", Summary = "Update entity in users", - Responses = new OpenApiResponses() + Responses = new OpenApiResponses { { - "204", new OpenApiResponse() + "204", new OpenApiResponse { Description = "Success" } @@ -341,7 +341,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/users/{user-id}/messages/{message-id}"] = new OpenApiPathItem() + ["/users/{user-id}/messages/{message-id}"] = new OpenApiPathItem { Operations = new Dictionary { @@ -351,7 +351,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag() + new OpenApiTag { Name = "users.message" } @@ -362,23 +362,23 @@ public static OpenApiDocument CreateOpenApiDocument() Description = "The messages in a mailbox or folder. Read-only. Nullable.", Parameters = new List { - new OpenApiParameter() + new OpenApiParameter { Name = "$select", In = ParameterLocation.Query, Required = true, Description = "Select properties to be returned", - Schema = new OpenApiSchema() + Schema = new OpenApiSchema { Type = "array" } // missing explode parameter } }, - Responses = new OpenApiResponses() + Responses = new OpenApiResponses { { - "200", new OpenApiResponse() + "200", new OpenApiResponse { Description = "Retrieved navigation property", Content = new Dictionary @@ -405,7 +405,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/administrativeUnits/{administrativeUnit-id}/microsoft.graph.restore"] = new OpenApiPathItem() + ["/administrativeUnits/{administrativeUnit-id}/microsoft.graph.restore"] = new OpenApiPathItem { Operations = new Dictionary { @@ -415,7 +415,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag() + new OpenApiTag { Name = "administrativeUnits.Actions" } @@ -426,23 +426,23 @@ public static OpenApiDocument CreateOpenApiDocument() Parameters = new List { { - new OpenApiParameter() + new OpenApiParameter { Name = "administrativeUnit-id", In = ParameterLocation.Path, Required = true, Description = "key: id of administrativeUnit", - Schema = new OpenApiSchema() + Schema = new OpenApiSchema { Type = "string" } } } }, - Responses = new OpenApiResponses() + Responses = new OpenApiResponses { { - "200", new OpenApiResponse() + "200", new OpenApiResponse { Description = "Success", Content = new Dictionary @@ -472,7 +472,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/applications/{application-id}/logo"] = new OpenApiPathItem() + ["/applications/{application-id}/logo"] = new OpenApiPathItem { Operations = new Dictionary { @@ -482,7 +482,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag() + new OpenApiTag { Name = "applications.application" } @@ -490,10 +490,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, OperationId = "applications.application.UpdateLogo", Summary = "Update media content for application in applications", - Responses = new OpenApiResponses() + Responses = new OpenApiResponses { { - "204", new OpenApiResponse() + "204", new OpenApiResponse { Description = "Success" } @@ -503,7 +503,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/security/hostSecurityProfiles"] = new OpenApiPathItem() + ["/security/hostSecurityProfiles"] = new OpenApiPathItem { Operations = new Dictionary { @@ -513,7 +513,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag() + new OpenApiTag { Name = "security.hostSecurityProfile" } @@ -521,10 +521,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, OperationId = "security.ListHostSecurityProfiles", Summary = "Get hostSecurityProfiles from security", - Responses = new OpenApiResponses() + Responses = new OpenApiResponses { { - "200", new OpenApiResponse() + "200", new OpenApiResponse { Description = "Retrieved navigation property", Content = new Dictionary @@ -566,7 +566,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/communications/calls/{call-id}/microsoft.graph.keepAlive"] = new OpenApiPathItem() + ["/communications/calls/{call-id}/microsoft.graph.keepAlive"] = new OpenApiPathItem { Operations = new Dictionary { @@ -576,7 +576,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag() + new OpenApiTag { Name = "communications.Actions" } @@ -586,13 +586,13 @@ public static OpenApiDocument CreateOpenApiDocument() Summary = "Invoke action keepAlive", Parameters = new List { - new OpenApiParameter() + new OpenApiParameter { Name = "call-id", In = ParameterLocation.Path, Description = "key: id of call", Required = true, - Schema = new OpenApiSchema() + Schema = new OpenApiSchema { Type = "string" }, @@ -604,10 +604,10 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Responses = new OpenApiResponses() + Responses = new OpenApiResponses { { - "204", new OpenApiResponse() + "204", new OpenApiResponse { Description = "Success" } @@ -623,7 +623,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/groups/{group-id}/events/{event-id}/calendar/events/microsoft.graph.delta"] = new OpenApiPathItem() + ["/groups/{group-id}/events/{event-id}/calendar/events/microsoft.graph.delta"] = new OpenApiPathItem { Operations = new Dictionary { @@ -632,7 +632,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Tags = new List { - new OpenApiTag() + new OpenApiTag { Name = "groups.Functions" } @@ -641,13 +641,13 @@ public static OpenApiDocument CreateOpenApiDocument() Summary = "Invoke function delta", Parameters = new List { - new OpenApiParameter() + new OpenApiParameter { Name = "group-id", In = ParameterLocation.Path, Description = "key: id of group", Required = true, - Schema = new OpenApiSchema() + Schema = new OpenApiSchema { Type = "string" }, @@ -658,13 +658,13 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - new OpenApiParameter() + new OpenApiParameter { Name = "event-id", In = ParameterLocation.Path, Description = "key: id of event", Required = true, - Schema = new OpenApiSchema() + Schema = new OpenApiSchema { Type = "string" }, @@ -676,10 +676,10 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Responses = new OpenApiResponses() + Responses = new OpenApiResponses { { - "200", new OpenApiResponse() + "200", new OpenApiResponse { Description = "Success", Content = new Dictionary @@ -713,7 +713,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/applications/{application-id}/createdOnBehalfOf/$ref"] = new OpenApiPathItem() + ["/applications/{application-id}/createdOnBehalfOf/$ref"] = new OpenApiPathItem { Operations = new Dictionary { @@ -722,7 +722,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Tags = new List { - new OpenApiTag() + new OpenApiTag { Name = "applications.directoryObject" } From 3a0bccb8b236506cb5f3565daaf5ea9f55b46263 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Mon, 2 Oct 2023 19:20:00 +1100 Subject: [PATCH 368/752] remove some usings --- src/Microsoft.OpenApi.Hidi/Program.cs | 1 - .../Services/OpenApiServiceTests.cs | 1 - .../UtilityFiles/OpenApiDocumentMock.cs | 2 -- 3 files changed, 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Program.cs b/src/Microsoft.OpenApi.Hidi/Program.cs index b8508ab5f..13c355cce 100644 --- a/src/Microsoft.OpenApi.Hidi/Program.cs +++ b/src/Microsoft.OpenApi.Hidi/Program.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System.CommandLine; -using System.CommandLine.Parsing; using System.Threading.Tasks; using Microsoft.OpenApi.Hidi.Handlers; using Microsoft.OpenApi.Hidi.Options; diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 9d73c8db6..fd620502d 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -3,7 +3,6 @@ using System.CommandLine; using System.CommandLine.Invocation; -using System.CommandLine.Parsing; using System.Text.Json; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 58b85d91d..3f5604ff0 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using System.Collections.Generic; -using System.Security.Policy; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; From 42fa6fca8f287a064914635edc2efa1a8ebddf0d Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Mon, 2 Oct 2023 19:48:02 +1100 Subject: [PATCH 369/752] use some raw strings --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 55 +++++++++++--------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index b3e66cfe2..79c427e27 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -662,18 +662,21 @@ internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument d { var rootNode = OpenApiUrlTreeNode.Create(document, "main"); - writer.WriteLine(@" - - - - - - -"); + writer.WriteLine( + """ + + + + + + + + + """); writer.WriteLine("

" + document.Info.Title + "

"); writer.WriteLine(); writer.WriteLine($"

API Description: {sourceUrl}

"); @@ -684,6 +687,7 @@ internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument d { writer.WriteLine($"{style.Key.Replace("_", " ", StringComparison.OrdinalIgnoreCase)}"); } + writer.WriteLine("
"); writer.WriteLine("
"); writer.WriteLine(""); @@ -691,18 +695,21 @@ internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument d writer.WriteLine(""); // Write script tag to include JS library for rendering markdown - writer.WriteLine(@""); + writer.WriteLine( + """ + + """); // Write script tag to include JS library for rendering mermaid writer.WriteLine(" Date: Mon, 2 Oct 2023 20:01:24 +1100 Subject: [PATCH 370/752] remove some trailing whitespace --- src/Microsoft.OpenApi.Hidi/Extensions/CommandExtensions.cs | 2 +- .../Formatters/PowerShellFormatter.cs | 2 +- src/Microsoft.OpenApi.Hidi/Logger.cs | 2 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 6 +++--- src/Microsoft.OpenApi.Hidi/Options/FilterOptions.cs | 4 ++-- src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs | 2 +- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 2 +- src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs | 2 +- .../UtilityFiles/OpenApiDocumentMock.cs | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/CommandExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/CommandExtensions.cs index 9d5077432..5b83212d5 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/CommandExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/CommandExtensions.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. +// Licensed under the MIT license. using System.Collections.Generic; using System.CommandLine; diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index 4db55a05e..260119188 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -24,7 +24,7 @@ static PowerShellFormatter() { // Add singularization exclusions. // Enhancement: Read exclusions from a user provided file. - Vocabularies.Default.AddSingular("(drive)s$", "$1"); // drives does not properly singularize to drive. + Vocabularies.Default.AddSingular("(drive)s$", "$1"); // drives does not properly singularize to drive. Vocabularies.Default.AddSingular("(data)$", "$1"); // exclude the following from singularization. Vocabularies.Default.AddSingular("(delta)$", "$1"); Vocabularies.Default.AddSingular("(quota)$", "$1"); diff --git a/src/Microsoft.OpenApi.Hidi/Logger.cs b/src/Microsoft.OpenApi.Hidi/Logger.cs index 717ca1a41..dec4a5f8e 100644 --- a/src/Microsoft.OpenApi.Hidi/Logger.cs +++ b/src/Microsoft.OpenApi.Hidi/Logger.cs @@ -21,7 +21,7 @@ public static ILoggerFactory ConfigureLogger(LogLevel logLevel) { c.IncludeScopes = true; }) -#if DEBUG +#if DEBUG .AddDebug() #endif .SetMinimumLevel(logLevel); diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index d698bd5b2..fc70d409b 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -154,7 +154,7 @@ private static OpenApiDocument ApplyFilters(HidiOptions options, ILogger logger, requestUrls = EnumerateJsonDocument(postmanCollection.RootElement, new()); logger.LogTrace("Finished fetching the list of paths and Http methods defined in the Postman collection."); } - else + else { requestUrls = new(); logger.LogTrace("No filter options provided."); @@ -211,7 +211,7 @@ private static void WriteOpenApi(HidiOptions options, OpenApiFormat openApiForma } } - // Get OpenAPI document either from OpenAPI or CSDL + // Get OpenAPI document either from OpenAPI or CSDL private static async Task GetOpenApi(HidiOptions options, ILogger logger, CancellationToken cancellationToken, string? metadataVersion = null) { @@ -285,7 +285,7 @@ private static async Task GetOpenApi(HidiOptions options, ILogg private static Dictionary> GetRequestUrlsFromManifest(ApiDependency apiDependency) { - // Get the request URLs from the API Dependencies in the API manifest + // Get the request URLs from the API Dependencies in the API manifest var requests = apiDependency .Requests.Where(static r => !r.Exclude && !string.IsNullOrEmpty(r.UriTemplate) && !string.IsNullOrEmpty(r.Method)) .Select(static r => new { UriTemplate = r.UriTemplate!, Method = r.Method! }) diff --git a/src/Microsoft.OpenApi.Hidi/Options/FilterOptions.cs b/src/Microsoft.OpenApi.Hidi/Options/FilterOptions.cs index d82a064f7..1abf5a6bf 100644 --- a/src/Microsoft.OpenApi.Hidi/Options/FilterOptions.cs +++ b/src/Microsoft.OpenApi.Hidi/Options/FilterOptions.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. +// Licensed under the MIT license. namespace Microsoft.OpenApi.Hidi.Options { @@ -8,6 +8,6 @@ internal class FilterOptions public string? FilterByOperationIds { get; internal set; } public string? FilterByTags { get; internal set; } public string? FilterByCollection { get; internal set; } - public string? FilterByApiManifest { get; internal set; } + public string? FilterByApiManifest { get; internal set; } } } diff --git a/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs b/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs index 9f5a109f7..9b12b73f3 100644 --- a/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs +++ b/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. +// Licensed under the MIT license. using System.CommandLine.Parsing; using System.IO; diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index 871f88dca..b6af07778 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. +// Licensed under the MIT license. using System; using System.Collections.Generic; diff --git a/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs b/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs index 6264270a6..6ec32f488 100644 --- a/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs +++ b/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs @@ -1,5 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. +// Licensed under the MIT license. using Microsoft.Extensions.Configuration; using Microsoft.OpenApi.OData; diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 3fc77fc01..c6f33d6f5 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -203,7 +203,7 @@ public static OpenApiDocument CreateOpenApiDocument() Type = "string" } } - } + } }, ["/users"] = new OpenApiPathItem { From 59de387116a3eb23a5e28b29d22aa8f3e57df075 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Mon, 2 Oct 2023 20:09:00 +1100 Subject: [PATCH 371/752] . --- src/Microsoft.OpenApi.Hidi/Options/CommandOptions.cs | 2 +- .../Services/OpenApiFilterServiceTests.cs | 1 - .../Services/OpenApiServiceTests.cs | 9 +-------- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Options/CommandOptions.cs b/src/Microsoft.OpenApi.Hidi/Options/CommandOptions.cs index 735644970..6fee866cb 100644 --- a/src/Microsoft.OpenApi.Hidi/Options/CommandOptions.cs +++ b/src/Microsoft.OpenApi.Hidi/Options/CommandOptions.cs @@ -104,6 +104,6 @@ public IReadOnlyList
From 1532d68dce2edd0703028c852146d1e798d5449a Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Thu, 5 Oct 2023 21:48:25 +1100 Subject: [PATCH 382/752] simplify UtilityFiles with wildcards --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 32 +------------------ 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 1f2ec91e3..c39d2cae9 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -25,37 +25,7 @@
- - Always - - - - - - Always - - - Always - - - Always - - - Always - - - Always - - - PreserveNewest - - - Always - - - Always - - + Always From 9baaa79da37e2e475c6ea2c762aae3179bdc6d79 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Thu, 5 Oct 2023 21:51:41 +1100 Subject: [PATCH 383/752] Update Microsoft.OpenApi.Hidi.Tests.csproj --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index c39d2cae9..77c9b8001 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -28,6 +28,9 @@ Always + + Always + From 74c550d6b365bd8794b16c560048904b8239f9d6 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Thu, 5 Oct 2023 22:46:48 +1100 Subject: [PATCH 384/752] use some target typed new --- .../Formatters/PowerShellFormatter.cs | 6 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 16 +- .../Options/HidiOptions.cs | 2 +- .../Formatters/PowerShellFormatterTests.cs | 16 +- .../Services/OpenApiFilterServiceTests.cs | 2 +- .../Services/OpenApiServiceTests.cs | 10 +- .../UtilityFiles/OpenApiDocumentMock.cs | 172 +++++++++--------- 7 files changed, 112 insertions(+), 112 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index 183de1691..d473fcd58 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -163,10 +163,10 @@ private static IList ResolveFunctionParameters(IList options.TerseOutput ? new OpenApiJsonWriter(textWriter, settings, options.TerseOutput) : new OpenApiJsonWriter(textWriter, settings, false), + OpenApiFormat.Json => options.TerseOutput ? new(textWriter, settings, options.TerseOutput) : new OpenApiJsonWriter(textWriter, settings, false), OpenApiFormat.Yaml => new OpenApiYamlWriter(textWriter, settings), _ => throw new ArgumentException("Unknown format"), }; @@ -368,11 +368,11 @@ private static async Task ParseOpenApi(string openApiFile, bool inli { stopwatch.Start(); - result = await new OpenApiStreamReader(new OpenApiReaderSettings - { + result = await new OpenApiStreamReader(new() + { LoadExternalRefs = inlineExternal, BaseUrl = openApiFile.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? - new Uri(openApiFile) : + new(openApiFile) : new Uri("file://" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar) } ).ReadAsync(stream, cancellationToken).ConfigureAwait(false); @@ -459,7 +459,7 @@ private static Dictionary> EnumerateJsonDocument(JsonElemen } else { - paths.Add(path, new List {method}); + paths.Add(path, new() {method}); } } else @@ -741,7 +741,7 @@ internal static async Task PluginManifest(HidiOptions options, ILogger logger, C outputFolder.Create(); } // Write OpenAPI to Output folder - options.Output = new FileInfo(Path.Combine(options.OutputFolder, "openapi.json")); + options.Output = new(Path.Combine(options.OutputFolder, "openapi.json")); options.TerseOutput = true; WriteOpenApi(options, OpenApiFormat.Json, OpenApiSpecVersion.OpenApi3_0, document, logger); @@ -762,7 +762,7 @@ internal static async Task PluginManifest(HidiOptions options, ILogger logger, C // Write OpenAIPluginManifest to Output folder var manifestFile = new FileInfo(Path.Combine(options.OutputFolder, "ai-plugin.json")); using var file = new FileStream(manifestFile.FullName, FileMode.Create); - using var jsonWriter = new Utf8JsonWriter(file, new JsonWriterOptions { Indented = true }); + using var jsonWriter = new Utf8JsonWriter(file, new() { Indented = true }); manifest.Write(jsonWriter); await jsonWriter.FlushAsync(cancellationToken).ConfigureAwait(false); } diff --git a/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs b/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs index d2a2bfe40..fca97c87f 100644 --- a/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs +++ b/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs @@ -53,7 +53,7 @@ private void ParseHidiOptions(ParseResult parseResult, CommandOptions options) LogLevel = parseResult.GetValueForOption(options.LogLevelOption); InlineLocal = parseResult.GetValueForOption(options.InlineLocalOption); InlineExternal = parseResult.GetValueForOption(options.InlineExternalOption); - FilterOptions = new FilterOptions + FilterOptions = new() { FilterByOperationIds = parseResult.GetValueForOption(options.FilterByOperationIdsOption), FilterByTags = parseResult.GetValueForOption(options.FilterByTagsOption), diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index c261a8e46..a5bf74219 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -93,7 +93,7 @@ public void ResolveFunctionParameters() private static OpenApiDocument GetSampleOpenApiDocument() { - return new OpenApiDocument + return new() { Info = new() { Title = "Test", Version = "1.0" }, Servers = new List { new() { Url = "https://localhost/" } }, @@ -108,7 +108,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() OperationId = "Foo.GetFoo", Parameters = new List { - new OpenApiParameter + new() { Name = "ids", In = ParameterLocation.Query, @@ -118,10 +118,10 @@ private static OpenApiDocument GetSampleOpenApiDocument() "application/json", new OpenApiMediaType { - Schema = new OpenApiSchema + Schema = new() { Type = "array", - Items = new OpenApiSchema + Items = new() { Type = "string" } @@ -157,8 +157,8 @@ private static OpenApiDocument GetSampleOpenApiDocument() { AnyOf = new List { - new OpenApiSchema { Type = "number" }, - new OpenApiSchema { Type = "string" } + new() { Type = "number" }, + new() { Type = "string" } }, Format = "float", Nullable = true @@ -169,8 +169,8 @@ private static OpenApiDocument GetSampleOpenApiDocument() { OneOf = new List { - new OpenApiSchema { Type = "number", Format = "double" }, - new OpenApiSchema { Type = "string" } + new() { Type = "number", Format = "double" }, + new() { Type = "string" } } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 03c611583..0f353b326 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -19,7 +19,7 @@ public class OpenApiFilterServiceTests public OpenApiFilterServiceTests() { _openApiDocumentMock = OpenApiDocumentMock.CreateOpenApiDocument(); - _mockLogger = new Mock>(); + _mockLogger = new(); _logger = _mockLogger.Object; } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index d4e97ed9b..b2b6b6c9b 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -92,7 +92,7 @@ public void ShowCommandGeneratesMermaidDiagramAsMarkdown() { var openApiDoc = new OpenApiDocument { - Info = new OpenApiInfo + Info = new() { Title = "Test", Version = "1.0.0" @@ -113,7 +113,7 @@ public void ShowCommandGeneratesMermaidDiagramAsHtml() { var openApiDoc = new OpenApiDocument { - Info = new OpenApiInfo + Info = new() { Title = "Test", Version = "1.0.0" @@ -136,7 +136,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() var options = new HidiOptions { OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), - Output = new FileInfo("sample.md") + Output = new("sample.md") }; await OpenApiService.ShowOpenApiDocument(options, _logger); @@ -163,7 +163,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiag { Csdl = Path.Combine("UtilityFiles", "Todo.xml"), CsdlFilter = "todos", - Output = new FileInfo("sample.md") + Output = new("sample.md") }; // create a dummy ILogger instance for testing @@ -211,7 +211,7 @@ public async Task TransformCommandConvertsOpenApi() HidiOptions options = new HidiOptions { OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), - Output = new FileInfo("sample.json"), + Output = new("sample.json"), CleanOutput = true, TerseOutput = false, InlineLocal = false, diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 106509a3d..67b06f72a 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -22,21 +22,21 @@ public static OpenApiDocument CreateOpenApiDocument() var document = new OpenApiDocument { - Info = new OpenApiInfo + Info = new() { Title = "People", Version = "v1.0" }, Servers = new List { - new OpenApiServer + new() { Url = "https://graph.microsoft.com/v1.0" } }, - Paths = new OpenApiPaths + Paths = new() { - ["/"] = new OpenApiPathItem() // root path + ["/"] = new() // root path { Operations = new Dictionary { @@ -44,10 +44,10 @@ public static OpenApiDocument CreateOpenApiDocument() OperationType.Get, new OpenApiOperation { OperationId = "graphService.GetGraphService", - Responses = new OpenApiResponses + Responses = new() { { - "200",new OpenApiResponse + "200",new() { Description = "OK" } @@ -57,7 +57,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/reports/microsoft.graph.getTeamsUserActivityCounts(period={period})"] = new OpenApiPathItem + ["/reports/microsoft.graph.getTeamsUserActivityCounts(period={period})"] = new() { Operations = new Dictionary { @@ -67,7 +67,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag + new() { Name = "reports.Functions" } @@ -78,22 +78,22 @@ public static OpenApiDocument CreateOpenApiDocument() Parameters = new List { { - new OpenApiParameter + new() { Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new OpenApiSchema + Schema = new() { Type = "string" } } } }, - Responses = new OpenApiResponses + Responses = new() { { - "200", new OpenApiResponse + "200", new() { Description = "Success", Content = new Dictionary @@ -102,7 +102,7 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new OpenApiSchema + Schema = new() { Type = "array" } @@ -118,12 +118,12 @@ public static OpenApiDocument CreateOpenApiDocument() Parameters = new List { { - new OpenApiParameter + new() { Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new OpenApiSchema + Schema = new() { Type = "string" } @@ -131,7 +131,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/reports/microsoft.graph.getTeamsUserActivityUserDetail(date={date})"] = new OpenApiPathItem + ["/reports/microsoft.graph.getTeamsUserActivityUserDetail(date={date})"] = new() { Operations = new Dictionary { @@ -141,7 +141,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag + new() { Name = "reports.Functions" } @@ -152,22 +152,22 @@ public static OpenApiDocument CreateOpenApiDocument() Parameters = new List { { - new OpenApiParameter + new() { Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new OpenApiSchema + Schema = new() { Type = "string" } } } }, - Responses = new OpenApiResponses + Responses = new() { { - "200", new OpenApiResponse + "200", new() { Description = "Success", Content = new Dictionary @@ -176,7 +176,7 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new OpenApiSchema + Schema = new() { Type = "array" } @@ -191,19 +191,19 @@ public static OpenApiDocument CreateOpenApiDocument() }, Parameters = new List { - new OpenApiParameter + new() { Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new OpenApiSchema + Schema = new() { Type = "string" } } } }, - ["/users"] = new OpenApiPathItem + ["/users"] = new() { Operations = new Dictionary { @@ -213,7 +213,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag + new() { Name = "users.user" } @@ -221,10 +221,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, OperationId = "users.user.ListUser", Summary = "Get entities from users", - Responses = new OpenApiResponses + Responses = new() { { - "200", new OpenApiResponse + "200", new() { Description = "Retrieved entities", Content = new Dictionary @@ -233,7 +233,7 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new OpenApiSchema + Schema = new() { Title = "Collection of user", Type = "object", @@ -244,9 +244,9 @@ public static OpenApiDocument CreateOpenApiDocument() new OpenApiSchema { Type = "array", - Items = new OpenApiSchema + Items = new() { - Reference = new OpenApiReference + Reference = new() { Type = ReferenceType.Schema, Id = "microsoft.graph.user" @@ -266,7 +266,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/users/{user-id}"] = new OpenApiPathItem + ["/users/{user-id}"] = new() { Operations = new Dictionary { @@ -276,7 +276,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag + new() { Name = "users.user" } @@ -284,10 +284,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, OperationId = "users.user.GetUser", Summary = "Get entity from users by key", - Responses = new OpenApiResponses + Responses = new() { { - "200", new OpenApiResponse + "200", new() { Description = "Retrieved entity", Content = new Dictionary @@ -296,9 +296,9 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new OpenApiSchema + Schema = new() { - Reference = new OpenApiReference + Reference = new() { Type = ReferenceType.Schema, Id = "microsoft.graph.user" @@ -318,7 +318,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag + new() { Name = "users.user" } @@ -326,10 +326,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, OperationId = "users.user.UpdateUser", Summary = "Update entity in users", - Responses = new OpenApiResponses + Responses = new() { { - "204", new OpenApiResponse + "204", new() { Description = "Success" } @@ -339,7 +339,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/users/{user-id}/messages/{message-id}"] = new OpenApiPathItem + ["/users/{user-id}/messages/{message-id}"] = new() { Operations = new Dictionary { @@ -349,7 +349,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag + new() { Name = "users.message" } @@ -360,23 +360,23 @@ public static OpenApiDocument CreateOpenApiDocument() Description = "The messages in a mailbox or folder. Read-only. Nullable.", Parameters = new List { - new OpenApiParameter + new() { Name = "$select", In = ParameterLocation.Query, Required = true, Description = "Select properties to be returned", - Schema = new OpenApiSchema + Schema = new() { Type = "array" } // missing explode parameter } }, - Responses = new OpenApiResponses + Responses = new() { { - "200", new OpenApiResponse + "200", new() { Description = "Retrieved navigation property", Content = new Dictionary @@ -385,9 +385,9 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new OpenApiSchema + Schema = new() { - Reference = new OpenApiReference + Reference = new() { Type = ReferenceType.Schema, Id = "microsoft.graph.message" @@ -403,7 +403,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/administrativeUnits/{administrativeUnit-id}/microsoft.graph.restore"] = new OpenApiPathItem + ["/administrativeUnits/{administrativeUnit-id}/microsoft.graph.restore"] = new() { Operations = new Dictionary { @@ -413,7 +413,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag + new() { Name = "administrativeUnits.Actions" } @@ -424,23 +424,23 @@ public static OpenApiDocument CreateOpenApiDocument() Parameters = new List { { - new OpenApiParameter + new() { Name = "administrativeUnit-id", In = ParameterLocation.Path, Required = true, Description = "key: id of administrativeUnit", - Schema = new OpenApiSchema + Schema = new() { Type = "string" } } } }, - Responses = new OpenApiResponses + Responses = new() { { - "200", new OpenApiResponse + "200", new() { Description = "Success", Content = new Dictionary @@ -449,11 +449,11 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new OpenApiSchema + Schema = new() { AnyOf = new List { - new OpenApiSchema + new() { Type = "string" } @@ -470,7 +470,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/applications/{application-id}/logo"] = new OpenApiPathItem + ["/applications/{application-id}/logo"] = new() { Operations = new Dictionary { @@ -480,7 +480,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag + new() { Name = "applications.application" } @@ -488,10 +488,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, OperationId = "applications.application.UpdateLogo", Summary = "Update media content for application in applications", - Responses = new OpenApiResponses + Responses = new() { { - "204", new OpenApiResponse + "204", new() { Description = "Success" } @@ -501,7 +501,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/security/hostSecurityProfiles"] = new OpenApiPathItem + ["/security/hostSecurityProfiles"] = new() { Operations = new Dictionary { @@ -511,7 +511,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag + new() { Name = "security.hostSecurityProfile" } @@ -519,10 +519,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, OperationId = "security.ListHostSecurityProfiles", Summary = "Get hostSecurityProfiles from security", - Responses = new OpenApiResponses + Responses = new() { { - "200", new OpenApiResponse + "200", new() { Description = "Retrieved navigation property", Content = new Dictionary @@ -531,7 +531,7 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new OpenApiSchema + Schema = new() { Title = "Collection of hostSecurityProfile", Type = "object", @@ -542,9 +542,9 @@ public static OpenApiDocument CreateOpenApiDocument() new OpenApiSchema { Type = "array", - Items = new OpenApiSchema + Items = new() { - Reference = new OpenApiReference + Reference = new() { Type = ReferenceType.Schema, Id = "microsoft.graph.networkInterface" @@ -564,7 +564,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/communications/calls/{call-id}/microsoft.graph.keepAlive"] = new OpenApiPathItem + ["/communications/calls/{call-id}/microsoft.graph.keepAlive"] = new() { Operations = new Dictionary { @@ -574,7 +574,7 @@ public static OpenApiDocument CreateOpenApiDocument() Tags = new List { { - new OpenApiTag + new() { Name = "communications.Actions" } @@ -584,13 +584,13 @@ public static OpenApiDocument CreateOpenApiDocument() Summary = "Invoke action keepAlive", Parameters = new List { - new OpenApiParameter + new() { Name = "call-id", In = ParameterLocation.Path, Description = "key: id of call", Required = true, - Schema = new OpenApiSchema + Schema = new() { Type = "string" }, @@ -602,10 +602,10 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Responses = new OpenApiResponses + Responses = new() { { - "204", new OpenApiResponse + "204", new() { Description = "Success" } @@ -621,7 +621,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/groups/{group-id}/events/{event-id}/calendar/events/microsoft.graph.delta"] = new OpenApiPathItem + ["/groups/{group-id}/events/{event-id}/calendar/events/microsoft.graph.delta"] = new() { Operations = new Dictionary { @@ -630,7 +630,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Tags = new List { - new OpenApiTag + new() { Name = "groups.Functions" } @@ -639,13 +639,13 @@ public static OpenApiDocument CreateOpenApiDocument() Summary = "Invoke function delta", Parameters = new List { - new OpenApiParameter + new() { Name = "group-id", In = ParameterLocation.Path, Description = "key: id of group", Required = true, - Schema = new OpenApiSchema + Schema = new() { Type = "string" }, @@ -656,13 +656,13 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - new OpenApiParameter + new() { Name = "event-id", In = ParameterLocation.Path, Description = "key: id of event", Required = true, - Schema = new OpenApiSchema + Schema = new() { Type = "string" }, @@ -674,10 +674,10 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Responses = new OpenApiResponses + Responses = new() { { - "200", new OpenApiResponse + "200", new() { Description = "Success", Content = new Dictionary @@ -686,10 +686,10 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new OpenApiSchema + Schema = new() { Type = "array", - Reference = new OpenApiReference + Reference = new() { Type = ReferenceType.Schema, Id = "microsoft.graph.event" @@ -711,7 +711,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/applications/{application-id}/createdOnBehalfOf/$ref"] = new OpenApiPathItem + ["/applications/{application-id}/createdOnBehalfOf/$ref"] = new() { Operations = new Dictionary { @@ -720,7 +720,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Tags = new List { - new OpenApiTag + new() { Name = "applications.directoryObject" } @@ -732,7 +732,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Components = new OpenApiComponents + Components = new() { Schemas = new Dictionary { From 6fb82304380f34cb7a1fab5a2ec5c4c4b2a124a1 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sun, 8 Oct 2023 21:53:59 +1100 Subject: [PATCH 385/752] Update test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj Co-authored-by: Vincent Biret --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 77c9b8001..94593bafb 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -25,7 +25,7 @@ - + Always From 7965878fd78e747be076f7c4c5a02d3abb2200e4 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sun, 8 Oct 2023 22:14:37 +1100 Subject: [PATCH 386/752] use some pattern matching --- src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs b/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs index 95ffceeaa..174c9c93e 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs @@ -18,7 +18,7 @@ public static OpenApiSpecVersion TryParseOpenApiSpecVersion(string value) if (int.TryParse(res, out int result)) { - if (result >= 2 && result < 3) + if (result is >= 2 and < 3) { return OpenApiSpecVersion.OpenApi2_0; } From 02cce59145204f05e3fab91bdebd995140a2fed6 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sun, 8 Oct 2023 22:17:09 +1100 Subject: [PATCH 387/752] use some var --- .../Formatters/PowerShellFormatter.cs | 2 +- .../Handlers/PluginCommandHandler.cs | 4 ++-- .../Handlers/ShowCommandHandler.cs | 4 ++-- .../Handlers/TransformCommandHandler.cs | 4 ++-- .../Handlers/ValidateCommandHandler.cs | 4 ++-- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 18 +++++++++--------- .../OpenApiSpecVersionHelper.cs | 2 +- .../Services/OpenApiServiceTests.cs | 12 ++++++------ 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index d473fcd58..96d3cc17d 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -122,7 +122,7 @@ private static string SingularizeAndDeduplicateOperationId(IList operati var lastSegmentIndex = segmentsCount - 1; var singularizedSegments = new List(); - for (int x = 0; x < segmentsCount; x++) + for (var x = 0; x < segmentsCount; x++) { var segment = operationIdSegments[x].Singularize(inputIsKnownToBePlural: false); diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs index 2c7e921bb..bd240f00e 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs @@ -24,8 +24,8 @@ public int Invoke(InvocationContext context) } public async Task InvokeAsync(InvocationContext context) { - HidiOptions hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); - CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); + var hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); + var cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); using var loggerFactory = Logger.ConfigureLogger(hidiOptions.LogLevel); var logger = loggerFactory.CreateLogger(); diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs index 054912302..dc2f6d8c8 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs @@ -24,8 +24,8 @@ public int Invoke(InvocationContext context) } public async Task InvokeAsync(InvocationContext context) { - HidiOptions hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); - CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); + var hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); + var cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); using var loggerFactory = Logger.ConfigureLogger(hidiOptions.LogLevel); var logger = loggerFactory.CreateLogger(); diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs index 293fefec9..c9f46b7ee 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs @@ -24,8 +24,8 @@ public int Invoke(InvocationContext context) } public async Task InvokeAsync(InvocationContext context) { - HidiOptions hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); - CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); + var hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); + var cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); using var loggerFactory = Logger.ConfigureLogger(hidiOptions.LogLevel); var logger = loggerFactory.CreateLogger(); diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs index 4351a04cb..e0bfbf6b3 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs @@ -26,8 +26,8 @@ public int Invoke(InvocationContext context) } public async Task InvokeAsync(InvocationContext context) { - HidiOptions hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); - CancellationToken cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); + var hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); + var cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); using var loggerFactory = Logger.ConfigureLogger(hidiOptions.LogLevel); var logger = loggerFactory.CreateLogger(); try diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 22cf230a5..841dd5f20 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -66,8 +66,8 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l } // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion - OpenApiFormat openApiFormat = options.OpenApiFormat ?? (!string.IsNullOrEmpty(options.OpenApi) ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiFormat.Yaml); - OpenApiSpecVersion openApiVersion = options.Version != null ? TryParseOpenApiSpecVersion(options.Version) : OpenApiSpecVersion.OpenApi3_0; + var openApiFormat = options.OpenApiFormat ?? (!string.IsNullOrEmpty(options.OpenApi) ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiFormat.Yaml); + var openApiVersion = options.Version != null ? TryParseOpenApiSpecVersion(options.Version) : OpenApiSpecVersion.OpenApi3_0; // If ApiManifest is provided, set the referenced OpenAPI document var apiDependency = await FindApiDependency(options.FilterOptions.FilterByApiManifest, logger, cancellationToken).ConfigureAwait(false); @@ -85,7 +85,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l } // Load OpenAPI document - OpenApiDocument document = await GetOpenApi(options, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); + var document = await GetOpenApi(options, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); if (options.FilterOptions != null) { @@ -227,7 +227,7 @@ private static async Task GetOpenApi(HidiOptions options, ILogg Stream? filteredStream = null; if (!string.IsNullOrEmpty(options.CsdlFilter)) { - XslCompiledTransform transform = GetFilterTransform(); + var transform = GetFilterTransform(); filteredStream = ApplyFilterToCsdl(stream, options.CsdlFilter, transform); filteredStream.Position = 0; await stream.DisposeAsync().ConfigureAwait(false); @@ -299,7 +299,7 @@ private static Dictionary> GetRequestUrlsFromManifest(ApiDe private static XslCompiledTransform GetFilterTransform() { XslCompiledTransform transform = new(); - Assembly assembly = typeof(OpenApiService).GetTypeInfo().Assembly; + var assembly = typeof(OpenApiService).GetTypeInfo().Assembly; using var xslt = assembly.GetManifestResourceStream("Microsoft.OpenApi.Hidi.CsdlFilter.xslt") ?? throw new InvalidOperationException("Could not find the Microsoft.OpenApi.Hidi.CsdlFilter.xslt file in the assembly. Check build configuration."); using var streamReader = new StreamReader(xslt); using var textReader = new XmlTextReader(streamReader); @@ -310,7 +310,7 @@ private static XslCompiledTransform GetFilterTransform() private static Stream ApplyFilterToCsdl(Stream csdlStream, string entitySetOrSingleton, XslCompiledTransform transform) { using StreamReader inputReader = new(csdlStream, leaveOpen: true); - using XmlReader inputXmlReader = XmlReader.Create(inputReader); + using var inputXmlReader = XmlReader.Create(inputReader); MemoryStream filteredStream = new(); using StreamWriter writer = new(filteredStream, leaveOpen: true); XsltArgumentList args = new(); @@ -363,7 +363,7 @@ public static async Task ValidateOpenApiDocument( private static async Task ParseOpenApi(string openApiFile, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken = default) { ReadResult result; - Stopwatch stopwatch = Stopwatch.StartNew(); + var stopwatch = Stopwatch.StartNew(); using (logger.BeginScope("Parsing OpenAPI: {OpenApiFile}", openApiFile)) { stopwatch.Start(); @@ -398,7 +398,7 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl, stri var edmModel = CsdlReader.Parse(XElement.Parse(csdlText).CreateReader()); settings ??= SettingsUtilities.GetConfiguration(); - OpenApiDocument document = edmModel.ConvertToOpenApi(SettingsUtilities.GetOpenApiConvertSettings(settings, metadataVersion)); + var document = edmModel.ConvertToOpenApi(SettingsUtilities.GetOpenApiConvertSettings(settings, metadataVersion)); document = FixReferences(document); return document; @@ -725,7 +725,7 @@ internal static async Task PluginManifest(HidiOptions options, ILogger logger, C } // Load OpenAPI document - OpenApiDocument document = await GetOpenApi(options, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); + var document = await GetOpenApi(options, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs b/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs index 95ffceeaa..e7250fb82 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs @@ -16,7 +16,7 @@ public static OpenApiSpecVersion TryParseOpenApiSpecVersion(string value) } var res = value.Split('.', StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(); - if (int.TryParse(res, out int result)) + if (int.TryParse(res, out var result)) { if (result >= 2 && result < 3) { diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index b2b6b6c9b..f588e4838 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -208,7 +208,7 @@ public async Task ValidateCommandProcessesOpenApi() [Fact] public async Task TransformCommandConvertsOpenApi() { - HidiOptions options = new HidiOptions + var options = new HidiOptions { OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), Output = new("sample.json"), @@ -228,7 +228,7 @@ public async Task TransformCommandConvertsOpenApi() [Fact] public async Task TransformCommandConvertsOpenApiWithDefaultOutputName() { - HidiOptions options = new HidiOptions + var options = new HidiOptions { OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), CleanOutput = true, @@ -246,7 +246,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputName() [Fact] public async Task TransformCommandConvertsCsdlWithDefaultOutputName() { - HidiOptions options = new HidiOptions + var options = new HidiOptions { Csdl = Path.Combine("UtilityFiles", "Todo.xml"), CleanOutput = true, @@ -264,7 +264,7 @@ public async Task TransformCommandConvertsCsdlWithDefaultOutputName() [Fact] public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchFormat() { - HidiOptions options = new HidiOptions + var options = new HidiOptions { OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), CleanOutput = true, @@ -284,7 +284,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchF [Fact] public Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty() { - HidiOptions options = new HidiOptions + var options = new HidiOptions { CleanOutput = true, TerseOutput = false, @@ -299,7 +299,7 @@ public Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty() public async Task TransformToPowerShellCompliantOpenApi() { var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "examplepowershellsettings.json"); - HidiOptions options = new HidiOptions + var options = new HidiOptions { OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), CleanOutput = true, From b9c6ee3c37636ac1899cf89b03d237aa63727cc5 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sun, 8 Oct 2023 23:11:53 +1100 Subject: [PATCH 388/752] use some expression lambdas --- src/Microsoft.OpenApi.Hidi/Logger.cs | 5 +---- .../Services/OpenApiServiceTests.cs | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Logger.cs b/src/Microsoft.OpenApi.Hidi/Logger.cs index dec4a5f8e..2dd1a4ee3 100644 --- a/src/Microsoft.OpenApi.Hidi/Logger.cs +++ b/src/Microsoft.OpenApi.Hidi/Logger.cs @@ -17,10 +17,7 @@ public static ILoggerFactory ConfigureLogger(LogLevel logLevel) return LoggerFactory.Create((builder) => { builder - .AddSimpleConsole(c => - { - c.IncludeScopes = true; - }) + .AddSimpleConsole(c => c.IncludeScopes = true) #if DEBUG .AddDebug() #endif diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index b2b6b6c9b..5face8879 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -180,7 +180,6 @@ public Task ThrowIfOpenApiUrlIsNotProvidedWhenValidating() OpenApiService.ValidateOpenApiDocument("", _logger)); } - [Fact] public Task ThrowIfURLIsNotResolvableWhenValidating() { From 2e7a76cc1d474d8603a98afe67cf60dbc18d7002 Mon Sep 17 00:00:00 2001 From: Simon Cropp Date: Sun, 8 Oct 2023 23:13:32 +1100 Subject: [PATCH 389/752] remove redundant type specs --- src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs | 2 +- .../Services/OpenApiServiceTests.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs index 99208a1d4..3d6362084 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs @@ -40,7 +40,7 @@ public static IList SplitByChar(this string target, char separator) { return new List(); } - return target.Split(new char[] { separator }, StringSplitOptions.RemoveEmptyEntries).ToList(); + return target.Split(new[] { separator }, StringSplitOptions.RemoveEmptyEntries).ToList(); } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index b2b6b6c9b..fb451c1d8 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -322,7 +322,7 @@ public void InvokeTransformCommand() { var rootCommand = Program.CreateRootCommand(); var openapi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); - var args = new string[] { "transform", "-d", openapi, "-o", "sample.json", "--co" }; + var args = new[] { "transform", "-d", openapi, "-o", "sample.json", "--co" }; var parseResult = rootCommand.Parse(args); var handler = rootCommand.Subcommands.Where(c => c.Name == "transform").First().Handler; var context = new InvocationContext(parseResult); @@ -339,7 +339,7 @@ public void InvokeShowCommand() { var rootCommand = Program.CreateRootCommand(); var openApi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); - var args = new string[] { "show", "-d", openApi, "-o", "sample.md" }; + var args = new[] { "show", "-d", openApi, "-o", "sample.md" }; var parseResult = rootCommand.Parse(args); var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler; var context = new InvocationContext(parseResult); @@ -355,7 +355,7 @@ public void InvokePluginCommand() { var rootCommand = Program.CreateRootCommand(); var manifest = Path.Combine(".", "UtilityFiles", "exampleapimanifest.json"); - var args = new string[] { "plugin", "-m", manifest, "--of", AppDomain.CurrentDomain.BaseDirectory }; + var args = new[] { "plugin", "-m", manifest, "--of", AppDomain.CurrentDomain.BaseDirectory }; var parseResult = rootCommand.Parse(args); var handler = rootCommand.Subcommands.Where(c => c.Name == "plugin").First().Handler; var context = new InvocationContext(parseResult); From 84c08f02eb16ee12f7222547670c798902b0c3f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 21:25:47 +0000 Subject: [PATCH 390/752] Bump xunit from 2.5.1 to 2.5.2 Bumps [xunit](https://github.com/xunit/xunit) from 2.5.1 to 2.5.2. - [Commits](https://github.com/xunit/xunit/compare/2.5.1...2.5.2) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 1f2ec91e3..396d89f71 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From a9e712e0a4aca18471979966793fe3fca769c922 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 14 Oct 2023 16:08:25 +0000 Subject: [PATCH 391/752] Bump xunit.runner.visualstudio from 2.5.1 to 2.5.3 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.5.1 to 2.5.3. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.5.1...2.5.3) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 396d89f71..c9ca053f1 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From d7527458fbdae01c5c737f9f08a81f737b5d7bd9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 21:05:39 +0000 Subject: [PATCH 392/752] Bump xunit from 2.5.2 to 2.5.3 Bumps [xunit](https://github.com/xunit/xunit) from 2.5.2 to 2.5.3. - [Commits](https://github.com/xunit/xunit/compare/2.5.2...2.5.3) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index c9ca053f1..23a9f1698 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 4377638985aed77c7c3a2aa2cfb1925a2e5bf442 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 24 Oct 2023 15:35:57 -0400 Subject: [PATCH 393/752] - fixes filter for files copy --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 94593bafb..d5044b2cc 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -25,7 +25,7 @@ - + Always From b9dd0c0aa9539bb26037c337c67d226ffd2e2dcc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Oct 2023 21:16:16 +0000 Subject: [PATCH 394/752] Bump Microsoft.OpenApi.OData from 1.5.0-preview5 to 1.5.0-preview6 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.5.0-preview5 to 1.5.0-preview6. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 5ee796e07..3e9efd49c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From 5e0e5fcb03e11ab6ad6dd91429bcbb5f99dd0622 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 26 Oct 2023 21:14:11 +0000 Subject: [PATCH 395/752] Bump Microsoft.OpenApi.OData from 1.5.0-preview6 to 1.5.0-preview7 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.5.0-preview6 to 1.5.0-preview7. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 3e9efd49c..bf9808a8c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From 9b4540ca5d38176358489b66fa8dc31e41aeb8d1 Mon Sep 17 00:00:00 2001 From: Irvine Sunday <40403681+irvinesunday@users.noreply.github.com> Date: Fri, 27 Oct 2023 17:24:47 +0300 Subject: [PATCH 396/752] Bump up lib. versions (#1443) * Bump up Hidi version * Bump up lib versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index bf9808a8c..4e47d6e82 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.3.1 + 1.3.2 OpenAPI.NET CLI tool for slicing OpenAPI documents true From 9cdad53a18eab585949adc8d573d95fb6f040fb2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Nov 2023 21:28:48 +0000 Subject: [PATCH 397/752] Bump xunit from 2.5.3 to 2.6.0 Bumps [xunit](https://github.com/xunit/xunit) from 2.5.3 to 2.6.0. - [Commits](https://github.com/xunit/xunit/compare/2.5.3...2.6.0) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 5eb4506c9..7fb323891 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From fe3f0c26a1e0256993107faed29e77e34080ab81 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Nov 2023 21:30:43 +0000 Subject: [PATCH 398/752] Bump xunit from 2.6.0 to 2.6.1 Bumps [xunit](https://github.com/xunit/xunit) from 2.6.0 to 2.6.1. - [Commits](https://github.com/xunit/xunit/compare/2.6.0...2.6.1) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 7fb323891..0bb5cd269 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 15db50bc6c5e7c06ae47c1a6192e613573515fa5 Mon Sep 17 00:00:00 2001 From: Irvine Sunday <40403681+irvinesunday@users.noreply.github.com> Date: Mon, 6 Nov 2023 15:03:48 +0300 Subject: [PATCH 399/752] Update release notes (#1452) --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 4e47d6e82..7ac8ea3fb 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.3.2 + 1.3.3 OpenAPI.NET CLI tool for slicing OpenAPI documents true @@ -35,7 +35,7 @@ - + From 877c76061fe412deb7206b0459c90a942fde5de0 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 7 Nov 2023 11:06:36 +0300 Subject: [PATCH 400/752] Refactor parameter name --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 841dd5f20..a8740f91a 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -263,7 +263,7 @@ private static async Task GetOpenApi(HidiOptions options, ILogg if (!string.IsNullOrEmpty(filterByOperationIds)) { logger.LogTrace("Creating predicate based on the operationIds supplied."); - predicate = OpenApiFilterService.CreatePredicate(tags: filterByOperationIds); + predicate = OpenApiFilterService.CreatePredicate(operationIds: filterByOperationIds); } if (!string.IsNullOrEmpty(filterByTags)) From 8365d935a035f1b26e440a022da3f03ce72ac03b Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 7 Nov 2023 15:03:19 +0300 Subject: [PATCH 401/752] Bump hidi version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7ac8ea3fb..da7737088 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -1,4 +1,4 @@ - + Exe @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.3.3 + 1.3.4 OpenAPI.NET CLI tool for slicing OpenAPI documents true From 3ae9a1d19be9a230fc0a77048eaba791a437964c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Nov 2023 21:38:31 +0000 Subject: [PATCH 402/752] Bump Microsoft.NET.Test.Sdk from 17.7.2 to 17.8.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.7.2 to 17.8.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.7.2...v17.8.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 0bb5cd269..d9e049cb7 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -12,7 +12,7 @@ - + From b22a1692f8fc4e4f7d8d893644e61b69dd1a0a94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Nov 2023 21:52:22 +0000 Subject: [PATCH 403/752] Bump Microsoft.OpenApi.OData from 1.5.0-preview8 to 1.5.0-preview9 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.5.0-preview8 to 1.5.0-preview9. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index da7737088..c268fc475 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -1,4 +1,4 @@ - + Exe @@ -35,7 +35,7 @@ - + From 09750ceed236bbb0e7139519fdb5bf122a58c694 Mon Sep 17 00:00:00 2001 From: Irvine Sunday <40403681+irvinesunday@users.noreply.github.com> Date: Tue, 14 Nov 2023 12:28:44 +0300 Subject: [PATCH 404/752] Release Hidi to get access to new version of conversion lib. (#1460) --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c268fc475..e1ddeebb3 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.3.4 + 1.3.5 OpenAPI.NET CLI tool for slicing OpenAPI documents true From baac012926ad3e8e1905f5fb33c609806bd83795 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 21:57:35 +0000 Subject: [PATCH 405/752] Bump Microsoft.Extensions.Logging.Abstractions from 7.0.1 to 8.0.0 Bumps [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime) from 7.0.1 to 8.0.0. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v7.0.1...v8.0.0) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index e1ddeebb3..6ae810acf 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -30,7 +30,7 @@ - + From 0b0a448fd63c30f34c56d6a91cb373cfefc06079 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 22:17:59 +0000 Subject: [PATCH 406/752] Bump Microsoft.Extensions.Logging from 7.0.0 to 8.0.0 Bumps [Microsoft.Extensions.Logging](https://github.com/dotnet/runtime) from 7.0.0 to 8.0.0. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v7.0.0...v8.0.0) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 6ae810acf..49ce04b21 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,7 +29,7 @@ - + From 2dbcc2d1aa07028489bb78561e39457e37eb0304 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 01:18:05 +0000 Subject: [PATCH 407/752] Bump Microsoft.Extensions.Logging.Debug from 7.0.0 to 8.0.0 Bumps [Microsoft.Extensions.Logging.Debug](https://github.com/dotnet/runtime) from 7.0.0 to 8.0.0. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v7.0.0...v8.0.0) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Debug dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 49ce04b21..dee879e8a 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -32,7 +32,7 @@ - + From 5e6f4c877a9273a3891323b53650fc12845973b5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 01:21:39 +0000 Subject: [PATCH 408/752] Bump Microsoft.Extensions.Logging.Console from 7.0.0 to 8.0.0 Bumps [Microsoft.Extensions.Logging.Console](https://github.com/dotnet/runtime) from 7.0.0 to 8.0.0. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v7.0.0...v8.0.0) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Console dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index dee879e8a..620043d64 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -31,7 +31,7 @@ - + From 9fae0d7fa90ae517df75fc8dd60f88a310792677 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 21:12:39 +0000 Subject: [PATCH 409/752] Bump xunit.runner.visualstudio from 2.5.3 to 2.5.4 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.5.3 to 2.5.4. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.5.3...2.5.4) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index d9e049cb7..d4e045b01 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From abe467abfc724097a1a88263ae068c8c467258ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 21:51:54 +0000 Subject: [PATCH 410/752] Bump xunit from 2.6.1 to 2.6.2 Bumps [xunit](https://github.com/xunit/xunit) from 2.6.1 to 2.6.2. - [Commits](https://github.com/xunit/xunit/compare/2.6.1...2.6.2) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index d4e045b01..8ea740315 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From b1ff9d4378fd7c7f152c3c723f933e8c118f35d2 Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Tue, 21 Nov 2023 10:27:24 +0300 Subject: [PATCH 411/752] Fix tests --- .../Services/OpenApiFilterServiceTests.cs | 4 ++-- .../Services/OpenApiServiceTests.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 0f353b326..5fb1b15f9 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -35,7 +35,7 @@ public OpenApiFilterServiceTests() [InlineData(null, "users.user", 2)] [InlineData(null, "applications.application", 1)] [InlineData(null, "reports.Functions", 2)] - public void ReturnFilteredOpenApiDocumentBasedOnOperationIdsAndTags(string operationIds, string tags, int expectedPathCount) + public void ReturnFilteredOpenApiDocumentBasedOnOperationIdsAndTags(string? operationIds, string? tags, int expectedPathCount) { // Act var predicate = OpenApiFilterService.CreatePredicate(operationIds, tags); @@ -173,7 +173,7 @@ public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidArguments [Theory] [InlineData("reports.getTeamsUserActivityUserDetail-a3f1", null)] [InlineData(null, "reports.Functions")] - public void ReturnsPathParametersOnSlicingBasedOnOperationIdsOrTags(string operationIds, string tags) + public void ReturnsPathParametersOnSlicingBasedOnOperationIdsOrTags(string? operationIds, string? tags) { // Act var predicate = OpenApiFilterService.CreatePredicate(operationIds, tags); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 2844849e0..f7c5aab45 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -47,7 +47,7 @@ public async Task ReturnConvertedCSDLFile() [InlineData("Todos.Todo.UpdateTodo", null, 1)] [InlineData("Todos.Todo.ListTodo", null, 1)] [InlineData(null, "Todos.Todo", 5)] - public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string operationIds, string tags, int expectedPathCount) + public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string? operationIds, string? tags, int expectedPathCount) { // Arrange var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "Todo.xml"); @@ -68,7 +68,7 @@ public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocumen [Theory] [InlineData("UtilityFiles/appsettingstest.json")] [InlineData(null)] - public void ReturnOpenApiConvertSettingsWhenSettingsFileIsProvided(string filePath) + public void ReturnOpenApiConvertSettingsWhenSettingsFileIsProvided(string? filePath) { // Arrange var config = SettingsUtilities.GetConfiguration(filePath); From a11b813b7090ecc2cdfc0ee6aa83cc6d23e7f2d8 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 22 Nov 2023 19:43:33 +0300 Subject: [PATCH 412/752] Configure the settings file path to be relative to the current working directory --- .../Utilities/SettingsUtilities.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs b/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs index 6ec32f488..f6798287a 100644 --- a/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs +++ b/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.IO; using Microsoft.Extensions.Configuration; using Microsoft.OpenApi.OData; @@ -11,15 +12,19 @@ internal static class SettingsUtilities internal static IConfiguration GetConfiguration(string? settingsFile = null) { if (string.IsNullOrEmpty(settingsFile)) + { settingsFile = "appsettings.json"; + } + + var settingsFilePath = Path.Combine(Directory.GetCurrentDirectory(), settingsFile); IConfiguration config = new ConfigurationBuilder() - .AddJsonFile(settingsFile, true) - .Build(); + .AddJsonFile(settingsFilePath, true) + .Build(); return config; } - + internal static OpenApiConvertSettings GetOpenApiConvertSettings(IConfiguration config, string? metadataVersion) { if (config == null) { throw new System.ArgumentNullException(nameof(config)); } From f89608924eb6edfbb4f329b4c227e4efef127239 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 22 Nov 2023 19:53:03 +0300 Subject: [PATCH 413/752] Upgrade lib versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 620043d64..c5f3e09d0 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.3.5 + 1.3.6 OpenAPI.NET CLI tool for slicing OpenAPI documents true From 0ce0401fa140453d6e6ec979ac9189b10dc47dce Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Mon, 27 Nov 2023 14:57:19 +0300 Subject: [PATCH 414/752] Resolve merge conflicts; clean up code and refactoring --- .../Extensions/OpenApiExtensibleExtensions.cs | 4 +- .../Formatters/PowerShellFormatter.cs | 263 +++++++++++++----- .../Formatters/PowerShellFormatterTests.cs | 84 +++--- .../Services/OpenApiServiceTests.cs | 58 +--- 4 files changed, 234 insertions(+), 175 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs index faf03c3f0..ee57125dd 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs @@ -14,9 +14,9 @@ internal static class OpenApiExtensibleExtensions /// A value matching the provided extensionKey. Return null when extensionKey is not found. internal static string GetExtension(this IDictionary extensions, string extensionKey) { - if (extensions.TryGetValue(extensionKey, out var value) && value is OpenApiString castValue) + if (extensions.TryGetValue(extensionKey, out var value) && value is OpenApiAny castValue) { - return castValue.Value; + return castValue.Node.GetValue(); } return string.Empty; } diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index 96d3cc17d..b7fe664c1 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -4,10 +4,12 @@ using System.Text; using System.Text.RegularExpressions; using Humanizer; -using Humanizer.Inflections; +using Json.Schema; +using Json.Schema.OpenApi; using Microsoft.OpenApi.Hidi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; +using Microsoft.OpenApi.Extensions; namespace Microsoft.OpenApi.Hidi.Formatters { @@ -15,7 +17,7 @@ internal class PowerShellFormatter : OpenApiVisitorBase { private const string DefaultPutPrefix = ".Update"; private const string PowerShellPutPrefix = ".Set"; - private readonly Stack _schemaLoop = new(); + private readonly Stack _schemaLoop = new(); private static readonly Regex s_oDataCastRegex = new("(.*(?<=[a-z]))\\.(As(?=[A-Z]).*)", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); private static readonly Regex s_hashSuffixRegex = new(@"^[^-]+", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); private static readonly Regex s_oDataRefRegex = new("(?<=[a-z])Ref(?=[A-Z])", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); @@ -24,11 +26,11 @@ static PowerShellFormatter() { // Add singularization exclusions. // Enhancement: Read exclusions from a user provided file. - Vocabularies.Default.AddSingular("(drive)s$", "$1"); // drives does not properly singularize to drive. - Vocabularies.Default.AddSingular("(data)$", "$1"); // exclude the following from singularization. - Vocabularies.Default.AddSingular("(delta)$", "$1"); - Vocabularies.Default.AddSingular("(quota)$", "$1"); - Vocabularies.Default.AddSingular("(statistics)$", "$1"); + Humanizer.Inflections.Vocabularies.Default.AddSingular("(drive)s$", "$1"); // drives does not properly singularize to drive. + Humanizer.Inflections.Vocabularies.Default.AddSingular("(data)$", "$1"); // exclude the following from singularization. + Humanizer.Inflections.Vocabularies.Default.AddSingular("(delta)$", "$1"); + Humanizer.Inflections.Vocabularies.Default.AddSingular("(quota)$", "$1"); + Humanizer.Inflections.Vocabularies.Default.AddSingular("(statistics)$", "$1"); } //FHL task for PS @@ -41,13 +43,13 @@ static PowerShellFormatter() // 5. Fix anyOf and oneOf schema. // 6. Add AdditionalProperties to object schemas. - public override void Visit(OpenApiSchema schema) + public override void Visit(ref JsonSchema schema) { AddAdditionalPropertiesToSchema(schema); - ResolveAnyOfSchema(schema); - ResolveOneOfSchema(schema); + schema = ResolveAnyOfSchema(ref schema); + schema = ResolveOneOfSchema(ref schema); - base.Visit(schema); + base.Visit(ref schema); } public override void Visit(OpenApiPathItem pathItem) @@ -163,97 +165,228 @@ private static IList ResolveFunctionParameters(IList { { - "x-ms-docs-operation-type", new OpenApiString("function") + "x-ms-docs-operation-type", new OpenApiAny("function") } } } @@ -145,37 +143,21 @@ private static OpenApiDocument GetSampleOpenApiDocument() }, Components = new() { - Schemas = new Dictionary + Schemas = new Dictionary { - { "TestSchema", new OpenApiSchema - { - Type = "object", - Properties = new Dictionary - { - { - "averageAudioDegradation", new OpenApiSchema - { - AnyOf = new List - { - new() { Type = "number" }, - new() { Type = "string" } - }, - Format = "float", - Nullable = true - } - }, - { - "defaultPrice", new OpenApiSchema - { - OneOf = new List - { - new() { Type = "number", Format = "double" }, - new() { Type = "string" } - } - } - } - } - } + { "TestSchema", new JsonSchemaBuilder() + .Type(SchemaValueType.Object) + .Properties(("averageAudioDegradation", new JsonSchemaBuilder() + .AnyOf( + new JsonSchemaBuilder().Type(SchemaValueType.Number), + new JsonSchemaBuilder().Type(SchemaValueType.String)) + .Format("float") + .Nullable(true)), + + ("defaultPrice", new JsonSchemaBuilder() + .OneOf( + new JsonSchemaBuilder().Type(SchemaValueType.Number).Format("double"), + new JsonSchemaBuilder().Type(SchemaValueType.String)))) } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index f7c5aab45..56063130f 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -25,46 +25,7 @@ public OpenApiServiceTests() { _logger = new Logger(_loggerFactory); } - - [Fact] - public async Task ReturnConvertedCSDLFile() - { - // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "Todo.xml"); - var fileInput = new FileInfo(filePath); - var csdlStream = fileInput.OpenRead(); - // Act - var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream); - var expectedPathCount = 5; - - // Assert - Assert.NotNull(openApiDoc); - Assert.NotEmpty(openApiDoc.Paths); - Assert.Equal(expectedPathCount, openApiDoc.Paths.Count); - } - - [Theory] - [InlineData("Todos.Todo.UpdateTodo", null, 1)] - [InlineData("Todos.Todo.ListTodo", null, 1)] - [InlineData(null, "Todos.Todo", 5)] - public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocument(string? operationIds, string? tags, int expectedPathCount) - { - // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "Todo.xml"); - var fileInput = new FileInfo(filePath); - var csdlStream = fileInput.OpenRead(); - - // Act - var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream); - var predicate = OpenApiFilterService.CreatePredicate(operationIds, tags); - var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(openApiDoc, predicate); - - // Assert - Assert.NotNull(subsetOpenApiDocument); - Assert.NotEmpty(subsetOpenApiDocument.Paths); - Assert.Equal(expectedPathCount, subsetOpenApiDocument.Paths.Count); - } - + [Theory] [InlineData("UtilityFiles/appsettingstest.json")] [InlineData(null)] @@ -156,23 +117,6 @@ public async Task ShowCommandGeneratesMermaidHtmlFileWithMermaidDiagram() Assert.True(File.Exists(filePath)); } - [Fact] - public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiagram() - { - var options = new HidiOptions - { - Csdl = Path.Combine("UtilityFiles", "Todo.xml"), - CsdlFilter = "todos", - Output = new("sample.md") - }; - - // create a dummy ILogger instance for testing - await OpenApiService.ShowOpenApiDocument(options, _logger); - - var output = await File.ReadAllTextAsync(options.Output.FullName); - Assert.Contains("graph LR", output, StringComparison.Ordinal); - } - [Fact] public Task ThrowIfOpenApiUrlIsNotProvidedWhenValidating() { From 5d65193868f130ebcc6d1b7f52ad16971a9f1007 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Nov 2023 21:44:30 +0000 Subject: [PATCH 415/752] Bump Moq from 4.20.69 to 4.20.70 Bumps [Moq](https://github.com/moq/moq) from 4.20.69 to 4.20.70. - [Release notes](https://github.com/moq/moq/releases) - [Changelog](https://github.com/devlooped/moq/blob/main/CHANGELOG.md) - [Commits](https://github.com/moq/moq/compare/v4.20.69...v4.20.70) --- updated-dependencies: - dependency-name: Moq dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 8ea740315..4a5dd2ad2 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -13,7 +13,7 @@ - + From 9786ab2d44166b5cb444e81e043fdc744ca40845 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 29 Nov 2023 13:13:55 +0300 Subject: [PATCH 416/752] Clean up code and tests --- .../Services/OpenApiServiceTests.cs | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 56063130f..b06e38d3f 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -186,24 +186,6 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputName() Assert.NotEmpty(output); } - [Fact] - public async Task TransformCommandConvertsCsdlWithDefaultOutputName() - { - var options = new HidiOptions - { - Csdl = Path.Combine("UtilityFiles", "Todo.xml"), - CleanOutput = true, - TerseOutput = false, - InlineLocal = false, - InlineExternal = false, - }; - // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocument(options, _logger); - - var output = await File.ReadAllTextAsync("output.yml"); - Assert.NotEmpty(output); - } - [Fact] public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchFormat() { From 279c0972274a9acd6db59bce20ed3e5cc690c6be Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 30 Nov 2023 21:10:02 +0000 Subject: [PATCH 417/752] Bump Microsoft.OData.Edm from 7.18.0 to 7.19.0 Bumps Microsoft.OData.Edm from 7.18.0 to 7.19.0. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c5f3e09d0..85a6bafbb 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -34,7 +34,7 @@ - + From 3068d3ede1886ba9f147e45ae4a189c2b222ef02 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Thu, 7 Dec 2023 16:32:18 +0300 Subject: [PATCH 418/752] Refactor code to resolve Oneof and AnyOf schemas --- .../Formatters/PowerShellFormatter.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index b7fe664c1..aab3fb829 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -44,8 +44,8 @@ static PowerShellFormatter() // 6. Add AdditionalProperties to object schemas. public override void Visit(ref JsonSchema schema) - { - AddAdditionalPropertiesToSchema(schema); + { + AddAdditionalPropertiesToSchema(ref schema); schema = ResolveAnyOfSchema(ref schema); schema = ResolveOneOfSchema(ref schema); @@ -174,7 +174,7 @@ private static IList ResolveFunctionParameters(IList Date: Fri, 8 Dec 2023 21:35:22 +0000 Subject: [PATCH 419/752] Bump Microsoft.OpenApi.OData from 1.5.0-preview9 to 1.5.0 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.5.0-preview9 to 1.5.0. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 85a6bafbb..b41895ecc 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From 014bf9793c494a1c81c7c13b9d6720537debb6f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Dec 2023 22:18:45 +0000 Subject: [PATCH 420/752] Bump Microsoft.OData.Edm from 7.19.0 to 7.20.0 Bumps Microsoft.OData.Edm from 7.19.0 to 7.20.0. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b41895ecc..81aa85642 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -34,7 +34,7 @@ - + From 84c8d4df4d8636fe09c732b0cadc0339eab925a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 21:47:20 +0000 Subject: [PATCH 421/752] Bump xunit.runner.visualstudio from 2.5.4 to 2.5.5 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.5.4 to 2.5.5. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.5.4...2.5.5) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 4a5dd2ad2..e80e915d0 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From a0e127a09ac450c2861eec044ca97fb639e496e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 21:54:08 +0000 Subject: [PATCH 422/752] Bump xunit from 2.6.2 to 2.6.3 Bumps [xunit](https://github.com/xunit/xunit) from 2.6.2 to 2.6.3. - [Commits](https://github.com/xunit/xunit/compare/2.6.2...2.6.3) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index e80e915d0..6e0ca4ac2 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From f0847bbe506c5d506684150b547efbd9c8764a6b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 25 Dec 2023 21:57:55 +0000 Subject: [PATCH 423/752] Bump xunit.runner.visualstudio from 2.5.5 to 2.5.6 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.5.5 to 2.5.6. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.5.5...2.5.6) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 6e0ca4ac2..9c9b03df8 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From 2e0eb67ce64ab127d46bd4e2f9c3aa464d5a9186 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 26 Dec 2023 21:21:59 +0000 Subject: [PATCH 424/752] Bump xunit from 2.6.3 to 2.6.4 Bumps [xunit](https://github.com/xunit/xunit) from 2.6.3 to 2.6.4. - [Commits](https://github.com/xunit/xunit/compare/2.6.3...2.6.4) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 9c9b03df8..6cf6ac218 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 5564e0acc1d49d9bcce3a873639bb2b64a7bcb73 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 21:13:40 +0000 Subject: [PATCH 425/752] Bump xunit from 2.6.4 to 2.6.5 Bumps [xunit](https://github.com/xunit/xunit) from 2.6.4 to 2.6.5. - [Commits](https://github.com/xunit/xunit/compare/2.6.4...2.6.5) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 6cf6ac218..c5857909d 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 614e5777dda4488d184a9b42621ad0c68b7be14d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Jan 2024 21:38:25 +0000 Subject: [PATCH 426/752] Bump xunit from 2.6.5 to 2.6.6 Bumps [xunit](https://github.com/xunit/xunit) from 2.6.5 to 2.6.6. - [Commits](https://github.com/xunit/xunit/compare/2.6.5...2.6.6) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index c5857909d..a22b6a7da 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 3b2dcf6a6f3371fba0958c744cc04a8ea9e52d92 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Tue, 16 Jan 2024 10:58:47 +0300 Subject: [PATCH 427/752] Bump up conversion lib. --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 81aa85642..e0dc65be8 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From e19049c78d07c2a2288222c4315b1b34c6f9bd32 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 16 Jan 2024 17:54:27 +0300 Subject: [PATCH 428/752] Bump lib versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 81aa85642..7a9ba2aee 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.3.6 + 1.3.7 OpenAPI.NET CLI tool for slicing OpenAPI documents true From e39142ab1d7b08cf470233253f9406b1017b139e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Jan 2024 21:33:50 +0000 Subject: [PATCH 429/752] Bump Microsoft.OpenApi.OData from 1.6.0-preview.2 to 1.6.0-preview.3 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.6.0-preview.2 to 1.6.0-preview.3. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 84a64182b..505d50ef8 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From 8d2e63c50c7c83833f2fa226691f6a948bf85491 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Jan 2024 21:43:51 +0000 Subject: [PATCH 430/752] Bump Microsoft.OpenApi.OData from 1.6.0-preview.3 to 1.6.0-preview.4 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.6.0-preview.3 to 1.6.0-preview.4. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 505d50ef8..6b038a298 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From db65449c084466089aa13edff4ae815cbfb6d429 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Mon, 29 Jan 2024 11:08:15 +0300 Subject: [PATCH 431/752] Bump lib versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 6b038a298..70e04e54b 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -1,4 +1,4 @@ - + Exe @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.3.7 + 1.3.8 OpenAPI.NET CLI tool for slicing OpenAPI documents true From c48413cdd8ea565b7783e7c9343cea36626b5e03 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 31 Jan 2024 15:14:59 +0300 Subject: [PATCH 432/752] Migrate projects to .NET 8 --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- .../Microsoft.OpenApi.Hidi.Tests.csproj | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 81aa85642..09c79d070 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -1,8 +1,8 @@ - + Exe - net7.0 + net8.0 latest true true diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 6e0ca4ac2..638e05153 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -1,7 +1,7 @@ - + - net7.0 + net8.0 enable enable From 862a86181f4dfc82f3cb6d36f46e508d2b2c2915 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 31 Jan 2024 15:15:43 +0300 Subject: [PATCH 433/752] Use Count() for clarity and performance gain --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 5bd13f212..4abb2d5af 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -272,7 +272,7 @@ private static async Task GetOpenApi(HidiOptions options, ILogg predicate = OpenApiFilterService.CreatePredicate(tags: filterByTags); } - if (requestUrls.Any()) + if (requestUrls.Count != 0) { logger.LogTrace("Creating predicate based on the paths and Http methods defined in the Postman collection."); predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: document); From 7450d37664096902c81ee55d9d9ad61041f319b4 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 31 Jan 2024 15:16:53 +0300 Subject: [PATCH 434/752] Change return type from Stream to MemoryStream for improved performance --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 4abb2d5af..cb63e0ceb 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -307,7 +307,7 @@ private static XslCompiledTransform GetFilterTransform() return transform; } - private static Stream ApplyFilterToCsdl(Stream csdlStream, string entitySetOrSingleton, XslCompiledTransform transform) + private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySetOrSingleton, XslCompiledTransform transform) { using StreamReader inputReader = new(csdlStream, leaveOpen: true); using var inputXmlReader = XmlReader.Create(inputReader); From b51c0e36ab865c1f2839d3b04bf6c123e82ede88 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 31 Jan 2024 15:19:00 +0300 Subject: [PATCH 435/752] Use ArgumentNullException.ThrowIfNull() instead of explicitly throwing a new Exception instance --- src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs b/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs index f6798287a..2b2e8bfc5 100644 --- a/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs +++ b/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System; using System.IO; using Microsoft.Extensions.Configuration; using Microsoft.OpenApi.OData; @@ -27,7 +28,7 @@ internal static IConfiguration GetConfiguration(string? settingsFile = null) internal static OpenApiConvertSettings GetOpenApiConvertSettings(IConfiguration config, string? metadataVersion) { - if (config == null) { throw new System.ArgumentNullException(nameof(config)); } + ArgumentNullException.ThrowIfNull(config); var settings = new OpenApiConvertSettings(); if (!string.IsNullOrEmpty(metadataVersion)) settings.SemVerVersion = metadataVersion; From fa273fffaafd8c55c1024350b6961a5d4f86d8a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:04:53 +0000 Subject: [PATCH 436/752] Bump Microsoft.OpenApi.OData from 1.6.0-preview.4 to 1.6.0-preview.5 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.6.0-preview.4 to 1.6.0-preview.5. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 70e04e54b..175daa3f7 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From 3dc313375f7ed89ac72c0f7723e1a5551985ef18 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Mon, 5 Feb 2024 16:36:13 +0300 Subject: [PATCH 437/752] Update readme.md --- src/Microsoft.OpenApi.Hidi/readme.md | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md index 111ee704b..faa2c2244 100644 --- a/src/Microsoft.OpenApi.Hidi/readme.md +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -68,24 +68,28 @@ Used to convert file formats from JSON to YAML and vice versa and performs slici This command accepts the following parameters: • --openapi(-d) - OpenAPI description file path in the local filesystem or a valid URL hosted on a HTTPS server - • --csdl(-cs) - CSDL file path in the local filesystem or a valid URL hosted on a HTTPS server - • --csdlfilter(-csf) - a filter parameter that a user can use to select a subset of a large CSDL file. They do so by providing a comma delimited list of EntitySet and Singleton names that appear in the EntityContainer. - • --output(-o) - Output directory path for the transformed document - • --clean-ouput(-co) - an optional param that allows a user to overwrite an existing file. - • --version(-v) - OpenAPI specification version + • --csdl(--cs) - CSDL file path in the local filesystem or a valid URL hosted on a HTTPS server + • --csdlfilter(--csf) - a filter parameter that a user can use to select a subset of a large CSDL file. They do so by providing a comma delimited list of EntitySet and Singleton names that appear in the EntityContainer. + • --output(-o) - Output directory path for the transformed document. + • --output-folder(--of) - The output directory path for the generated files. + • --clean-ouput(--co) - an optional param that allows a user to overwrite an existing file. + • --version(-v) - OpenAPI specification version. + • --metadata-version(--mv) - Graph metadata version to use. • --format(-f) - File format - • --loglevel(-ll) - The log level to use when logging messages to the main output - • --inline(-i) - Inline $ref instances - • --resolveExternal(-ex) - Resolve external $refs - • --filterByOperationIds(-op) - Slice document based on OperationId(s) provided. Accepts a comma delimited list of operation ids. + • --terse-output(--to) - Produce terse json output + • --settings-path(--sp) - The configuration file with CSDL conversion settings. + • --loglevel(--ll) - The log level to use when logging messages to the main output + • --inline-local - Inline local $ref instances + • --inline-external(--ex) - Inline external $refs + • --filterByOperationIds(--op) - Slice document based on OperationId(s) provided. Accepts a comma delimited list of operation ids. • --filterByTags(-t) - Slice document based on tag(s) provided. Accepts a comma delimited list of tags. • --filterByCollection(-c) - Slices the OpenAPI document based on the Postman Collection file generated by Resource Explorer - • --filterByManifest (-m) - Slices the OpenAPI document based on the requests defined in the API Manifest file referenced by the provided URI. For API manifests with multiple API Dependenties, use a fragment identifier to select the desired one. e.g ./apimanifest.json#example + • --manifest (-m) - Slices the OpenAPI document based on the requests defined in the API Manifest file referenced by the provided URI. For API manifests with multiple API Dependenties, use a fragment identifier to select the desired one. e.g ./apimanifest.json#example **Examples:** 1. Filtering by OperationIds - hidi transform -d files\People.yml -f yaml -o files\People.yml -v OpenApi3_0 -op users_UpdateInsights -co + hidi transform -d files\People.yml -f yaml -o files\People.yml -v OpenApi3_0 --op users_UpdateInsights --co 2. Filtering by Postman collection hidi transform --openapi files\People.yml --format yaml --output files\People2.yml --version OpenApi3_0 --filterByCollection Graph-Collection-0017059134807617005.postman_collection.json @@ -94,7 +98,7 @@ This command accepts the following parameters: hidi transform --input Files/Todo.xml --output Files/Todo-subset.yml --format yaml --version OpenApi3_0 --filterByOperationIds Todos.Todo.UpdateTodo 4. CSDL Filtering by EntitySets and Singletons - hidi transform -cs dataverse.csdl --csdlFilter "appointments,opportunities" -o appointmentsAndOpportunities.yaml -ll trace + hidi transform --cs dataverse.csdl --csdlFilter "appointments,opportunities" -o appointmentsAndOpportunities.yaml --ll trace Run transform -h to see all the available usage options. From b78c940d48b75fa07456a9c85b0450eb088f14c4 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Mon, 5 Feb 2024 18:39:42 +0300 Subject: [PATCH 438/752] Adjust namespaces and usings --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index cb63e0ceb..93a8645e8 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -29,6 +29,7 @@ using Microsoft.OpenApi.Hidi.Utilities; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.OData; +using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Writers; From 38a36a1eaf89f889cbe8f85d22a8e2b537ffa194 Mon Sep 17 00:00:00 2001 From: Irvine Sunday <40403681+irvinesunday@users.noreply.github.com> Date: Mon, 5 Feb 2024 23:43:15 +0300 Subject: [PATCH 439/752] Bump conversion lib. (#1548) * Bump up OData lib. * Bump up hidi --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 175daa3f7..3d9f435ea 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.3.8 + 1.3.9 OpenAPI.NET CLI tool for slicing OpenAPI documents true @@ -35,7 +35,7 @@ - + From 790636003bed17ef9b238e5a3bf4fcd3926ddb8d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 21:08:50 +0000 Subject: [PATCH 440/752] Bump Microsoft.NET.Test.Sdk from 17.8.0 to 17.9.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.8.0 to 17.9.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.8.0...v17.9.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index a22b6a7da..fb9e6d148 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -12,7 +12,7 @@ - + From 00bc4b1b5015e764d021d2f1ef858a860d09c7f8 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 7 Feb 2024 10:36:00 +0300 Subject: [PATCH 441/752] Update command option description --- src/Microsoft.OpenApi.Hidi/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md index faa2c2244..8e89e2a87 100644 --- a/src/Microsoft.OpenApi.Hidi/readme.md +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -74,7 +74,7 @@ This command accepts the following parameters: • --output-folder(--of) - The output directory path for the generated files. • --clean-ouput(--co) - an optional param that allows a user to overwrite an existing file. • --version(-v) - OpenAPI specification version. - • --metadata-version(--mv) - Graph metadata version to use. + • --metadata-version(--mv) - the metadata version to use. • --format(-f) - File format • --terse-output(--to) - Produce terse json output • --settings-path(--sp) - The configuration file with CSDL conversion settings. From f33b1085ed001b6a8d62769f05eb83f1df8a2bf3 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Thu, 15 Feb 2024 16:55:58 +0300 Subject: [PATCH 442/752] Update hidi to use the Load/Parse methods --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 33 ++++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 93a8645e8..95513328f 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -19,6 +19,7 @@ using System.Xml.Xsl; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; using Microsoft.OData.Edm.Csdl; using Microsoft.OpenApi.ApiManifest; using Microsoft.OpenApi.ApiManifest.OpenAI; @@ -86,7 +87,8 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l } // Load OpenAPI document - var document = await GetOpenApi(options, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); + var format = OpenApiModelFactory.GetFormat(options.OpenApi); + var document = await GetOpenApi(options, format, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); if (options.FilterOptions != null) { @@ -213,7 +215,7 @@ private static void WriteOpenApi(HidiOptions options, OpenApiFormat openApiForma } // Get OpenAPI document either from OpenAPI or CSDL - private static async Task GetOpenApi(HidiOptions options, ILogger logger, string? metadataVersion = null, CancellationToken cancellationToken = default) + private static async Task GetOpenApi(HidiOptions options, string format, ILogger logger, string? metadataVersion = null, CancellationToken cancellationToken = default) { OpenApiDocument document; Stream stream; @@ -234,7 +236,7 @@ private static async Task GetOpenApi(HidiOptions options, ILogg await stream.DisposeAsync().ConfigureAwait(false); } - document = await ConvertCsdlToOpenApi(filteredStream ?? stream, metadataVersion, options.SettingsConfig, cancellationToken).ConfigureAwait(false); + document = await ConvertCsdlToOpenApi(filteredStream ?? stream, format, metadataVersion, options.SettingsConfig, cancellationToken).ConfigureAwait(false); stopwatch.Stop(); logger.LogTrace("{Timestamp}ms: Generated OpenAPI with {Paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } @@ -369,14 +371,16 @@ private static async Task ParseOpenApi(string openApiFile, bool inli { stopwatch.Start(); - result = await new OpenApiStreamReader(new() - { + var settings = new OpenApiReaderSettings + { LoadExternalRefs = inlineExternal, BaseUrl = openApiFile.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? new(openApiFile) : new Uri("file://" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar) - } - ).ReadAsync(stream, cancellationToken).ConfigureAwait(false); + }; + + var format = OpenApiModelFactory.GetFormat(openApiFile); + result = await OpenApiDocument.LoadAsync(stream, format, settings, cancellationToken).ConfigureAwait(false); logger.LogTrace("{Timestamp}ms: Completed parsing.", stopwatch.ElapsedMilliseconds); @@ -392,7 +396,7 @@ private static async Task ParseOpenApi(string openApiFile, bool inli /// /// The CSDL stream. /// An OpenAPI document. - public static async Task ConvertCsdlToOpenApi(Stream csdl, string? metadataVersion = null, IConfiguration? settings = null, CancellationToken token = default) + public static async Task ConvertCsdlToOpenApi(Stream csdl, string format, string? metadataVersion = null, IConfiguration? settings = null, CancellationToken token = default) { using var reader = new StreamReader(csdl); var csdlText = await reader.ReadToEndAsync(token).ConfigureAwait(false); @@ -400,7 +404,7 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl, stri settings ??= SettingsUtilities.GetConfiguration(); var document = edmModel.ConvertToOpenApi(SettingsUtilities.GetOpenApiConvertSettings(settings, metadataVersion)); - document = FixReferences(document); + document = FixReferences(document, format); return document; } @@ -410,14 +414,15 @@ public static async Task ConvertCsdlToOpenApi(Stream csdl, stri /// /// The converted OpenApiDocument. /// A valid OpenApiDocument instance. - public static OpenApiDocument FixReferences(OpenApiDocument document) + public static OpenApiDocument FixReferences(OpenApiDocument document, string format) { // This method is only needed because the output of ConvertToOpenApi isn't quite a valid OpenApiDocument instance. // So we write it out, and read it back in again to fix it up. var sb = new StringBuilder(); document.SerializeAsV3(new OpenApiYamlWriter(new StringWriter(sb))); - var doc = new OpenApiStringReader().Read(sb.ToString(), out _); + + var doc = OpenApiDocument.Parse(sb.ToString(), format).OpenApiDocument; return doc; } @@ -565,7 +570,8 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl throw new ArgumentException("Please input a file path or URL"); } - var document = await GetOpenApi(options, logger, null, cancellationToken).ConfigureAwait(false); + var format = OpenApiModelFactory.GetFormat(options.OpenApi); + var document = await GetOpenApi(options, format, logger, null, cancellationToken).ConfigureAwait(false); using (logger.BeginScope("Creating diagram")) { @@ -726,7 +732,8 @@ internal static async Task PluginManifest(HidiOptions options, ILogger logger, C } // Load OpenAPI document - var document = await GetOpenApi(options, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); + var format = OpenApiModelFactory.GetFormat(options.OpenApi); + var document = await GetOpenApi(options, format, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); From be31073a3466bd13bba5f53d98ca4aca24c0336c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 21:15:04 +0000 Subject: [PATCH 443/752] Bump xunit.runner.visualstudio from 2.5.6 to 2.5.7 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.5.6 to 2.5.7. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.5.6...2.5.7) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index fb9e6d148..99c4b2074 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From 132f0cac90a04f3e6ee78e3daa12f13fecb588f0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 17 Feb 2024 02:03:36 +0000 Subject: [PATCH 444/752] Bump xunit from 2.6.6 to 2.7.0 Bumps [xunit](https://github.com/xunit/xunit) from 2.6.6 to 2.7.0. - [Commits](https://github.com/xunit/xunit/compare/2.6.6...2.7.0) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 99c4b2074..6a000952a 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From a55d33dc533d0a51166d9f33361bbfdf514eba2d Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Mon, 19 Feb 2024 13:10:02 +0300 Subject: [PATCH 445/752] Fix failing tests --- .../Services/OpenApiServiceTests.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index b06e38d3f..4b61d3bd3 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -11,7 +11,8 @@ using Microsoft.OpenApi.Hidi.Utilities; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.OData; -using Microsoft.OpenApi.Services; +using Microsoft.OpenApi.Reader; +using Microsoft.OpenApi.Readers; using Xunit; namespace Microsoft.OpenApi.Hidi.Tests @@ -24,8 +25,11 @@ public sealed class OpenApiServiceTests : IDisposable public OpenApiServiceTests() { _logger = new Logger(_loggerFactory); + OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader()); + OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader()); + } - + [Theory] [InlineData("UtilityFiles/appsettingstest.json")] [InlineData(null)] From 68a633760d8cf088cf3bb303254c422a398e1653 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 20 Feb 2024 18:03:52 +0300 Subject: [PATCH 446/752] Auto-register the YamlReader in Hidi --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 95513328f..9adc4e2dc 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -40,6 +40,12 @@ namespace Microsoft.OpenApi.Hidi { internal static class OpenApiService { + static OpenApiService() + { + OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader()); + OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader()); + } + /// /// Implementation of the transform command /// From e5a10f4043be3e3810d29cc225cd4b45526e87ab Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 20 Feb 2024 18:04:08 +0300 Subject: [PATCH 447/752] Remove unnecessary usings --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 9adc4e2dc..fd8b53592 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -19,7 +19,6 @@ using System.Xml.Xsl; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; using Microsoft.OData.Edm.Csdl; using Microsoft.OpenApi.ApiManifest; using Microsoft.OpenApi.ApiManifest.OpenAI; From 68526b8856944907797ebfc88f5279d3e1236bfb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 21:35:31 +0000 Subject: [PATCH 448/752] Bump coverlet.collector from 6.0.0 to 6.0.1 Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 6.0.0 to 6.0.1. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.0...v6.0.1) --- updated-dependencies: - dependency-name: coverlet.collector dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 6a000952a..de8205ed7 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -16,7 +16,7 @@ - + From 8862e97a5e3cbee9f3002e5c2136ff93aa6e37a4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 23:41:39 +0000 Subject: [PATCH 449/752] Bump coverlet.msbuild from 6.0.0 to 6.0.1 Bumps [coverlet.msbuild](https://github.com/coverlet-coverage/coverlet) from 6.0.0 to 6.0.1. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.0...v6.0.1) --- updated-dependencies: - dependency-name: coverlet.msbuild dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index de8205ed7..8789f2769 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -11,7 +11,7 @@ - + From 967e3087ee405b9d24e14ffd64d086be116b3580 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 23 Feb 2024 21:54:32 +0000 Subject: [PATCH 450/752] Bump Microsoft.OpenApi.OData from 1.6.0-preview.7 to 1.6.0-preview.8 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.6.0-preview.7 to 1.6.0-preview.8. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 3d9f435ea..7e77ff6cd 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From 02f0b2af375e61a13cabb65523c32271b22af028 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 28 Feb 2024 15:11:26 +0300 Subject: [PATCH 451/752] If supplied, use the input OpenApi format as the output file extension, else default to the input file extension --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index fd8b53592..ad689ba18 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -59,7 +59,10 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l { if (options.Output == null) { - var inputExtension = GetInputPathExtension(options.OpenApi, options.Csdl); +#pragma warning disable CA1308 // Normalize strings to uppercase + var inputExtension = string.Concat(".", options.OpenApiFormat.GetDisplayName().ToLowerInvariant()) + ?? GetInputPathExtension(options.OpenApi, options.Csdl); +#pragma warning restore CA1308 // Normalize strings to uppercase options.Output = new($"./output{inputExtension}"); }; From 4693451bf4a0c6fd620027fac46deed7b3c2f67d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 21:59:08 +0000 Subject: [PATCH 452/752] Bump Microsoft.OpenApi.OData from 1.6.0-preview.8 to 1.6.0-preview.9 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.6.0-preview.8 to 1.6.0-preview.9. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7e77ff6cd..8a194697e 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From 79c0db563f2c1345757d39ec25f49720d9fa34d2 Mon Sep 17 00:00:00 2001 From: Irvine Sunday <40403681+irvinesunday@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:52:32 +0300 Subject: [PATCH 453/752] Bump Hidi (#1574) --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 8a194697e..18d066763 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -1,4 +1,4 @@ - + Exe @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.3.9 + 1.3.10 OpenAPI.NET CLI tool for slicing OpenAPI documents true From 4282d3ab7344e04a75ba469e2960490887c64fa1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Mar 2024 21:45:52 +0000 Subject: [PATCH 454/752] Bump Microsoft.OpenApi.OData from 1.6.0-preview.9 to 1.6.0-preview.10 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.6.0-preview.9 to 1.6.0-preview.10. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 18d066763..fec0ca12e 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From 4c34903408fecc73eb2d8081df1c9b1e59bad0a9 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 5 Mar 2024 08:04:36 -0500 Subject: [PATCH 455/752] - upgrades hidi to net 8 Signed-off-by: Vincent Biret --- Dockerfile | 6 +++--- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 ++-- src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs | 3 ++- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index e67c8c389..fd821e3e4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env WORKDIR /app COPY ./src ./hidi/src @@ -7,10 +7,10 @@ COPY ./README.md ./hidi/README.md WORKDIR /app/hidi RUN dotnet publish ./src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -c Release -FROM mcr.microsoft.com/dotnet/runtime:7.0 AS runtime +FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy-chiseled AS runtime WORKDIR /app -COPY --from=build-env /app/hidi/src/Microsoft.OpenApi.Hidi/bin/Release/net7.0 ./ +COPY --from=build-env /app/hidi/src/Microsoft.OpenApi.Hidi/bin/Release/net8.0 ./ VOLUME /app/output VOLUME /app/openapi.yml diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index fec0ca12e..a1270f0b3 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -2,7 +2,7 @@ Exe - net7.0 + net8.0 latest true true diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index a8740f91a..f33fc61da 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -272,7 +272,7 @@ private static async Task GetOpenApi(HidiOptions options, ILogg predicate = OpenApiFilterService.CreatePredicate(tags: filterByTags); } - if (requestUrls.Any()) + if (requestUrls.Count > 0) { logger.LogTrace("Creating predicate based on the paths and Http methods defined in the Postman collection."); predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: document); @@ -307,7 +307,7 @@ private static XslCompiledTransform GetFilterTransform() return transform; } - private static Stream ApplyFilterToCsdl(Stream csdlStream, string entitySetOrSingleton, XslCompiledTransform transform) + private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySetOrSingleton, XslCompiledTransform transform) { using StreamReader inputReader = new(csdlStream, leaveOpen: true); using var inputXmlReader = XmlReader.Create(inputReader); diff --git a/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs b/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs index f6798287a..2b2e8bfc5 100644 --- a/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs +++ b/src/Microsoft.OpenApi.Hidi/Utilities/SettingsUtilities.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System; using System.IO; using Microsoft.Extensions.Configuration; using Microsoft.OpenApi.OData; @@ -27,7 +28,7 @@ internal static IConfiguration GetConfiguration(string? settingsFile = null) internal static OpenApiConvertSettings GetOpenApiConvertSettings(IConfiguration config, string? metadataVersion) { - if (config == null) { throw new System.ArgumentNullException(nameof(config)); } + ArgumentNullException.ThrowIfNull(config); var settings = new OpenApiConvertSettings(); if (!string.IsNullOrEmpty(metadataVersion)) settings.SemVerVersion = metadataVersion; diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 8789f2769..d0cdadb50 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable From 36d951a32c62399045c3b1451a8476ed56c3f02f Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 5 Mar 2024 08:05:17 -0500 Subject: [PATCH 456/752] - bumps hidi patch version Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index a1270f0b3..18267295c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.3.10 + 1.4.0 OpenAPI.NET CLI tool for slicing OpenAPI documents true From 8ecd61e390a91eabc99edd9bfcb9c41b5c544a6f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Mar 2024 22:02:56 +0000 Subject: [PATCH 457/752] Bump Microsoft.Extensions.Logging.Abstractions from 8.0.0 to 8.0.1 Bumps [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v8.0.0...v8.0.1) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 18267295c..b0b7fd2e8 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -30,7 +30,7 @@ - + From 1479ca1f55ccae2b4b8bbcf509efc84108b2bb91 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Mar 2024 21:54:50 +0000 Subject: [PATCH 458/752] Bump coverlet.msbuild from 6.0.1 to 6.0.2 Bumps [coverlet.msbuild](https://github.com/coverlet-coverage/coverlet) from 6.0.1 to 6.0.2. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.1...v6.0.2) --- updated-dependencies: - dependency-name: coverlet.msbuild dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index d0cdadb50..866127241 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -11,7 +11,7 @@ - + From b446654876082240e03927088828f8bf79549848 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Mar 2024 06:20:50 +0000 Subject: [PATCH 459/752] Bump coverlet.collector from 6.0.1 to 6.0.2 Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 6.0.1 to 6.0.2. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.1...v6.0.2) --- updated-dependencies: - dependency-name: coverlet.collector dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 866127241..f7cc32948 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -16,7 +16,7 @@ - + From 23648ebd66fb7859fff7dad299fce6b7560a24fb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 18 Mar 2024 21:28:00 +0000 Subject: [PATCH 460/752] Bump Microsoft.OpenApi.OData from 1.6.0-preview.10 to 1.6.0 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.6.0-preview.10 to 1.6.0. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b0b7fd2e8..f677ff78f 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From 3a366ec884829f81c8cf586afb26bb30458489db Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 26 Mar 2024 10:55:29 +0300 Subject: [PATCH 461/752] Clean up tests --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index ad689ba18..519de3503 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -60,7 +60,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l if (options.Output == null) { #pragma warning disable CA1308 // Normalize strings to uppercase - var inputExtension = string.Concat(".", options.OpenApiFormat.GetDisplayName().ToLowerInvariant()) + var inputExtension = string.Concat(".", options.OpenApiFormat?.GetDisplayName().ToLowerInvariant()) ?? GetInputPathExtension(options.OpenApi, options.Csdl); #pragma warning restore CA1308 // Normalize strings to uppercase options.Output = new($"./output{inputExtension}"); From 8268fe2cb403249acd09e28640385bfe7a7d3b1b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 28 Mar 2024 21:10:33 +0000 Subject: [PATCH 462/752] Bump Microsoft.OpenApi.OData from 1.6.0 to 1.6.1 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.6.0 to 1.6.1. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index f677ff78f..c92107975 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From 534de7813230853bd367ac16cfb4c44309ed0e64 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 2 Apr 2024 11:53:04 +0300 Subject: [PATCH 463/752] Update output file extension and register the Yaml reader --- .../Services/OpenApiServiceTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 4b61d3bd3..4e75d23ea 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -206,7 +206,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchF // create a dummy ILogger instance for testing await OpenApiService.TransformOpenApiDocument(options, _logger); - var output = await File.ReadAllTextAsync("output.yml"); + var output = await File.ReadAllTextAsync("output.yaml"); Assert.NotEmpty(output); } @@ -242,7 +242,7 @@ public async Task TransformToPowerShellCompliantOpenApi() // create a dummy ILogger instance for testing await OpenApiService.TransformOpenApiDocument(options, _logger); - var output = await File.ReadAllTextAsync("output.yml"); + var output = await File.ReadAllTextAsync("output.yaml"); Assert.NotEmpty(output); } From 3c56bced51c373d0f5d7d059224301153823d0f4 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 2 Apr 2024 13:09:57 +0300 Subject: [PATCH 464/752] Clean up logic --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 519de3503..be97e8dc3 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -60,8 +60,10 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l if (options.Output == null) { #pragma warning disable CA1308 // Normalize strings to uppercase - var inputExtension = string.Concat(".", options.OpenApiFormat?.GetDisplayName().ToLowerInvariant()) - ?? GetInputPathExtension(options.OpenApi, options.Csdl); + var extension = options.OpenApiFormat?.GetDisplayName().ToLowerInvariant(); + var inputExtension = !string.IsNullOrEmpty(extension) ? string.Concat(".", extension) + : GetInputPathExtension(options.OpenApi, options.Csdl); + #pragma warning restore CA1308 // Normalize strings to uppercase options.Output = new($"./output{inputExtension}"); }; From 67cbed74ab05df7ecaa84d5ed251c3b318cb9b0f Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 2 Apr 2024 15:46:02 +0300 Subject: [PATCH 465/752] Clean up --- .../Services/OpenApiServiceTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 4e75d23ea..ad1c587f0 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -206,7 +206,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchF // create a dummy ILogger instance for testing await OpenApiService.TransformOpenApiDocument(options, _logger); - var output = await File.ReadAllTextAsync("output.yaml"); + var output = await File.ReadAllTextAsync("output.yml"); Assert.NotEmpty(output); } From dcb711a7622e2fe305c8d04d7280436fc37fa17a Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Wed, 3 Apr 2024 14:30:53 +0300 Subject: [PATCH 466/752] Bump Hidi version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c92107975..1bbf8e707 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.4.0 + 1.4.1 OpenAPI.NET CLI tool for slicing OpenAPI documents true From dc38ec2c3956f9460d8cde281fb7f31f0c9633f9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Apr 2024 21:27:22 +0000 Subject: [PATCH 467/752] Bump xunit.runner.visualstudio from 2.5.7 to 2.5.8 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.5.7 to 2.5.8. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.5.7...2.5.8) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index f7cc32948..161245650 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From 6e8d8a7d5b5d23ceeaa1439f51e4cf0390486388 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Apr 2024 22:17:16 +0000 Subject: [PATCH 468/752] Bump xunit from 2.7.0 to 2.7.1 Bumps [xunit](https://github.com/xunit/xunit) from 2.7.0 to 2.7.1. - [Commits](https://github.com/xunit/xunit/compare/2.7.0...2.7.1) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 161245650..e99962613 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 3471dbf0f61bcbdf48b84ffbb50bed0eba9c96c2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 17 Apr 2024 21:45:36 +0000 Subject: [PATCH 469/752] Bump Microsoft.OData.Edm from 7.20.0 to 7.21.0 Bumps Microsoft.OData.Edm from 7.20.0 to 7.21.0. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 1bbf8e707..a7a95ff10 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -34,7 +34,7 @@ - + From 21baae36a77f6a1871a9da3f3bf16b3395d1866b Mon Sep 17 00:00:00 2001 From: njaci1 Date: Mon, 22 Apr 2024 11:45:17 +0300 Subject: [PATCH 470/752] Update readme.md correct the CSDL to OpenAPI conversion example to use '--csdl' instead of '--input' --- src/Microsoft.OpenApi.Hidi/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md index 8e89e2a87..55986d14b 100644 --- a/src/Microsoft.OpenApi.Hidi/readme.md +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -95,7 +95,7 @@ This command accepts the following parameters: hidi transform --openapi files\People.yml --format yaml --output files\People2.yml --version OpenApi3_0 --filterByCollection Graph-Collection-0017059134807617005.postman_collection.json 3. CSDL--->OpenAPI conversion and filtering - hidi transform --input Files/Todo.xml --output Files/Todo-subset.yml --format yaml --version OpenApi3_0 --filterByOperationIds Todos.Todo.UpdateTodo + hidi transform --csdl Files/Todo.xml --output Files/Todo-subset.yml --format yaml --version OpenApi3_0 --filterByOperationIds Todos.Todo.UpdateTodo 4. CSDL Filtering by EntitySets and Singletons hidi transform --cs dataverse.csdl --csdlFilter "appointments,opportunities" -o appointmentsAndOpportunities.yaml --ll trace From 9b217377dc5d54ed4bae6f31f274d84f1fae2126 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Apr 2024 21:03:46 +0000 Subject: [PATCH 471/752] Bump Microsoft.OpenApi.OData from 1.6.1 to 1.6.2 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.6.1 to 1.6.2. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index a7a95ff10..1216c3f99 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From 54035d4f0c7271e748faa04395c10a03f304bfa9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 21:12:50 +0000 Subject: [PATCH 472/752] Bump xunit.runner.visualstudio from 2.5.8 to 2.8.0 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.5.8 to 2.8.0. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.5.8...2.8.0) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index e99962613..d171a1861 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From 2a33495a576e239302683b6fcf28c89b5f5aa056 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Apr 2024 21:13:11 +0000 Subject: [PATCH 473/752] Bump Microsoft.OpenApi.OData from 1.6.2 to 1.6.3 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 1.6.2 to 1.6.3. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 1216c3f99..8a95fd32e 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From 510a8645f78cd52abd3bcf4d3c354fb230caf657 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 30 Apr 2024 06:45:16 +0000 Subject: [PATCH 474/752] Bump xunit from 2.7.1 to 2.8.0 Bumps [xunit](https://github.com/xunit/xunit) from 2.7.1 to 2.8.0. - [Commits](https://github.com/xunit/xunit/compare/2.7.1...2.8.0) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index d171a1861..dcf427a28 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From fd536419224644df0cc7efc9f9bc43781286aa41 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 30 Apr 2024 13:42:13 +0300 Subject: [PATCH 475/752] Use the extension method from JsonSchema.NET to get a dicriminator object from the schema and serialize it --- src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index aab3fb829..d8b19f916 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -348,9 +348,9 @@ private static JsonSchema CopySchema(JsonSchema schema, JsonSchema newSchema) { schemaBuilder.MinProperties(minProperties); } - if (schema.GetDiscriminator() == null && newSchema.GetOpenApiDiscriminator() is { } discriminator) + if (schema.GetDiscriminator() == null && newSchema.GetDiscriminator() is { } discriminator) { - schemaBuilder.Discriminator(discriminator); + schemaBuilder.Discriminator(discriminator.PropertyName, discriminator.Mapping, discriminator.Extensions); } if (schema.GetOpenApiExternalDocs() == null && newSchema.GetOpenApiExternalDocs() is { } externalDocs) { From 4c066dc7ca80c0d5f384839183e0cf6e569b2a9c Mon Sep 17 00:00:00 2001 From: Millicent Achieng Date: Thu, 2 May 2024 15:09:22 +0300 Subject: [PATCH 476/752] Bump Hidi version (#1650) --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 8a95fd32e..ad1a75b10 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.4.1 + 1.4.2 OpenAPI.NET CLI tool for slicing OpenAPI documents true From 125dbd14756ac70be2e6759acece2eb473bfac0a Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Thu, 2 May 2024 15:10:30 +0300 Subject: [PATCH 477/752] Replace Enumerable methods with indexing --- src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index d8b19f916..3e46b4181 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -205,7 +205,7 @@ private void AddAdditionalPropertiesToSchema(ref JsonSchema schema) private static JsonSchema ResolveOneOfSchema(ref JsonSchema schema) { - if (schema.GetOneOf()?.FirstOrDefault() is {} newSchema) + if (schema.GetOneOf()?[0] is {} newSchema) { var schemaBuilder = BuildSchema(schema); schemaBuilder = schemaBuilder.Remove("oneOf"); @@ -219,7 +219,7 @@ private static JsonSchema ResolveOneOfSchema(ref JsonSchema schema) private static JsonSchema ResolveAnyOfSchema(ref JsonSchema schema) { - if (schema.GetAnyOf()?.FirstOrDefault() is {} newSchema) + if (schema.GetAnyOf()?[0] is {} newSchema) { var schemaBuilder = BuildSchema(schema); schemaBuilder = schemaBuilder.Remove("anyOf"); From 8a28af66fa64288e4da066ebd4dd58404e7dd3fa Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Thu, 2 May 2024 17:28:16 +0300 Subject: [PATCH 478/752] Revert code to fix failing tests --- src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index 3e46b4181..d8b19f916 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -205,7 +205,7 @@ private void AddAdditionalPropertiesToSchema(ref JsonSchema schema) private static JsonSchema ResolveOneOfSchema(ref JsonSchema schema) { - if (schema.GetOneOf()?[0] is {} newSchema) + if (schema.GetOneOf()?.FirstOrDefault() is {} newSchema) { var schemaBuilder = BuildSchema(schema); schemaBuilder = schemaBuilder.Remove("oneOf"); @@ -219,7 +219,7 @@ private static JsonSchema ResolveOneOfSchema(ref JsonSchema schema) private static JsonSchema ResolveAnyOfSchema(ref JsonSchema schema) { - if (schema.GetAnyOf()?[0] is {} newSchema) + if (schema.GetAnyOf()?.FirstOrDefault() is {} newSchema) { var schemaBuilder = BuildSchema(schema); schemaBuilder = schemaBuilder.Remove("anyOf"); From 4b3cdcaa1e292e4cc86addfbc0d57f92a062c3f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 May 2024 21:03:50 +0000 Subject: [PATCH 479/752] Bump Microsoft.OData.Edm from 7.21.0 to 7.21.1 Bumps Microsoft.OData.Edm from 7.21.0 to 7.21.1. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index ad1a75b10..53415504a 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -34,7 +34,7 @@ - + From cf248078eb39d9c270f46b17bd0ea11743ebf8cc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 May 2024 21:48:45 +0000 Subject: [PATCH 480/752] --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 53415504a..15a2fa267 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From 793adb7310764ff6d61d29d01fdefd61eedbcdcf Mon Sep 17 00:00:00 2001 From: Millicent Achieng Date: Wed, 22 May 2024 11:11:46 +0300 Subject: [PATCH 481/752] Bump Hidi version (#1670) --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 15a2fa267..c88c763eb 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.4.2 + 1.4.3 OpenAPI.NET CLI tool for slicing OpenAPI documents true From 49ffd09a0dbe9d57f46ba1715365dbb6b6cecd3a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 May 2024 22:01:35 +0000 Subject: [PATCH 482/752] Bump Microsoft.NET.Test.Sdk from 17.9.0 to 17.10.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.9.0 to 17.10.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.9.0...v17.10.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index dcf427a28..537b92145 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -12,7 +12,7 @@ - + From 2b6a5e61625aff28f2b45741b499d2bc062982a2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 May 2024 21:34:41 +0000 Subject: [PATCH 483/752] Bump Microsoft.OData.Edm from 7.21.1 to 7.21.2 Bumps Microsoft.OData.Edm from 7.21.1 to 7.21.2. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c88c763eb..56e14903d 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -34,7 +34,7 @@ - + From a4c9832cb2b88bf55648d08a91bead5bd82f56cc Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Mon, 27 May 2024 18:14:04 +0300 Subject: [PATCH 484/752] Bump hidi version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c88c763eb..efb722ba3 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.4.3 + 1.4.4 OpenAPI.NET CLI tool for slicing OpenAPI documents true From e87ae1a0c39f0d913d7bbef3c6d66cddfc2a3762 Mon Sep 17 00:00:00 2001 From: Millicent Achieng Date: Mon, 27 May 2024 18:27:26 +0300 Subject: [PATCH 485/752] Bump Microsoft.OpenApi.OData from 1.6.4 to 1.6.5 (#1675) --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 56e14903d..0380fcc2a 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From 587c5f1e7f22ef02b8a6c0dca0a883df90507bd5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 May 2024 21:07:53 +0000 Subject: [PATCH 486/752] Bump xunit.runner.visualstudio from 2.8.0 to 2.8.1 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.8.0 to 2.8.1. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.8.0...2.8.1) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 537b92145..618abe4b4 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From be52186624b4fc9d4dc5b63e5fe23b5d535c5420 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 May 2024 06:35:20 +0000 Subject: [PATCH 487/752] Bump xunit from 2.8.0 to 2.8.1 Bumps [xunit](https://github.com/xunit/xunit) from 2.8.0 to 2.8.1. - [Commits](https://github.com/xunit/xunit/compare/2.8.0...2.8.1) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 618abe4b4..cb5405b31 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 47761dd8b50d85bc939e110e18001f867e27d774 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Jun 2024 21:14:29 +0000 Subject: [PATCH 488/752] Bump Microsoft.OData.Edm from 7.21.2 to 7.21.3 Bumps Microsoft.OData.Edm from 7.21.2 to 7.21.3. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 3ef589659..1d869fab6 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -34,7 +34,7 @@ - + From e43d42a8480f870101ae85244a728ec23af8a4f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kurai=20Andr=C3=A1s?= Date: Fri, 7 Jun 2024 11:34:31 +0200 Subject: [PATCH 489/752] Return -1 exit code when the document is not valid --- .../Handlers/ValidateCommandHandler.cs | 4 +-- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 11 ++++++-- .../Services/OpenApiServiceTests.cs | 25 +++++++++++++++++++ .../UtilityFiles/InvalidSampleOpenApi.yml | 19 ++++++++++++++ 4 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/InvalidSampleOpenApi.yml diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs index e0bfbf6b3..4c14cbef6 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs @@ -33,8 +33,8 @@ public async Task InvokeAsync(InvocationContext context) try { if (hidiOptions.OpenApi is null) throw new InvalidOperationException("OpenApi file is required"); - await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false); - return 0; + var isValid = await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false); + return isValid is not false ? 0 : -1; } #if RELEASE #pragma warning disable CA1031 // Do not catch general exception types diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index f33fc61da..d3d3fdd8c 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -322,7 +322,8 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe /// /// Implementation of the validate command /// - public static async Task ValidateOpenApiDocument( + /// when valid, when invalid and when cancelled + public static async Task ValidateOpenApiDocument( string openApi, ILogger logger, CancellationToken cancellationToken = default) @@ -332,11 +333,13 @@ public static async Task ValidateOpenApiDocument( throw new ArgumentNullException(nameof(openApi)); } + ReadResult? result = null; + try { using var stream = await GetStream(openApi, logger, cancellationToken).ConfigureAwait(false); - var result = await ParseOpenApi(openApi, false, logger, stream, cancellationToken).ConfigureAwait(false); + result = await ParseOpenApi(openApi, false, logger, stream, cancellationToken).ConfigureAwait(false); using (logger.BeginScope("Calculating statistics")) { @@ -358,6 +361,10 @@ public static async Task ValidateOpenApiDocument( { throw new InvalidOperationException($"Could not validate the document, reason: {ex.Message}", ex); } + + if (result is null) return null; + + return result.OpenApiDiagnostic.Errors.Count == 0; } private static async Task ParseOpenApi(string openApiFile, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken = default) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index f7c5aab45..7314da8ab 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -203,6 +203,31 @@ public async Task ValidateCommandProcessesOpenApi() Assert.True(true); } + [Fact] + public async Task ValidFileReturnsTrue() + { + var isValid = await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger); + + Assert.True(isValid); + } + + [Fact] + public async Task InvalidFileReturnsFalse() + { + var isValid = await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "InvalidSampleOpenApi.yml"), _logger); + + Assert.False(isValid); + } + + [Fact] + public async Task CancellingValidationReturnsNull() + { + using var cts = new CancellationTokenSource(); + await cts.CancelAsync(); + var isValid = await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger, cts.Token); + + Assert.Null(isValid); + } [Fact] public async Task TransformCommandConvertsOpenApi() diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/InvalidSampleOpenApi.yml b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/InvalidSampleOpenApi.yml new file mode 100644 index 000000000..772214f5a --- /dev/null +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/InvalidSampleOpenApi.yml @@ -0,0 +1,19 @@ +openapi: 3.0.0 +info: + title: Sample OpenApi + version: 1.0.0 +paths: + /api/editresource: + get: + operationId: api.ListEditresource + patch: + operationId: api.UpdateEditresource + responses: + '200': + description: OK + /api/viewresource: + get: + operationId: api.ListViewresource + responses: + '200': + description: OK \ No newline at end of file From 259d49f9cbd4f247a8897b53133696cbf5ba7e2e Mon Sep 17 00:00:00 2001 From: Irvine Sunday <40403681+irvinesunday@users.noreply.github.com> Date: Tue, 11 Jun 2024 15:11:33 +0300 Subject: [PATCH 490/752] Update conversion lib. version (#1689) --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 1d869fab6..01e5c1427 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.4.4 + 1.4.5 OpenAPI.NET CLI tool for slicing OpenAPI documents true @@ -35,7 +35,7 @@ - + From be3c38d9626b3a8dfbfcccd1cfa33dfcc29f928a Mon Sep 17 00:00:00 2001 From: Irvine Sunday <40403681+irvinesunday@users.noreply.github.com> Date: Wed, 12 Jun 2024 15:13:18 +0300 Subject: [PATCH 491/752] Release Hidi and libs (#1690) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump Microsoft.Windows.Compatibility from 8.0.5 to 8.0.6 Bumps [Microsoft.Windows.Compatibility](https://github.com/dotnet/windowsdesktop) from 8.0.5 to 8.0.6. - [Release notes](https://github.com/dotnet/windowsdesktop/releases) - [Commits](https://github.com/dotnet/windowsdesktop/compare/v8.0.5...v8.0.6) --- updated-dependencies: - dependency-name: Microsoft.Windows.Compatibility dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump Microsoft.OData.Edm from 7.21.2 to 7.21.3 Bumps Microsoft.OData.Edm from 7.21.2 to 7.21.3. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Bump Verify.Xunit from 24.2.0 to 25.0.1 (#1685) Bumps [Verify.Xunit](https://github.com/VerifyTests/Verify) from 24.2.0 to 25.0.1. - [Release notes](https://github.com/VerifyTests/Verify/releases) - [Commits](https://github.com/VerifyTests/Verify/commits/25.0.1) --- updated-dependencies: - dependency-name: Verify.Xunit dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump docker/login-action from 3.1.0 to 3.2.0 (#1683) Bumps [docker/login-action](https://github.com/docker/login-action) from 3.1.0 to 3.2.0. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v3.1.0...v3.2.0) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Return -1 exit code when the document is not valid * Change to relative path in `Launch Hidi` task * Bump docker/build-push-action from 5.3.0 to 5.4.0 Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5.3.0 to 5.4.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v5.3.0...v5.4.0) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Update conversion lib. version (#1689) * Bump lib versions --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Vincent Biret Co-authored-by: Kurai András Co-authored-by: Maggie Kimani Co-authored-by: Andrew Omondi --- .../Handlers/ValidateCommandHandler.cs | 4 +-- .../Microsoft.OpenApi.Hidi.csproj | 6 ++--- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 11 ++++++-- .../Services/OpenApiServiceTests.cs | 25 +++++++++++++++++++ .../UtilityFiles/InvalidSampleOpenApi.yml | 19 ++++++++++++++ 5 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/InvalidSampleOpenApi.yml diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs index e0bfbf6b3..4c14cbef6 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs @@ -33,8 +33,8 @@ public async Task InvokeAsync(InvocationContext context) try { if (hidiOptions.OpenApi is null) throw new InvalidOperationException("OpenApi file is required"); - await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false); - return 0; + var isValid = await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false); + return isValid is not false ? 0 : -1; } #if RELEASE #pragma warning disable CA1031 // Do not catch general exception types diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 3ef589659..01e5c1427 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.4.4 + 1.4.5 OpenAPI.NET CLI tool for slicing OpenAPI documents true @@ -34,8 +34,8 @@ - - + + diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index f33fc61da..d3d3fdd8c 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -322,7 +322,8 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe /// /// Implementation of the validate command /// - public static async Task ValidateOpenApiDocument( + /// when valid, when invalid and when cancelled + public static async Task ValidateOpenApiDocument( string openApi, ILogger logger, CancellationToken cancellationToken = default) @@ -332,11 +333,13 @@ public static async Task ValidateOpenApiDocument( throw new ArgumentNullException(nameof(openApi)); } + ReadResult? result = null; + try { using var stream = await GetStream(openApi, logger, cancellationToken).ConfigureAwait(false); - var result = await ParseOpenApi(openApi, false, logger, stream, cancellationToken).ConfigureAwait(false); + result = await ParseOpenApi(openApi, false, logger, stream, cancellationToken).ConfigureAwait(false); using (logger.BeginScope("Calculating statistics")) { @@ -358,6 +361,10 @@ public static async Task ValidateOpenApiDocument( { throw new InvalidOperationException($"Could not validate the document, reason: {ex.Message}", ex); } + + if (result is null) return null; + + return result.OpenApiDiagnostic.Errors.Count == 0; } private static async Task ParseOpenApi(string openApiFile, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken = default) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index f7c5aab45..7314da8ab 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -203,6 +203,31 @@ public async Task ValidateCommandProcessesOpenApi() Assert.True(true); } + [Fact] + public async Task ValidFileReturnsTrue() + { + var isValid = await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger); + + Assert.True(isValid); + } + + [Fact] + public async Task InvalidFileReturnsFalse() + { + var isValid = await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "InvalidSampleOpenApi.yml"), _logger); + + Assert.False(isValid); + } + + [Fact] + public async Task CancellingValidationReturnsNull() + { + using var cts = new CancellationTokenSource(); + await cts.CancelAsync(); + var isValid = await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger, cts.Token); + + Assert.Null(isValid); + } [Fact] public async Task TransformCommandConvertsOpenApi() diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/InvalidSampleOpenApi.yml b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/InvalidSampleOpenApi.yml new file mode 100644 index 000000000..772214f5a --- /dev/null +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/InvalidSampleOpenApi.yml @@ -0,0 +1,19 @@ +openapi: 3.0.0 +info: + title: Sample OpenApi + version: 1.0.0 +paths: + /api/editresource: + get: + operationId: api.ListEditresource + patch: + operationId: api.UpdateEditresource + responses: + '200': + description: OK + /api/viewresource: + get: + operationId: api.ListViewresource + responses: + '200': + description: OK \ No newline at end of file From 5eb9c2026231ae43487314a97ef567cefa0a49b6 Mon Sep 17 00:00:00 2001 From: Irvine Sunday <40403681+irvinesunday@users.noreply.github.com> Date: Wed, 26 Jun 2024 16:49:21 +0300 Subject: [PATCH 492/752] Update conversion library version (#1702) --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 01e5c1427..7162a07e9 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.4.5 + 1.4.6 OpenAPI.NET CLI tool for slicing OpenAPI documents true @@ -35,7 +35,7 @@ - + From 3ce6580c1b4e61c36d30cf2338e71b3609159912 Mon Sep 17 00:00:00 2001 From: Irvine Sunday <40403681+irvinesunday@users.noreply.github.com> Date: Thu, 27 Jun 2024 10:22:00 +0300 Subject: [PATCH 493/752] Release Hidi and libs (#1690) (#1704) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Bump Microsoft.Windows.Compatibility from 8.0.5 to 8.0.6 Bumps [Microsoft.Windows.Compatibility](https://github.com/dotnet/windowsdesktop) from 8.0.5 to 8.0.6. - [Release notes](https://github.com/dotnet/windowsdesktop/releases) - [Commits](https://github.com/dotnet/windowsdesktop/compare/v8.0.5...v8.0.6) --- updated-dependencies: - dependency-name: Microsoft.Windows.Compatibility dependency-type: direct:production update-type: version-update:semver-patch ... * Bump Microsoft.OData.Edm from 7.21.2 to 7.21.3 Bumps Microsoft.OData.Edm from 7.21.2 to 7.21.3. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... * Bump Verify.Xunit from 24.2.0 to 25.0.1 (#1685) Bumps [Verify.Xunit](https://github.com/VerifyTests/Verify) from 24.2.0 to 25.0.1. - [Release notes](https://github.com/VerifyTests/Verify/releases) - [Commits](https://github.com/VerifyTests/Verify/commits/25.0.1) --- updated-dependencies: - dependency-name: Verify.Xunit dependency-type: direct:production update-type: version-update:semver-major ... * Bump docker/login-action from 3.1.0 to 3.2.0 (#1683) Bumps [docker/login-action](https://github.com/docker/login-action) from 3.1.0 to 3.2.0. - [Release notes](https://github.com/docker/login-action/releases) - [Commits](https://github.com/docker/login-action/compare/v3.1.0...v3.2.0) --- updated-dependencies: - dependency-name: docker/login-action dependency-type: direct:production update-type: version-update:semver-minor ... * Return -1 exit code when the document is not valid * Change to relative path in `Launch Hidi` task * Bump docker/build-push-action from 5.3.0 to 5.4.0 Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5.3.0 to 5.4.0. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/v5.3.0...v5.4.0) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... * Update conversion lib. version (#1689) * Bump lib versions --------- Signed-off-by: dependabot[bot] Co-authored-by: Vincent Biret Co-authored-by: Eastman Co-authored-by: Darrel Co-authored-by: Maggie Kimani Co-authored-by: Vincent Biret Co-authored-by: Millicent Achieng Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kurai András From 9992d31ceef37a34bbef5f6885f5c1261b94e2c1 Mon Sep 17 00:00:00 2001 From: HavenDV Date: Fri, 28 Jun 2024 00:21:33 +0400 Subject: [PATCH 494/752] feat: Added nullable enable to OpenApiComponents. --- .../Formatters/PowerShellFormatterTests.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 6bd55a4aa..33996f044 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -59,9 +59,9 @@ public void RemoveAnyOfAndOneOfFromSchema() var walker = new OpenApiWalker(powerShellFormatter); walker.Walk(openApiDocument); - var testSchema = openApiDocument.Components.Schemas["TestSchema"]; - var averageAudioDegradationProperty = testSchema.GetProperties()?.GetValueOrDefault("averageAudioDegradation"); - var defaultPriceProperty = testSchema.GetProperties()?.GetValueOrDefault("defaultPrice"); + var testSchema = openApiDocument.Components.Schemas?["TestSchema"]; + var averageAudioDegradationProperty = testSchema?.GetProperties()?.GetValueOrDefault("averageAudioDegradation"); + var defaultPriceProperty = testSchema?.GetProperties()?.GetValueOrDefault("defaultPrice"); // Assert Assert.Null(averageAudioDegradationProperty?.GetAnyOf()); @@ -71,7 +71,7 @@ public void RemoveAnyOfAndOneOfFromSchema() Assert.Null(defaultPriceProperty?.GetOneOf()); Assert.Equal(SchemaValueType.Number, defaultPriceProperty?.GetJsonType()); Assert.Equal("double", defaultPriceProperty?.GetFormat()?.Key); - Assert.NotNull(testSchema.GetAdditionalProperties()); + Assert.NotNull(testSchema?.GetAdditionalProperties()); } [Fact] From cf346e7a237ffe1adcacebf2589090527c955c49 Mon Sep 17 00:00:00 2001 From: HavenDV Date: Fri, 28 Jun 2024 00:38:28 +0400 Subject: [PATCH 495/752] feat: Added nullable enable to OpenApiDocument. --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 14 +++++++------- .../Formatters/PowerShellFormatterTests.cs | 4 ++-- .../Services/OpenApiFilterServiceTests.cs | 6 +++++- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index c4d34d4cf..ce4055df2 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -185,7 +185,7 @@ private static OpenApiDocument ApplyFilters(HidiOptions options, ILogger logger, stopwatch.Start(); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); stopwatch.Stop(); - logger.LogTrace("{Timestamp}ms: Creating filtered OpenApi document with {Paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); + logger.LogTrace("{Timestamp}ms: Creating filtered OpenApi document with {Paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths?.Count); } return document; @@ -248,7 +248,7 @@ private static async Task GetOpenApi(HidiOptions options, strin document = await ConvertCsdlToOpenApi(filteredStream ?? stream, format, metadataVersion, options.SettingsConfig, cancellationToken).ConfigureAwait(false); stopwatch.Stop(); - logger.LogTrace("{Timestamp}ms: Generated OpenAPI with {Paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); + logger.LogTrace("{Timestamp}ms: Generated OpenAPI with {Paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths?.Count); } } else if (!string.IsNullOrEmpty(options.OpenApi)) @@ -659,7 +659,7 @@ internal static void WriteTreeDocumentAsMarkdown(string openapiUrl, OpenApiDocum { var rootNode = OpenApiUrlTreeNode.Create(document, "main"); - writer.WriteLine("# " + document.Info.Title); + writer.WriteLine("# " + document.Info?.Title); writer.WriteLine(); writer.WriteLine("API Description: " + openapiUrl); @@ -695,7 +695,7 @@ internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument d """); - writer.WriteLine("

" + document.Info.Title + "

"); + writer.WriteLine("

" + document.Info?.Title + "

"); writer.WriteLine(); writer.WriteLine($"

API Description: {sourceUrl}

"); @@ -766,8 +766,8 @@ internal static async Task PluginManifest(HidiOptions options, ILogger logger, C // Create OpenAIPluginManifest from ApiDependency and OpenAPI document var manifest = new OpenAIPluginManifest { - NameForHuman = document.Info.Title, - DescriptionForHuman = document.Info.Description, + NameForHuman = document.Info?.Title, + DescriptionForHuman = document.Info?.Description, Api = new() { Type = "openapi", diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 33996f044..4a662be67 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -59,7 +59,7 @@ public void RemoveAnyOfAndOneOfFromSchema() var walker = new OpenApiWalker(powerShellFormatter); walker.Walk(openApiDocument); - var testSchema = openApiDocument.Components.Schemas?["TestSchema"]; + var testSchema = openApiDocument.Components?.Schemas?["TestSchema"]; var averageAudioDegradationProperty = testSchema?.GetProperties()?.GetValueOrDefault("averageAudioDegradation"); var defaultPriceProperty = testSchema?.GetProperties()?.GetValueOrDefault("defaultPrice"); @@ -85,7 +85,7 @@ public void ResolveFunctionParameters() var walker = new OpenApiWalker(powerShellFormatter); walker.Walk(openApiDocument); - var idsParameter = openApiDocument.Paths["/foo"].Operations[OperationType.Get].Parameters.Where(static p => p.Name == "ids").FirstOrDefault(); + var idsParameter = openApiDocument.Paths?["/foo"].Operations[OperationType.Get].Parameters.Where(static p => p.Name == "ids").FirstOrDefault(); // Assert Assert.Null(idsParameter?.Content); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 5fb1b15f9..02e6cedb0 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -43,6 +43,7 @@ public void ReturnFilteredOpenApiDocumentBasedOnOperationIdsAndTags(string? oper // Assert Assert.NotNull(subsetOpenApiDocument); + Assert.NotNull(subsetOpenApiDocument.Paths); Assert.NotEmpty(subsetOpenApiDocument.Paths); Assert.Equal(expectedPathCount, subsetOpenApiDocument.Paths.Count); } @@ -62,6 +63,7 @@ public void ReturnFilteredOpenApiDocumentBasedOnPostmanCollection() // Assert Assert.NotNull(subsetOpenApiDocument); + Assert.NotNull(subsetOpenApiDocument.Paths); Assert.NotEmpty(subsetOpenApiDocument.Paths); Assert.Equal(3, subsetOpenApiDocument.Paths.Count); } @@ -150,10 +152,11 @@ public void ContinueProcessingWhenUrlsInCollectionAreMissingFromSourceDocument() var pathCount = requestUrls.Count; var predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: _openApiDocumentMock); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(_openApiDocumentMock, predicate); - var subsetPathCount = subsetOpenApiDocument.Paths.Count; + var subsetPathCount = subsetOpenApiDocument.Paths?.Count; // Assert Assert.NotNull(subsetOpenApiDocument); + Assert.NotNull(subsetOpenApiDocument.Paths); Assert.NotEmpty(subsetOpenApiDocument.Paths); Assert.Equal(2, subsetPathCount); Assert.NotEqual(pathCount, subsetPathCount); @@ -180,6 +183,7 @@ public void ReturnsPathParametersOnSlicingBasedOnOperationIdsOrTags(string? oper var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(_openApiDocumentMock, predicate); // Assert + Assert.NotNull(subsetOpenApiDocument.Paths); foreach (var pathItem in subsetOpenApiDocument.Paths) { Assert.True(pathItem.Value.Parameters.Any()); From 4bf0309c766a19a63a7d8628c12fa39fb086d89d Mon Sep 17 00:00:00 2001 From: HavenDV Date: Fri, 28 Jun 2024 00:45:15 +0400 Subject: [PATCH 496/752] feat: Added nullable enable to OpenApiOperation. --- .../Formatters/PowerShellFormatter.cs | 9 +++++---- .../Formatters/PowerShellFormatterTests.cs | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index d8b19f916..5daa0c9b5 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -54,7 +54,8 @@ public override void Visit(ref JsonSchema schema) public override void Visit(OpenApiPathItem pathItem) { - if (pathItem.Operations.TryGetValue(OperationType.Put, out var value)) + if (pathItem.Operations.TryGetValue(OperationType.Put, out var value) && + value.OperationId != null) { var operationId = value.OperationId; pathItem.Operations[OperationType.Put].OperationId = ResolvePutOperationId(operationId); @@ -69,14 +70,14 @@ public override void Visit(OpenApiOperation operation) throw new ArgumentException($"OperationId is required {PathString}", nameof(operation)); var operationId = operation.OperationId; - var operationTypeExtension = operation.Extensions.GetExtension("x-ms-docs-operation-type"); + var operationTypeExtension = operation.Extensions?.GetExtension("x-ms-docs-operation-type"); if (operationTypeExtension.IsEquals("function")) - operation.Parameters = ResolveFunctionParameters(operation.Parameters); + operation.Parameters = ResolveFunctionParameters(operation.Parameters ?? new List()); // Order matters. Resolve operationId. operationId = RemoveHashSuffix(operationId); if (operationTypeExtension.IsEquals("action") || operationTypeExtension.IsEquals("function")) - operationId = RemoveKeyTypeSegment(operationId, operation.Parameters); + operationId = RemoveKeyTypeSegment(operationId, operation.Parameters ?? new List()); operationId = SingularizeAndDeduplicateOperationId(operationId.SplitByChar('.')); operationId = ResolveODataCastOperationId(operationId); operationId = ResolveByRefOperationId(operationId); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 4a662be67..81c1ca7a2 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -85,7 +85,7 @@ public void ResolveFunctionParameters() var walker = new OpenApiWalker(powerShellFormatter); walker.Walk(openApiDocument); - var idsParameter = openApiDocument.Paths?["/foo"].Operations[OperationType.Get].Parameters.Where(static p => p.Name == "ids").FirstOrDefault(); + var idsParameter = openApiDocument.Paths?["/foo"].Operations[OperationType.Get].Parameters?.Where(static p => p.Name == "ids").FirstOrDefault(); // Assert Assert.Null(idsParameter?.Content); From 7dcb5ba693d1deba032fa8b0033c348e6813cc76 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Jul 2024 09:13:01 +0300 Subject: [PATCH 497/752] Bump xunit.runner.visualstudio from 2.8.1 to 2.8.2 (#1723) Bumps xunit.runner.visualstudio from 2.8.1 to 2.8.2. --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index cb5405b31..18e41e947 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From 94eb5aec0c807f84fadc35f8c57faaeba40adc7c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Jul 2024 06:20:43 +0000 Subject: [PATCH 498/752] Bump xunit from 2.8.1 to 2.9.0 (#1722) Bumps xunit from 2.8.1 to 2.9.0. --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 18e41e947..cef3a9174 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From bd1e0b16a9c68db70d82601ebcb5f200974ffb01 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 16 Jul 2024 14:47:23 +0300 Subject: [PATCH 499/752] Update packages --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- .../Microsoft.OpenApi.Hidi.Tests.csproj | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 15aecc256..de24a5258 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -34,8 +34,8 @@ - - + + diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 53e97de59..729b39e68 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -12,10 +12,10 @@ - + - - + + From 2a0fe7cf33e19ab7ccc4eabc03cdbd73fa460673 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Canales=20Mart=C3=ADn?= Date: Thu, 18 Jul 2024 17:32:50 +0200 Subject: [PATCH 500/752] Create test for bug --- .../Services/OpenApiServiceTests.cs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 7314da8ab..e092a1c43 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -65,6 +65,46 @@ public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocumen Assert.Equal(expectedPathCount, subsetOpenApiDocument.Paths.Count); } + [Fact] + public void CreateFilteredDocumentOnMinimalOpenApi() + { + // Arrange + + // We create a minimal OpenApiDocument with a single path and operation. + var openApiDoc = new OpenApiDocument + { + Info = new() + { + Title = "Test", + Version = "1.0.0" + }, + Paths = new() + { + ["/test"] = new OpenApiPathItem() + { + Operations = new Dictionary + { + [OperationType.Get] = new OpenApiOperation() + } + } + } + }; + + // Act + var requestUrls = new Dictionary>() + { + { "/test", ["GET"] } + }; + var filterPredicate = OpenApiFilterService.CreatePredicate(null, null, requestUrls, openApiDoc); + var filteredDocument = OpenApiFilterService.CreateFilteredDocument(openApiDoc, filterPredicate); + + // Assert + Assert.NotNull(filteredDocument); + Assert.NotNull(filteredDocument.Paths); + Assert.Single(filteredDocument.Paths); + } + + [Theory] [InlineData("UtilityFiles/appsettingstest.json")] [InlineData(null)] From 2fc705f10dc7a4e4ff19c38c65e0ad26241dd0ce Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Wed, 24 Jul 2024 16:38:43 +0300 Subject: [PATCH 501/752] Bump up conversion lib version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7162a07e9..3cc86e833 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -35,7 +35,7 @@ - + From b039f1521b739ff60ddf54df5bd45905a2cb6162 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Wed, 24 Jul 2024 16:43:29 +0300 Subject: [PATCH 502/752] Bumps up hidi version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 3cc86e833..05293a686 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.4.6 + 1.4.7 OpenAPI.NET CLI tool for slicing OpenAPI documents true From fc7d9b9f4a67f67a417604006e5526fbfc0f4497 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Mon, 12 Aug 2024 16:53:05 +0300 Subject: [PATCH 503/752] Replace JsonSchema with OpenApiSchema --- .../Formatters/PowerShellFormatter.cs | 276 +++++------------- 1 file changed, 67 insertions(+), 209 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index d8b19f916..fbfb1b716 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -4,12 +4,10 @@ using System.Text; using System.Text.RegularExpressions; using Humanizer; -using Json.Schema; -using Json.Schema.OpenApi; +using Humanizer.Inflections; using Microsoft.OpenApi.Hidi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; -using Microsoft.OpenApi.Extensions; namespace Microsoft.OpenApi.Hidi.Formatters { @@ -17,7 +15,7 @@ internal class PowerShellFormatter : OpenApiVisitorBase { private const string DefaultPutPrefix = ".Update"; private const string PowerShellPutPrefix = ".Set"; - private readonly Stack _schemaLoop = new(); + private readonly Stack _schemaLoop = new(); private static readonly Regex s_oDataCastRegex = new("(.*(?<=[a-z]))\\.(As(?=[A-Z]).*)", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); private static readonly Regex s_hashSuffixRegex = new(@"^[^-]+", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); private static readonly Regex s_oDataRefRegex = new("(?<=[a-z])Ref(?=[A-Z])", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); @@ -26,11 +24,11 @@ static PowerShellFormatter() { // Add singularization exclusions. // Enhancement: Read exclusions from a user provided file. - Humanizer.Inflections.Vocabularies.Default.AddSingular("(drive)s$", "$1"); // drives does not properly singularize to drive. - Humanizer.Inflections.Vocabularies.Default.AddSingular("(data)$", "$1"); // exclude the following from singularization. - Humanizer.Inflections.Vocabularies.Default.AddSingular("(delta)$", "$1"); - Humanizer.Inflections.Vocabularies.Default.AddSingular("(quota)$", "$1"); - Humanizer.Inflections.Vocabularies.Default.AddSingular("(statistics)$", "$1"); + Vocabularies.Default.AddSingular("(drive)s$", "$1"); // drives does not properly singularize to drive. + Vocabularies.Default.AddSingular("(data)$", "$1"); // exclude the following from singularization. + Vocabularies.Default.AddSingular("(delta)$", "$1"); + Vocabularies.Default.AddSingular("(quota)$", "$1"); + Vocabularies.Default.AddSingular("(statistics)$", "$1"); } //FHL task for PS @@ -43,13 +41,13 @@ static PowerShellFormatter() // 5. Fix anyOf and oneOf schema. // 6. Add AdditionalProperties to object schemas. - public override void Visit(ref JsonSchema schema) - { - AddAdditionalPropertiesToSchema(ref schema); - schema = ResolveAnyOfSchema(ref schema); - schema = ResolveOneOfSchema(ref schema); + public override void Visit(OpenApiSchema schema) + { + AddAdditionalPropertiesToSchema(schema); + ResolveAnyOfSchema(schema); + ResolveOneOfSchema(schema); - base.Visit(ref schema); + base.Visit(schema); } public override void Visit(OpenApiPathItem pathItem) @@ -165,237 +163,97 @@ private static IList ResolveFunctionParameters(IList Date: Mon, 12 Aug 2024 21:49:49 +0000 Subject: [PATCH 504/752] Bump Microsoft.OData.Edm from 7.21.3 to 8.0.0 Bumps Microsoft.OData.Edm from 7.21.3 to 8.0.0. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 05293a686..ba264d9c4 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -34,7 +34,7 @@ - + From 4389ac63d291a4ed61e08a7883e36f4d37aabc76 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 13 Aug 2024 18:38:36 +0300 Subject: [PATCH 505/752] Code refactoring; replace JsonSchema with OpenApiSchema --- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index bc68746d9..b6af07778 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using Json.Schema; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; @@ -20,7 +19,7 @@ public override void Visit(OpenApiParameter parameter) public int SchemaCount { get; set; } - public override void Visit(ref JsonSchema schema) + public override void Visit(OpenApiSchema schema) { SchemaCount++; } From 8668af535af161d483d3c3d2418237d8af587e50 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 13 Aug 2024 18:39:32 +0300 Subject: [PATCH 506/752] Clean up tests --- .../Formatters/PowerShellFormatterTests.cs | 84 ++++--- .../UtilityFiles/OpenApiDocumentMock.cs | 208 +++++++++++++----- 2 files changed, 207 insertions(+), 85 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 6bd55a4aa..94f99a1d2 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -1,11 +1,9 @@ -using Json.Schema; -using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Hidi.Formatters; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; using Xunit; -using Microsoft.OpenApi.Extensions; namespace Microsoft.OpenApi.Hidi.Tests.Formatters { @@ -60,18 +58,18 @@ public void RemoveAnyOfAndOneOfFromSchema() walker.Walk(openApiDocument); var testSchema = openApiDocument.Components.Schemas["TestSchema"]; - var averageAudioDegradationProperty = testSchema.GetProperties()?.GetValueOrDefault("averageAudioDegradation"); - var defaultPriceProperty = testSchema.GetProperties()?.GetValueOrDefault("defaultPrice"); + var averageAudioDegradationProperty = testSchema.Properties["averageAudioDegradation"]; + var defaultPriceProperty = testSchema.Properties["defaultPrice"]; // Assert - Assert.Null(averageAudioDegradationProperty?.GetAnyOf()); - Assert.Equal(SchemaValueType.Number, averageAudioDegradationProperty?.GetJsonType()); - Assert.Equal("float", averageAudioDegradationProperty?.GetFormat()?.Key); - Assert.True(averageAudioDegradationProperty?.GetNullable()); - Assert.Null(defaultPriceProperty?.GetOneOf()); - Assert.Equal(SchemaValueType.Number, defaultPriceProperty?.GetJsonType()); - Assert.Equal("double", defaultPriceProperty?.GetFormat()?.Key); - Assert.NotNull(testSchema.GetAdditionalProperties()); + Assert.Null(averageAudioDegradationProperty.AnyOf); + Assert.Equal("number", averageAudioDegradationProperty.Type); + Assert.Equal("float", averageAudioDegradationProperty.Format); + Assert.True(averageAudioDegradationProperty.Nullable); + Assert.Null(defaultPriceProperty.OneOf); + Assert.Equal("number", defaultPriceProperty.Type); + Assert.Equal("double", defaultPriceProperty.Format); + Assert.NotNull(testSchema.AdditionalProperties); } [Fact] @@ -90,7 +88,7 @@ public void ResolveFunctionParameters() // Assert Assert.Null(idsParameter?.Content); Assert.NotNull(idsParameter?.Schema); - Assert.Equal(SchemaValueType.Array, idsParameter?.Schema.GetJsonType()); + Assert.Equal("array", idsParameter?.Schema.Type); } private static OpenApiDocument GetSampleOpenApiDocument() @@ -120,10 +118,14 @@ private static OpenApiDocument GetSampleOpenApiDocument() "application/json", new OpenApiMediaType { - Schema = new JsonSchemaBuilder() - .Type(SchemaValueType.Array) - .Items(new JsonSchemaBuilder() - .Type(SchemaValueType.String)) + Schema = new() + { + Type = "array", + Items = new() + { + Type = "string" + } + } } } } @@ -143,22 +145,38 @@ private static OpenApiDocument GetSampleOpenApiDocument() }, Components = new() { - Schemas = new Dictionary + Schemas = new Dictionary { - { "TestSchema", new JsonSchemaBuilder() - .Type(SchemaValueType.Object) - .Properties(("averageAudioDegradation", new JsonSchemaBuilder() - .AnyOf( - new JsonSchemaBuilder().Type(SchemaValueType.Number), - new JsonSchemaBuilder().Type(SchemaValueType.String)) - .Format("float") - .Nullable(true)), - - ("defaultPrice", new JsonSchemaBuilder() - .OneOf( - new JsonSchemaBuilder().Type(SchemaValueType.Number).Format("double"), - new JsonSchemaBuilder().Type(SchemaValueType.String)))) - } + { "TestSchema", new OpenApiSchema + { + Type = "object", + Properties = new Dictionary + { + { + "averageAudioDegradation", new OpenApiSchema + { + AnyOf = new List + { + new() { Type = "number" }, + new() { Type = "string" } + }, + Format = "float", + Nullable = true + } + }, + { + "defaultPrice", new OpenApiSchema + { + OneOf = new List + { + new() { Type = "number", Format = "double" }, + new() { Type = "string" } + } + } + } + } + } + } } } }; diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 65ef08628..98ed181f4 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -1,7 +1,6 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using Json.Schema; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; @@ -84,7 +83,10 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String) + Schema = new() + { + Type = "string" + } } } }, @@ -100,7 +102,10 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder().Type(SchemaValueType.Array) + Schema = new() + { + Type = "array" + } } } } @@ -118,7 +123,10 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String) + Schema = new() + { + Type = "string" + } } } } @@ -149,7 +157,10 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String) + Schema = new() + { + Type = "string" + } } } }, @@ -165,7 +176,10 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder().Type(SchemaValueType.Array) + Schema = new() + { + Type = "array" + } } } } @@ -182,7 +196,10 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String) + Schema = new() + { + Type = "string" + } } } }, @@ -216,17 +233,29 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder() - .Title("Collection of user") - .Type(SchemaValueType.Object) - .Properties(("value", - new JsonSchemaBuilder() - .Type(SchemaValueType.Array) - .Items(new JsonSchemaBuilder() - .Ref("microsoft.graph.user") - .Build()) - .Build())) - .Build() + Schema = new() + { + Title = "Collection of user", + Type = "object", + Properties = new Dictionary + { + { + "value", + new OpenApiSchema + { + Type = "array", + Items = new() + { + Reference = new() + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.user" + } + } + } + } + } + } } } } @@ -267,7 +296,14 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder().Ref("microsoft.graph.user").Build() + Schema = new() + { + Reference = new() + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.user" + } + } } } } @@ -330,7 +366,10 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Query, Required = true, Description = "Select properties to be returned", - Schema = new JsonSchemaBuilder().Type(SchemaValueType.Array).Build() + Schema = new() + { + Type = "array" + } // missing explode parameter } }, @@ -346,7 +385,14 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder().Ref("microsoft.graph.message").Build() + Schema = new() + { + Reference = new() + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.message" + } + } } } } @@ -384,7 +430,10 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Required = true, Description = "key: id of administrativeUnit", - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String).Build() + Schema = new() + { + Type = "string" + } } } }, @@ -400,12 +449,17 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder() - .AnyOf( - new JsonSchemaBuilder() - .Type(SchemaValueType.String) - .Build()) - .Build() + Schema = new() + { + AnyOf = new List + { + new() + { + Type = "string" + } + }, + Nullable = true + } } } } @@ -477,14 +531,29 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder() - .Title("Collection of hostSecurityProfile") - .Type(SchemaValueType.Object) - .Properties(("value1", - new JsonSchemaBuilder() - .Type(SchemaValueType.Array) - .Items(new JsonSchemaBuilder().Ref("microsoft.graph.networkInterface")))) - .Build() + Schema = new() + { + Title = "Collection of hostSecurityProfile", + Type = "object", + Properties = new Dictionary + { + { + "value", + new OpenApiSchema + { + Type = "array", + Items = new() + { + Reference = new() + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.networkInterface" + } + } + } + } + } + } } } } @@ -521,7 +590,10 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Description = "key: id of call", Required = true, - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String).Build(), + Schema = new() + { + Type = "string" + }, Extensions = new Dictionary { { @@ -573,8 +645,16 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Description = "key: id of group", Required = true, - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String).Build(), - Extensions = new Dictionary { { "x-ms-docs-key-type", new OpenApiAny("group") } } + Schema = new() + { + Type = "string" + }, + Extensions = new Dictionary + { + { + "x-ms-docs-key-type", new OpenApiAny("group") + } + } }, new() { @@ -582,8 +662,16 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Description = "key: id of event", Required = true, - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String).Build(), - Extensions = new Dictionary { { "x-ms-docs-key-type", new OpenApiAny("event") } } + Schema = new() + { + Type = "string" + }, + Extensions = new Dictionary + { + { + "x-ms-docs-key-type", new OpenApiAny("event") + } + } } }, Responses = new() @@ -598,7 +686,15 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder().Type(SchemaValueType.Array).Ref("microsoft.graph.event").Build() + Schema = new() + { + Type = "array", + Reference = new() + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.event" + } + } } } } @@ -638,17 +734,25 @@ public static OpenApiDocument CreateOpenApiDocument() }, Components = new() { - Schemas = new Dictionary + Schemas = new Dictionary { { - "microsoft.graph.networkInterface", new JsonSchemaBuilder() - .Title("networkInterface") - .Type(SchemaValueType.Object) - .Properties( - ("description", new JsonSchemaBuilder() - .Type(SchemaValueType.String) - .Description("Description of the NIC (e.g. Ethernet adapter, Wireless LAN adapter Local Area Connection <#>, etc.)."))) - .Build() + "microsoft.graph.networkInterface", new OpenApiSchema + { + Title = "networkInterface", + Type = "object", + Properties = new Dictionary + { + { + "description", new OpenApiSchema + { + Type = "string", + Description = "Description of the NIC (e.g. Ethernet adapter, Wireless LAN adapter Local Area Connection <#>, etc.).", + Nullable = true + } + } + } + } } } } From f6cd25bf884c875c69a4066188a2d930ec5a22df Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 08:50:55 +0300 Subject: [PATCH 507/752] Bump Newtonsoft.Json from 13.0.1 to 13.0.3 (#1782) Bumps Newtonsoft.Json from 13.0.1 to 13.0.3. --- updated-dependencies: - dependency-name: Newtonsoft.Json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index cef3a9174..c1147319f 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,6 +14,7 @@ + From 8177f2ff0e269ea0d5138c0ab5bca3e82eef3189 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 21:56:55 +0000 Subject: [PATCH 508/752] Bump Microsoft.OData.Edm from 8.0.0 to 8.0.1 Bumps Microsoft.OData.Edm from 8.0.0 to 8.0.1. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index ba264d9c4..e635fa5a3 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -34,7 +34,7 @@ - + From e39132a9a2c452fccb4e53063d82b023edadc520 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 13 Aug 2024 18:38:36 +0300 Subject: [PATCH 509/752] Code refactoring; replace JsonSchema with OpenApiSchema --- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index bc68746d9..b6af07778 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using Json.Schema; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; @@ -20,7 +19,7 @@ public override void Visit(OpenApiParameter parameter) public int SchemaCount { get; set; } - public override void Visit(ref JsonSchema schema) + public override void Visit(OpenApiSchema schema) { SchemaCount++; } From c36dccbc46030c2d025a97b6847e4c6cc76e024f Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 13 Aug 2024 18:39:32 +0300 Subject: [PATCH 510/752] Clean up tests --- .../Formatters/PowerShellFormatterTests.cs | 84 ++++--- .../UtilityFiles/OpenApiDocumentMock.cs | 208 +++++++++++++----- 2 files changed, 207 insertions(+), 85 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 6bd55a4aa..94f99a1d2 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -1,11 +1,9 @@ -using Json.Schema; -using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Hidi.Formatters; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; using Xunit; -using Microsoft.OpenApi.Extensions; namespace Microsoft.OpenApi.Hidi.Tests.Formatters { @@ -60,18 +58,18 @@ public void RemoveAnyOfAndOneOfFromSchema() walker.Walk(openApiDocument); var testSchema = openApiDocument.Components.Schemas["TestSchema"]; - var averageAudioDegradationProperty = testSchema.GetProperties()?.GetValueOrDefault("averageAudioDegradation"); - var defaultPriceProperty = testSchema.GetProperties()?.GetValueOrDefault("defaultPrice"); + var averageAudioDegradationProperty = testSchema.Properties["averageAudioDegradation"]; + var defaultPriceProperty = testSchema.Properties["defaultPrice"]; // Assert - Assert.Null(averageAudioDegradationProperty?.GetAnyOf()); - Assert.Equal(SchemaValueType.Number, averageAudioDegradationProperty?.GetJsonType()); - Assert.Equal("float", averageAudioDegradationProperty?.GetFormat()?.Key); - Assert.True(averageAudioDegradationProperty?.GetNullable()); - Assert.Null(defaultPriceProperty?.GetOneOf()); - Assert.Equal(SchemaValueType.Number, defaultPriceProperty?.GetJsonType()); - Assert.Equal("double", defaultPriceProperty?.GetFormat()?.Key); - Assert.NotNull(testSchema.GetAdditionalProperties()); + Assert.Null(averageAudioDegradationProperty.AnyOf); + Assert.Equal("number", averageAudioDegradationProperty.Type); + Assert.Equal("float", averageAudioDegradationProperty.Format); + Assert.True(averageAudioDegradationProperty.Nullable); + Assert.Null(defaultPriceProperty.OneOf); + Assert.Equal("number", defaultPriceProperty.Type); + Assert.Equal("double", defaultPriceProperty.Format); + Assert.NotNull(testSchema.AdditionalProperties); } [Fact] @@ -90,7 +88,7 @@ public void ResolveFunctionParameters() // Assert Assert.Null(idsParameter?.Content); Assert.NotNull(idsParameter?.Schema); - Assert.Equal(SchemaValueType.Array, idsParameter?.Schema.GetJsonType()); + Assert.Equal("array", idsParameter?.Schema.Type); } private static OpenApiDocument GetSampleOpenApiDocument() @@ -120,10 +118,14 @@ private static OpenApiDocument GetSampleOpenApiDocument() "application/json", new OpenApiMediaType { - Schema = new JsonSchemaBuilder() - .Type(SchemaValueType.Array) - .Items(new JsonSchemaBuilder() - .Type(SchemaValueType.String)) + Schema = new() + { + Type = "array", + Items = new() + { + Type = "string" + } + } } } } @@ -143,22 +145,38 @@ private static OpenApiDocument GetSampleOpenApiDocument() }, Components = new() { - Schemas = new Dictionary + Schemas = new Dictionary { - { "TestSchema", new JsonSchemaBuilder() - .Type(SchemaValueType.Object) - .Properties(("averageAudioDegradation", new JsonSchemaBuilder() - .AnyOf( - new JsonSchemaBuilder().Type(SchemaValueType.Number), - new JsonSchemaBuilder().Type(SchemaValueType.String)) - .Format("float") - .Nullable(true)), - - ("defaultPrice", new JsonSchemaBuilder() - .OneOf( - new JsonSchemaBuilder().Type(SchemaValueType.Number).Format("double"), - new JsonSchemaBuilder().Type(SchemaValueType.String)))) - } + { "TestSchema", new OpenApiSchema + { + Type = "object", + Properties = new Dictionary + { + { + "averageAudioDegradation", new OpenApiSchema + { + AnyOf = new List + { + new() { Type = "number" }, + new() { Type = "string" } + }, + Format = "float", + Nullable = true + } + }, + { + "defaultPrice", new OpenApiSchema + { + OneOf = new List + { + new() { Type = "number", Format = "double" }, + new() { Type = "string" } + } + } + } + } + } + } } } }; diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 65ef08628..98ed181f4 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -1,7 +1,6 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using Json.Schema; using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; @@ -84,7 +83,10 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String) + Schema = new() + { + Type = "string" + } } } }, @@ -100,7 +102,10 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder().Type(SchemaValueType.Array) + Schema = new() + { + Type = "array" + } } } } @@ -118,7 +123,10 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String) + Schema = new() + { + Type = "string" + } } } } @@ -149,7 +157,10 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String) + Schema = new() + { + Type = "string" + } } } }, @@ -165,7 +176,10 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder().Type(SchemaValueType.Array) + Schema = new() + { + Type = "array" + } } } } @@ -182,7 +196,10 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String) + Schema = new() + { + Type = "string" + } } } }, @@ -216,17 +233,29 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder() - .Title("Collection of user") - .Type(SchemaValueType.Object) - .Properties(("value", - new JsonSchemaBuilder() - .Type(SchemaValueType.Array) - .Items(new JsonSchemaBuilder() - .Ref("microsoft.graph.user") - .Build()) - .Build())) - .Build() + Schema = new() + { + Title = "Collection of user", + Type = "object", + Properties = new Dictionary + { + { + "value", + new OpenApiSchema + { + Type = "array", + Items = new() + { + Reference = new() + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.user" + } + } + } + } + } + } } } } @@ -267,7 +296,14 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder().Ref("microsoft.graph.user").Build() + Schema = new() + { + Reference = new() + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.user" + } + } } } } @@ -330,7 +366,10 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Query, Required = true, Description = "Select properties to be returned", - Schema = new JsonSchemaBuilder().Type(SchemaValueType.Array).Build() + Schema = new() + { + Type = "array" + } // missing explode parameter } }, @@ -346,7 +385,14 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder().Ref("microsoft.graph.message").Build() + Schema = new() + { + Reference = new() + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.message" + } + } } } } @@ -384,7 +430,10 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Required = true, Description = "key: id of administrativeUnit", - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String).Build() + Schema = new() + { + Type = "string" + } } } }, @@ -400,12 +449,17 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder() - .AnyOf( - new JsonSchemaBuilder() - .Type(SchemaValueType.String) - .Build()) - .Build() + Schema = new() + { + AnyOf = new List + { + new() + { + Type = "string" + } + }, + Nullable = true + } } } } @@ -477,14 +531,29 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder() - .Title("Collection of hostSecurityProfile") - .Type(SchemaValueType.Object) - .Properties(("value1", - new JsonSchemaBuilder() - .Type(SchemaValueType.Array) - .Items(new JsonSchemaBuilder().Ref("microsoft.graph.networkInterface")))) - .Build() + Schema = new() + { + Title = "Collection of hostSecurityProfile", + Type = "object", + Properties = new Dictionary + { + { + "value", + new OpenApiSchema + { + Type = "array", + Items = new() + { + Reference = new() + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.networkInterface" + } + } + } + } + } + } } } } @@ -521,7 +590,10 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Description = "key: id of call", Required = true, - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String).Build(), + Schema = new() + { + Type = "string" + }, Extensions = new Dictionary { { @@ -573,8 +645,16 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Description = "key: id of group", Required = true, - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String).Build(), - Extensions = new Dictionary { { "x-ms-docs-key-type", new OpenApiAny("group") } } + Schema = new() + { + Type = "string" + }, + Extensions = new Dictionary + { + { + "x-ms-docs-key-type", new OpenApiAny("group") + } + } }, new() { @@ -582,8 +662,16 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Description = "key: id of event", Required = true, - Schema = new JsonSchemaBuilder().Type(SchemaValueType.String).Build(), - Extensions = new Dictionary { { "x-ms-docs-key-type", new OpenApiAny("event") } } + Schema = new() + { + Type = "string" + }, + Extensions = new Dictionary + { + { + "x-ms-docs-key-type", new OpenApiAny("event") + } + } } }, Responses = new() @@ -598,7 +686,15 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new JsonSchemaBuilder().Type(SchemaValueType.Array).Ref("microsoft.graph.event").Build() + Schema = new() + { + Type = "array", + Reference = new() + { + Type = ReferenceType.Schema, + Id = "microsoft.graph.event" + } + } } } } @@ -638,17 +734,25 @@ public static OpenApiDocument CreateOpenApiDocument() }, Components = new() { - Schemas = new Dictionary + Schemas = new Dictionary { { - "microsoft.graph.networkInterface", new JsonSchemaBuilder() - .Title("networkInterface") - .Type(SchemaValueType.Object) - .Properties( - ("description", new JsonSchemaBuilder() - .Type(SchemaValueType.String) - .Description("Description of the NIC (e.g. Ethernet adapter, Wireless LAN adapter Local Area Connection <#>, etc.)."))) - .Build() + "microsoft.graph.networkInterface", new OpenApiSchema + { + Title = "networkInterface", + Type = "object", + Properties = new Dictionary + { + { + "description", new OpenApiSchema + { + Type = "string", + Description = "Description of the NIC (e.g. Ethernet adapter, Wireless LAN adapter Local Area Connection <#>, etc.).", + Nullable = true + } + } + } + } } } } From e18c9d8606b80aff0884bee5b7cbcb67c1e7fd7d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:00:43 +0000 Subject: [PATCH 511/752] Bump Microsoft.NET.Test.Sdk from 17.10.0 to 17.11.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.10.0 to 17.11.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.10.0...v17.11.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index c1147319f..f5958e5b6 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -12,7 +12,7 @@ - + From 79fa37aba92938def9e5de5868e7b4f6eade73b5 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Fri, 23 Aug 2024 12:43:12 +0300 Subject: [PATCH 512/752] Update OData lib and bump Hidi version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index e635fa5a3..309fec2de 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.4.7 + 1.4.8 OpenAPI.NET CLI tool for slicing OpenAPI documents true @@ -35,7 +35,7 @@ - + From d302d658ddef75cef09cb614c04e82d2123cea6b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 28 Aug 2024 10:49:48 -0400 Subject: [PATCH 513/752] chore: linting tasks conventions Signed-off-by: Vincent Biret --- .../Handlers/AsyncCommandHandler.cs | 14 ++++ .../Handlers/PluginCommandHandler.cs | 10 +-- .../Handlers/ShowCommandHandler.cs | 10 +-- .../Handlers/TransformCommandHandler.cs | 10 +-- .../Handlers/ValidateCommandHandler.cs | 11 +-- .../Microsoft.OpenApi.Hidi.csproj | 1 + src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 44 ++++++------ .../Services/OpenApiServiceTests.cs | 72 +++++++++---------- 8 files changed, 85 insertions(+), 87 deletions(-) create mode 100644 src/Microsoft.OpenApi.Hidi/Handlers/AsyncCommandHandler.cs diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/AsyncCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/AsyncCommandHandler.cs new file mode 100644 index 000000000..385c00931 --- /dev/null +++ b/src/Microsoft.OpenApi.Hidi/Handlers/AsyncCommandHandler.cs @@ -0,0 +1,14 @@ +using System; +using System.CommandLine.Invocation; +using System.Threading.Tasks; + +namespace Microsoft.OpenApi.Hidi.Handlers; + +internal abstract class AsyncCommandHandler : ICommandHandler +{ + public int Invoke(InvocationContext context) + { + throw new InvalidOperationException("This method should not be called"); + } + public abstract Task InvokeAsync(InvocationContext context); +} diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs index bd240f00e..b8f1155c7 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/PluginCommandHandler.cs @@ -11,18 +11,14 @@ namespace Microsoft.OpenApi.Hidi.Handlers { - internal class PluginCommandHandler : ICommandHandler + internal class PluginCommandHandler : AsyncCommandHandler { public CommandOptions CommandOptions { get; } public PluginCommandHandler(CommandOptions commandOptions) { CommandOptions = commandOptions; } - public int Invoke(InvocationContext context) - { - return InvokeAsync(context).GetAwaiter().GetResult(); - } - public async Task InvokeAsync(InvocationContext context) + public override async Task InvokeAsync(InvocationContext context) { var hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); var cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); @@ -31,7 +27,7 @@ public async Task InvokeAsync(InvocationContext context) var logger = loggerFactory.CreateLogger(); try { - await OpenApiService.PluginManifest(hidiOptions, logger, cancellationToken).ConfigureAwait(false); + await OpenApiService.PluginManifestAsync(hidiOptions, logger, cancellationToken).ConfigureAwait(false); return 0; } diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs index dc2f6d8c8..e4f86c6f5 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ShowCommandHandler.cs @@ -11,18 +11,14 @@ namespace Microsoft.OpenApi.Hidi.Handlers { - internal class ShowCommandHandler : ICommandHandler + internal class ShowCommandHandler : AsyncCommandHandler { public CommandOptions CommandOptions { get; set; } public ShowCommandHandler(CommandOptions commandOptions) { CommandOptions = commandOptions; } - public int Invoke(InvocationContext context) - { - return InvokeAsync(context).GetAwaiter().GetResult(); - } - public async Task InvokeAsync(InvocationContext context) + public override async Task InvokeAsync(InvocationContext context) { var hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); var cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); @@ -31,7 +27,7 @@ public async Task InvokeAsync(InvocationContext context) var logger = loggerFactory.CreateLogger(); try { - await OpenApiService.ShowOpenApiDocument(hidiOptions, logger, cancellationToken).ConfigureAwait(false); + await OpenApiService.ShowOpenApiDocumentAsync(hidiOptions, logger, cancellationToken).ConfigureAwait(false); return 0; } diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs index c9f46b7ee..3a9a6322c 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/TransformCommandHandler.cs @@ -11,18 +11,14 @@ namespace Microsoft.OpenApi.Hidi.Handlers { - internal class TransformCommandHandler : ICommandHandler + internal class TransformCommandHandler : AsyncCommandHandler { public CommandOptions CommandOptions { get; } public TransformCommandHandler(CommandOptions commandOptions) { CommandOptions = commandOptions; } - public int Invoke(InvocationContext context) - { - return InvokeAsync(context).GetAwaiter().GetResult(); - } - public async Task InvokeAsync(InvocationContext context) + public override async Task InvokeAsync(InvocationContext context) { var hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); var cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); @@ -31,7 +27,7 @@ public async Task InvokeAsync(InvocationContext context) var logger = loggerFactory.CreateLogger(); try { - await OpenApiService.TransformOpenApiDocument(hidiOptions, logger, cancellationToken).ConfigureAwait(false); + await OpenApiService.TransformOpenApiDocumentAsync(hidiOptions, logger, cancellationToken).ConfigureAwait(false); return 0; } diff --git a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs index 4c14cbef6..b2d4a4653 100644 --- a/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs +++ b/src/Microsoft.OpenApi.Hidi/Handlers/ValidateCommandHandler.cs @@ -11,7 +11,7 @@ namespace Microsoft.OpenApi.Hidi.Handlers { - internal class ValidateCommandHandler : ICommandHandler + internal class ValidateCommandHandler : AsyncCommandHandler { public CommandOptions CommandOptions { get; } @@ -19,12 +19,7 @@ public ValidateCommandHandler(CommandOptions commandOptions) { CommandOptions = commandOptions; } - - public int Invoke(InvocationContext context) - { - return InvokeAsync(context).GetAwaiter().GetResult(); - } - public async Task InvokeAsync(InvocationContext context) + public override async Task InvokeAsync(InvocationContext context) { var hidiOptions = new HidiOptions(context.ParseResult, CommandOptions); var cancellationToken = (CancellationToken)context.BindingContext.GetRequiredService(typeof(CancellationToken)); @@ -33,7 +28,7 @@ public async Task InvokeAsync(InvocationContext context) try { if (hidiOptions.OpenApi is null) throw new InvalidOperationException("OpenApi file is required"); - var isValid = await OpenApiService.ValidateOpenApiDocument(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false); + var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(hidiOptions.OpenApi, logger, cancellationToken).ConfigureAwait(false); return isValid is not false ? 0 : -1; } #if RELEASE diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 309fec2de..8d1f4d393 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -33,6 +33,7 @@ + diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index d3d3fdd8c..d98508a13 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -41,7 +41,7 @@ internal static class OpenApiService /// /// Implementation of the transform command /// - public static async Task TransformOpenApiDocument(HidiOptions options, ILogger logger, CancellationToken cancellationToken = default) + public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILogger logger, CancellationToken cancellationToken = default) { if (string.IsNullOrEmpty(options.OpenApi) && string.IsNullOrEmpty(options.Csdl) && string.IsNullOrEmpty(options.FilterOptions?.FilterByApiManifest)) { @@ -70,7 +70,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l var openApiVersion = options.Version != null ? TryParseOpenApiSpecVersion(options.Version) : OpenApiSpecVersion.OpenApi3_0; // If ApiManifest is provided, set the referenced OpenAPI document - var apiDependency = await FindApiDependency(options.FilterOptions.FilterByApiManifest, logger, cancellationToken).ConfigureAwait(false); + var apiDependency = await FindApiDependencyAsync(options.FilterOptions.FilterByApiManifest, logger, cancellationToken).ConfigureAwait(false); if (apiDependency != null) { options.OpenApi = apiDependency.ApiDescripionUrl; @@ -80,12 +80,12 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l JsonDocument? postmanCollection = null; if (!string.IsNullOrEmpty(options.FilterOptions?.FilterByCollection)) { - using var collectionStream = await GetStream(options.FilterOptions.FilterByCollection, logger, cancellationToken).ConfigureAwait(false); + using var collectionStream = await GetStreamAsync(options.FilterOptions.FilterByCollection, logger, cancellationToken).ConfigureAwait(false); postmanCollection = await JsonDocument.ParseAsync(collectionStream, cancellationToken: cancellationToken).ConfigureAwait(false); } // Load OpenAPI document - var document = await GetOpenApi(options, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); + var document = await GetOpenApiAsync(options, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); if (options.FilterOptions != null) { @@ -116,7 +116,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l } } - private static async Task FindApiDependency(string? apiManifestPath, ILogger logger, CancellationToken cancellationToken = default) + private static async Task FindApiDependencyAsync(string? apiManifestPath, ILogger logger, CancellationToken cancellationToken = default) { ApiDependency? apiDependency = null; // If API Manifest is provided, load it, use it get the OpenAPI path @@ -130,7 +130,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l { apiDependencyName = apiManifestRef[1]; } - using (var fileStream = await GetStream(apiManifestRef[0], logger, cancellationToken).ConfigureAwait(false)) + using (var fileStream = await GetStreamAsync(apiManifestRef[0], logger, cancellationToken).ConfigureAwait(false)) { var document = await JsonDocument.ParseAsync(fileStream, cancellationToken: cancellationToken).ConfigureAwait(false); apiManifest = ApiManifestDocument.Load(document.RootElement); @@ -212,7 +212,7 @@ private static void WriteOpenApi(HidiOptions options, OpenApiFormat openApiForma } // Get OpenAPI document either from OpenAPI or CSDL - private static async Task GetOpenApi(HidiOptions options, ILogger logger, string? metadataVersion = null, CancellationToken cancellationToken = default) + private static async Task GetOpenApiAsync(HidiOptions options, ILogger logger, string? metadataVersion = null, CancellationToken cancellationToken = default) { OpenApiDocument document; Stream stream; @@ -223,7 +223,7 @@ private static async Task GetOpenApi(HidiOptions options, ILogg using (logger.BeginScope("Convert CSDL: {Csdl}", options.Csdl)) { stopwatch.Start(); - stream = await GetStream(options.Csdl, logger, cancellationToken).ConfigureAwait(false); + stream = await GetStreamAsync(options.Csdl, logger, cancellationToken).ConfigureAwait(false); Stream? filteredStream = null; if (!string.IsNullOrEmpty(options.CsdlFilter)) { @@ -233,15 +233,15 @@ private static async Task GetOpenApi(HidiOptions options, ILogg await stream.DisposeAsync().ConfigureAwait(false); } - document = await ConvertCsdlToOpenApi(filteredStream ?? stream, metadataVersion, options.SettingsConfig, cancellationToken).ConfigureAwait(false); + document = await ConvertCsdlToOpenApiAsync(filteredStream ?? stream, metadataVersion, options.SettingsConfig, cancellationToken).ConfigureAwait(false); stopwatch.Stop(); logger.LogTrace("{Timestamp}ms: Generated OpenAPI with {Paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } } else if (!string.IsNullOrEmpty(options.OpenApi)) { - stream = await GetStream(options.OpenApi, logger, cancellationToken).ConfigureAwait(false); - var result = await ParseOpenApi(options.OpenApi, options.InlineExternal, logger, stream, cancellationToken).ConfigureAwait(false); + stream = await GetStreamAsync(options.OpenApi, logger, cancellationToken).ConfigureAwait(false); + var result = await ParseOpenApiAsync(options.OpenApi, options.InlineExternal, logger, stream, cancellationToken).ConfigureAwait(false); document = result.OpenApiDocument; } else throw new InvalidOperationException("No input file path or URL provided"); @@ -323,7 +323,7 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe /// Implementation of the validate command /// /// when valid, when invalid and when cancelled - public static async Task ValidateOpenApiDocument( + public static async Task ValidateOpenApiDocumentAsync( string openApi, ILogger logger, CancellationToken cancellationToken = default) @@ -337,9 +337,9 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe try { - using var stream = await GetStream(openApi, logger, cancellationToken).ConfigureAwait(false); + using var stream = await GetStreamAsync(openApi, logger, cancellationToken).ConfigureAwait(false); - result = await ParseOpenApi(openApi, false, logger, stream, cancellationToken).ConfigureAwait(false); + result = await ParseOpenApiAsync(openApi, false, logger, stream, cancellationToken).ConfigureAwait(false); using (logger.BeginScope("Calculating statistics")) { @@ -367,7 +367,7 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe return result.OpenApiDiagnostic.Errors.Count == 0; } - private static async Task ParseOpenApi(string openApiFile, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken = default) + private static async Task ParseOpenApiAsync(string openApiFile, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken = default) { ReadResult result; var stopwatch = Stopwatch.StartNew(); @@ -398,7 +398,7 @@ private static async Task ParseOpenApi(string openApiFile, bool inli /// /// The CSDL stream. /// An OpenAPI document. - public static async Task ConvertCsdlToOpenApi(Stream csdl, string? metadataVersion = null, IConfiguration? settings = null, CancellationToken token = default) + public static async Task ConvertCsdlToOpenApiAsync(Stream csdl, string? metadataVersion = null, IConfiguration? settings = null, CancellationToken token = default) { using var reader = new StreamReader(csdl); var csdlText = await reader.ReadToEndAsync(token).ConfigureAwait(false); @@ -486,7 +486,7 @@ private static Dictionary> EnumerateJsonDocument(JsonElemen /// /// Reads stream from file system or makes HTTP request depending on the input string /// - private static async Task GetStream(string input, ILogger logger, CancellationToken cancellationToken = default) + private static async Task GetStreamAsync(string input, ILogger logger, CancellationToken cancellationToken = default) { Stream stream; using (logger.BeginScope("Reading input stream")) @@ -562,7 +562,7 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl return extension; } - internal static async Task ShowOpenApiDocument(HidiOptions options, ILogger logger, CancellationToken cancellationToken = default) + internal static async Task ShowOpenApiDocumentAsync(HidiOptions options, ILogger logger, CancellationToken cancellationToken = default) { try { @@ -571,7 +571,7 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl throw new ArgumentException("Please input a file path or URL"); } - var document = await GetOpenApi(options, logger, null, cancellationToken).ConfigureAwait(false); + var document = await GetOpenApiAsync(options, logger, null, cancellationToken).ConfigureAwait(false); using (logger.BeginScope("Creating diagram")) { @@ -722,17 +722,17 @@ internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument d writer.WriteLine("(() => - OpenApiService.ValidateOpenApiDocument("", _logger)); + OpenApiService.ValidateOpenApiDocumentAsync("", _logger)); } [Fact] - public Task ThrowIfURLIsNotResolvableWhenValidating() + public Task ThrowIfURLIsNotResolvableWhenValidatingAsync() { return Assert.ThrowsAsync(() => - OpenApiService.ValidateOpenApiDocument("https://example.org/itdoesnmatter", _logger)); + OpenApiService.ValidateOpenApiDocumentAsync("https://example.org/itdoesnmatter", _logger)); } [Fact] - public Task ThrowIfFileDoesNotExistWhenValidating() + public Task ThrowIfFileDoesNotExistWhenValidatingAsync() { return Assert.ThrowsAsync(() => - OpenApiService.ValidateOpenApiDocument("aFileThatBetterNotExist.fake", _logger)); + OpenApiService.ValidateOpenApiDocumentAsync("aFileThatBetterNotExist.fake", _logger)); } [Fact] - public async Task ValidateCommandProcessesOpenApi() + public async Task ValidateCommandProcessesOpenApiAsync() { // create a dummy ILogger instance for testing - await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger); + await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger); Assert.True(true); } [Fact] - public async Task ValidFileReturnsTrue() + public async Task ValidFileReturnsTrueAsync() { - var isValid = await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger); + var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger); Assert.True(isValid); } [Fact] - public async Task InvalidFileReturnsFalse() + public async Task InvalidFileReturnsFalseAsync() { - var isValid = await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "InvalidSampleOpenApi.yml"), _logger); + var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "InvalidSampleOpenApi.yml"), _logger); Assert.False(isValid); } [Fact] - public async Task CancellingValidationReturnsNull() + public async Task CancellingValidationReturnsNullAsync() { using var cts = new CancellationTokenSource(); await cts.CancelAsync(); - var isValid = await OpenApiService.ValidateOpenApiDocument(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger, cts.Token); + var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger, cts.Token); Assert.Null(isValid); } [Fact] - public async Task TransformCommandConvertsOpenApi() + public async Task TransformCommandConvertsOpenApiAsync() { var options = new HidiOptions { @@ -282,7 +282,7 @@ public async Task TransformCommandConvertsOpenApi() InlineExternal = false, }; // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocument(options, _logger); + await OpenApiService.TransformOpenApiDocumentAsync(options, _logger); var output = await File.ReadAllTextAsync("sample.json"); Assert.NotEmpty(output); @@ -290,7 +290,7 @@ public async Task TransformCommandConvertsOpenApi() [Fact] - public async Task TransformCommandConvertsOpenApiWithDefaultOutputName() + public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAsync() { var options = new HidiOptions { @@ -301,14 +301,14 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputName() InlineExternal = false, }; // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocument(options, _logger); + await OpenApiService.TransformOpenApiDocumentAsync(options, _logger); var output = await File.ReadAllTextAsync("output.yml"); Assert.NotEmpty(output); } [Fact] - public async Task TransformCommandConvertsCsdlWithDefaultOutputName() + public async Task TransformCommandConvertsCsdlWithDefaultOutputNameAsync() { var options = new HidiOptions { @@ -319,14 +319,14 @@ public async Task TransformCommandConvertsCsdlWithDefaultOutputName() InlineExternal = false, }; // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocument(options, _logger); + await OpenApiService.TransformOpenApiDocumentAsync(options, _logger); var output = await File.ReadAllTextAsync("output.yml"); Assert.NotEmpty(output); } [Fact] - public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchFormat() + public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchFormatAsync() { var options = new HidiOptions { @@ -339,14 +339,14 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchF InlineExternal = false, }; // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocument(options, _logger); + await OpenApiService.TransformOpenApiDocumentAsync(options, _logger); var output = await File.ReadAllTextAsync("output.yml"); Assert.NotEmpty(output); } [Fact] - public Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty() + public Task ThrowTransformCommandIfOpenApiAndCsdlAreEmptyAsync() { var options = new HidiOptions { @@ -356,11 +356,11 @@ public Task ThrowTransformCommandIfOpenApiAndCsdlAreEmpty() InlineExternal = false, }; return Assert.ThrowsAsync(() => - OpenApiService.TransformOpenApiDocument(options, _logger)); + OpenApiService.TransformOpenApiDocumentAsync(options, _logger)); } [Fact] - public async Task TransformToPowerShellCompliantOpenApi() + public async Task TransformToPowerShellCompliantOpenApiAsync() { var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "examplepowershellsettings.json"); var options = new HidiOptions @@ -375,7 +375,7 @@ public async Task TransformToPowerShellCompliantOpenApi() SettingsConfig = SettingsUtilities.GetConfiguration(settingsPath) }; // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocument(options, _logger); + await OpenApiService.TransformOpenApiDocumentAsync(options, _logger); var output = await File.ReadAllTextAsync("output.yml"); Assert.NotEmpty(output); From 28fa88c68855a3a04f72d5a61624b6ece5996554 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 28 Aug 2024 11:23:55 -0400 Subject: [PATCH 514/752] chore: tasks linting --- .../Services/OpenApiServiceTests.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 8d9d3ab09..a7ab42c03 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -382,24 +382,24 @@ public async Task TransformToPowerShellCompliantOpenApiAsync() } [Fact] - public void InvokeTransformCommand() + public async Task InvokeTransformCommandAsync() { var rootCommand = Program.CreateRootCommand(); var openapi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); var args = new[] { "transform", "-d", openapi, "-o", "sample.json", "--co" }; var parseResult = rootCommand.Parse(args); - var handler = rootCommand.Subcommands.Where(c => c.Name == "transform").First().Handler; + var handler = rootCommand.Subcommands.First(c => c.Name == "transform").Handler; var context = new InvocationContext(parseResult); - handler!.Invoke(context); + await handler!.InvokeAsync(context); - var output = File.ReadAllText("sample.json"); + var output = await File.ReadAllTextAsync("sample.json"); Assert.NotEmpty(output); } [Fact] - public void InvokeShowCommand() + public async Task InvokeShowCommandAsync() { var rootCommand = Program.CreateRootCommand(); var openApi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); @@ -408,14 +408,14 @@ public void InvokeShowCommand() var handler = rootCommand.Subcommands.Where(c => c.Name == "show").First().Handler; var context = new InvocationContext(parseResult); - handler!.Invoke(context); + await handler!.InvokeAsync(context); - var output = File.ReadAllText("sample.md"); + var output = await File.ReadAllTextAsync("sample.md"); Assert.Contains("graph LR", output, StringComparison.Ordinal); } [Fact] - public void InvokePluginCommand() + public async Task InvokePluginCommandAsync() { var rootCommand = Program.CreateRootCommand(); var manifest = Path.Combine(".", "UtilityFiles", "exampleapimanifest.json"); @@ -424,9 +424,9 @@ public void InvokePluginCommand() var handler = rootCommand.Subcommands.Where(c => c.Name == "plugin").First().Handler; var context = new InvocationContext(parseResult); - handler!.Invoke(context); + await handler!.InvokeAsync(context); - using var jsDoc = JsonDocument.Parse(File.ReadAllText("ai-plugin.json")); + using var jsDoc = JsonDocument.Parse(await File.ReadAllTextAsync("ai-plugin.json")); var openAiManifest = OpenAIPluginManifest.Load(jsDoc.RootElement); Assert.NotNull(openAiManifest); From 5b53f56600dcdf4c2b96582470505f013fc80b13 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Thu, 29 Aug 2024 16:45:40 +0300 Subject: [PATCH 515/752] Bump hidi and lib versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 8d1f4d393..21a7f677f 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.4.8 + 1.4.9 OpenAPI.NET CLI tool for slicing OpenAPI documents true From f3ec732078a9066fa17eeed909a0122c6e081931 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Fri, 30 Aug 2024 12:00:04 +0300 Subject: [PATCH 516/752] Add test --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 8 +- .../Services/OpenApiFilterServiceTests.cs | 29 +++++++ .../docWithReusableHeadersAndExamples.yaml | 79 +++++++++++++++++++ 3 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index f5958e5b6..75c176305 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -34,4 +34,10 @@ + + + PreserveNewest + + + diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 5fb1b15f9..ac566bf0d 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -3,9 +3,11 @@ using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Tests.UtilityFiles; using Moq; +using SharpYaml.Tokens; using Xunit; namespace Microsoft.OpenApi.Hidi.Tests @@ -170,6 +172,33 @@ public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidArguments Assert.Equal("Cannot specify both operationIds and tags at the same time.", message2); } + [Fact] + public void CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly() + { + // Arrange + var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "docWithReusableHeadersAndExamples.yaml"); + var operationIds = "getItems"; + + // Act + using var stream = File.OpenRead(filePath); + var doc = new OpenApiStreamReader().Read(stream, out var diagnostic); + + var predicate = OpenApiFilterService.CreatePredicate(operationIds: operationIds); + var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(doc, predicate); + + var response = subsetOpenApiDocument.Paths["/items"].Operations[OperationType.Get].Responses["200"]; + var responseHeader = response.Headers["x-custom-header"]; + var mediaTypeExample = response.Content["application/json"].Examples.First().Value; + var targetHeaders = subsetOpenApiDocument.Components.Headers; + var targetExamples = subsetOpenApiDocument.Components.Examples; + + // Assert + Assert.False(responseHeader.UnresolvedReference); + Assert.False(mediaTypeExample.UnresolvedReference); + Assert.Single(targetHeaders); + Assert.Single(targetExamples); + } + [Theory] [InlineData("reports.getTeamsUserActivityUserDetail-a3f1", null)] [InlineData(null, "reports.Functions")] diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml new file mode 100644 index 000000000..2f86d7661 --- /dev/null +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml @@ -0,0 +1,79 @@ +openapi: 3.0.1 +info: + title: Example with Multiple Operations and Local $refs + version: 1.0.0 +paths: + /items: + get: + operationId: getItems + summary: Get a list of items + responses: + '200': + description: A list of items + headers: + x-custom-header: + $ref: '#/components/headers/CustomHeader' + content: + application/json: + schema: + type: array + items: + type: string + examples: + ItemExample: + $ref: '#/components/examples/ItemExample' + post: + operationId: createItem + summary: Create a new item + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + name: + type: string + example: + $ref: '#/components/examples/ItemExample' + responses: + '201': + description: Item created + content: + application/json: + schema: + type: object + properties: + id: + type: string + name: + type: string + example: + $ref: '#/components/examples/ItemExample' +components: + schemas: + pet: + type: object + required: + - id + - name + properties: + id: + type: integer + format: int64 + name: + type: string + tag: + type: string + headers: + CustomHeader: + description: Custom header for authentication + required: true + schema: + type: string + examples: + ItemExample: + summary: Example of a new item to be created + value: + name: "New Item" + From 00f36b4196b9f04a034d001606cb72171e83946a Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Fri, 30 Aug 2024 13:11:20 +0300 Subject: [PATCH 517/752] Add server info --- .../UtilityFiles/docWithReusableHeadersAndExamples.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml index 2f86d7661..3260ea430 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml @@ -2,6 +2,8 @@ openapi: 3.0.1 info: title: Example with Multiple Operations and Local $refs version: 1.0.0 +servers: +- url: https://api.github.com paths: /items: get: From 4d837b9c957f5b3ca8af39173bd4ba7f2178b294 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Fri, 30 Aug 2024 13:12:07 +0300 Subject: [PATCH 518/752] Compare the source document's server to that of the resulting subset document for equality --- .../Services/OpenApiFilterServiceTests.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index ac566bf0d..f91d0db93 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -193,6 +193,7 @@ public void CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly() var targetExamples = subsetOpenApiDocument.Components.Examples; // Assert + Assert.Same(doc.Servers, subsetOpenApiDocument.Servers); Assert.False(responseHeader.UnresolvedReference); Assert.False(mediaTypeExample.UnresolvedReference); Assert.Single(targetHeaders); From 6b444effad28b5bc851492b0bc3b5b2430d9bb4a Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 30 Aug 2024 08:52:58 -0400 Subject: [PATCH 519/752] fix: directly adds non-vulnerable versions of transitive deps to resolve alerts --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 21a7f677f..ee760451f 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -39,6 +39,10 @@ + + From 49418d8c6ec17d3db9a58a93848ea0b992e3658d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2024 21:27:42 +0000 Subject: [PATCH 520/752] Bump Moq from 4.20.70 to 4.20.71 Bumps [Moq](https://github.com/moq/moq) from 4.20.70 to 4.20.71. - [Release notes](https://github.com/moq/moq/releases) - [Changelog](https://github.com/devlooped/moq/blob/main/changelog.md) - [Commits](https://github.com/moq/moq/compare/v4.20.70...v4.20.71) --- updated-dependencies: - dependency-name: Moq dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 75c176305..a0689b473 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -13,7 +13,7 @@ - + From 238703f15fe67495b466b0185ebfe42d46f61217 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 4 Sep 2024 11:48:11 -0400 Subject: [PATCH 521/752] fix: uses the correct threading dependency to avoid impacting downstream projects Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index ee760451f..120210fb0 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -33,7 +33,10 @@ - + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + From bafcf59815b3486f58cce24aff22d0ee5881c0d0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2024 00:59:23 +0300 Subject: [PATCH 522/752] Bump Microsoft.NET.Test.Sdk from 17.11.0 to 17.11.1 (#1824) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.11.0 to 17.11.1. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.11.0...v17.11.1) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index a0689b473..5e2c6c882 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -12,7 +12,7 @@ - + From 43703a47e5faf91088ff0405e8f18ef1daf8d4f7 Mon Sep 17 00:00:00 2001 From: HavenDV Date: Fri, 6 Sep 2024 02:34:08 +0400 Subject: [PATCH 523/752] fix: Resolved conflicts. --- .../Formatters/PowerShellFormatterTests.cs | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 94f99a1d2..f047ecdc7 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -57,18 +57,21 @@ public void RemoveAnyOfAndOneOfFromSchema() var walker = new OpenApiWalker(powerShellFormatter); walker.Walk(openApiDocument); - var testSchema = openApiDocument.Components.Schemas["TestSchema"]; - var averageAudioDegradationProperty = testSchema.Properties["averageAudioDegradation"]; - var defaultPriceProperty = testSchema.Properties["defaultPrice"]; + var testSchema = openApiDocument.Components?.Schemas?["TestSchema"]; + var averageAudioDegradationProperty = testSchema?.Properties["averageAudioDegradation"]; + var defaultPriceProperty = testSchema?.Properties["defaultPrice"]; // Assert - Assert.Null(averageAudioDegradationProperty.AnyOf); - Assert.Equal("number", averageAudioDegradationProperty.Type); - Assert.Equal("float", averageAudioDegradationProperty.Format); - Assert.True(averageAudioDegradationProperty.Nullable); - Assert.Null(defaultPriceProperty.OneOf); - Assert.Equal("number", defaultPriceProperty.Type); - Assert.Equal("double", defaultPriceProperty.Format); + Assert.NotNull(openApiDocument.Components); + Assert.NotNull(openApiDocument.Components.Schemas); + Assert.NotNull(testSchema); + Assert.Null(averageAudioDegradationProperty?.AnyOf); + Assert.Equal("number", averageAudioDegradationProperty?.Type); + Assert.Equal("float", averageAudioDegradationProperty?.Format); + Assert.True(averageAudioDegradationProperty?.Nullable); + Assert.Null(defaultPriceProperty?.OneOf); + Assert.Equal("number", defaultPriceProperty?.Type); + Assert.Equal("double", defaultPriceProperty?.Format); Assert.NotNull(testSchema.AdditionalProperties); } @@ -83,12 +86,12 @@ public void ResolveFunctionParameters() var walker = new OpenApiWalker(powerShellFormatter); walker.Walk(openApiDocument); - var idsParameter = openApiDocument.Paths["/foo"].Operations[OperationType.Get].Parameters.Where(static p => p.Name == "ids").FirstOrDefault(); + var idsParameter = openApiDocument.Paths?["/foo"].Operations[OperationType.Get].Parameters?.Where(static p => p.Name == "ids").FirstOrDefault(); // Assert Assert.Null(idsParameter?.Content); Assert.NotNull(idsParameter?.Schema); - Assert.Equal("array", idsParameter?.Schema.Type); + Assert.Equal("array", idsParameter.Schema.Type); } private static OpenApiDocument GetSampleOpenApiDocument() From 8f100f256508c454ab0796384f6b3828ae75c974 Mon Sep 17 00:00:00 2001 From: HavenDV Date: Fri, 6 Sep 2024 02:52:24 +0400 Subject: [PATCH 524/752] feat: Make REQUIRED properties as non-nullable and revert some changes according this. --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 12 ++++++------ .../Formatters/PowerShellFormatterTests.cs | 4 ++-- .../Services/OpenApiFilterServiceTests.cs | 6 +----- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index c0ff17aa7..df3bf0e67 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -185,7 +185,7 @@ private static OpenApiDocument ApplyFilters(HidiOptions options, ILogger logger, stopwatch.Start(); document = OpenApiFilterService.CreateFilteredDocument(document, predicate); stopwatch.Stop(); - logger.LogTrace("{Timestamp}ms: Creating filtered OpenApi document with {Paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths?.Count); + logger.LogTrace("{Timestamp}ms: Creating filtered OpenApi document with {Paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } return document; @@ -248,7 +248,7 @@ private static async Task GetOpenApi(HidiOptions options, strin document = await ConvertCsdlToOpenApi(filteredStream ?? stream, format, metadataVersion, options.SettingsConfig, cancellationToken).ConfigureAwait(false); stopwatch.Stop(); - logger.LogTrace("{Timestamp}ms: Generated OpenAPI with {Paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths?.Count); + logger.LogTrace("{Timestamp}ms: Generated OpenAPI with {Paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } } else if (!string.IsNullOrEmpty(options.OpenApi)) @@ -666,7 +666,7 @@ internal static void WriteTreeDocumentAsMarkdown(string openapiUrl, OpenApiDocum { var rootNode = OpenApiUrlTreeNode.Create(document, "main"); - writer.WriteLine("# " + document.Info?.Title); + writer.WriteLine("# " + document.Info.Title); writer.WriteLine(); writer.WriteLine("API Description: " + openapiUrl); @@ -702,7 +702,7 @@ internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument d """); - writer.WriteLine("

" + document.Info?.Title + "

"); + writer.WriteLine("

" + document.Info.Title + "

"); writer.WriteLine(); writer.WriteLine($"

API Description: {sourceUrl}

"); @@ -773,8 +773,8 @@ internal static async Task PluginManifest(HidiOptions options, ILogger logger, C // Create OpenAIPluginManifest from ApiDependency and OpenAPI document var manifest = new OpenAIPluginManifest { - NameForHuman = document.Info?.Title, - DescriptionForHuman = document.Info?.Description, + NameForHuman = document.Info.Title, + DescriptionForHuman = document.Info.Description, Api = new() { Type = "openapi", diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index f047ecdc7..214bd47ff 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -86,12 +86,12 @@ public void ResolveFunctionParameters() var walker = new OpenApiWalker(powerShellFormatter); walker.Walk(openApiDocument); - var idsParameter = openApiDocument.Paths?["/foo"].Operations[OperationType.Get].Parameters?.Where(static p => p.Name == "ids").FirstOrDefault(); + var idsParameter = openApiDocument.Paths["/foo"].Operations[OperationType.Get].Parameters?.Where(static p => p.Name == "ids").FirstOrDefault(); // Assert Assert.Null(idsParameter?.Content); Assert.NotNull(idsParameter?.Schema); - Assert.Equal("array", idsParameter.Schema.Type); + Assert.Equal("array", idsParameter?.Schema.Type); } private static OpenApiDocument GetSampleOpenApiDocument() diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 02e6cedb0..5fb1b15f9 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -43,7 +43,6 @@ public void ReturnFilteredOpenApiDocumentBasedOnOperationIdsAndTags(string? oper // Assert Assert.NotNull(subsetOpenApiDocument); - Assert.NotNull(subsetOpenApiDocument.Paths); Assert.NotEmpty(subsetOpenApiDocument.Paths); Assert.Equal(expectedPathCount, subsetOpenApiDocument.Paths.Count); } @@ -63,7 +62,6 @@ public void ReturnFilteredOpenApiDocumentBasedOnPostmanCollection() // Assert Assert.NotNull(subsetOpenApiDocument); - Assert.NotNull(subsetOpenApiDocument.Paths); Assert.NotEmpty(subsetOpenApiDocument.Paths); Assert.Equal(3, subsetOpenApiDocument.Paths.Count); } @@ -152,11 +150,10 @@ public void ContinueProcessingWhenUrlsInCollectionAreMissingFromSourceDocument() var pathCount = requestUrls.Count; var predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: _openApiDocumentMock); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(_openApiDocumentMock, predicate); - var subsetPathCount = subsetOpenApiDocument.Paths?.Count; + var subsetPathCount = subsetOpenApiDocument.Paths.Count; // Assert Assert.NotNull(subsetOpenApiDocument); - Assert.NotNull(subsetOpenApiDocument.Paths); Assert.NotEmpty(subsetOpenApiDocument.Paths); Assert.Equal(2, subsetPathCount); Assert.NotEqual(pathCount, subsetPathCount); @@ -183,7 +180,6 @@ public void ReturnsPathParametersOnSlicingBasedOnOperationIdsOrTags(string? oper var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(_openApiDocumentMock, predicate); // Assert - Assert.NotNull(subsetOpenApiDocument.Paths); foreach (var pathItem in subsetOpenApiDocument.Paths) { Assert.True(pathItem.Value.Parameters.Any()); From 78ef7427d2e25eaa8ec35f5f62c8d4135f4d9c32 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 21:09:32 +0000 Subject: [PATCH 525/752] Bump Moq from 4.20.71 to 4.20.72 Bumps [Moq](https://github.com/moq/moq) from 4.20.71 to 4.20.72. - [Release notes](https://github.com/moq/moq/releases) - [Changelog](https://github.com/devlooped/moq/blob/main/changelog.md) - [Commits](https://github.com/moq/moq/compare/v4.20.71...v4.20.72) --- updated-dependencies: - dependency-name: Moq dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 5e2c6c882..82af1d032 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -13,7 +13,7 @@ - + From f0191f6b8f44984e85b9b0a103f9d5629e30f682 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Sep 2024 06:12:55 +0000 Subject: [PATCH 526/752] Bump xunit from 2.9.0 to 2.9.1 Bumps [xunit](https://github.com/xunit/xunit) from 2.9.0 to 2.9.1. - [Commits](https://github.com/xunit/xunit/compare/2.9.0...2.9.1) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 82af1d032..c5f7d9ee8 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From 309be34b0af66dd1292a228b4eb0bcaf9f4fc277 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Fri, 27 Sep 2024 11:35:14 +0300 Subject: [PATCH 527/752] Bump lib versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 120210fb0..377f67995 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.4.9 + 1.4.10 OpenAPI.NET CLI tool for slicing OpenAPI documents true From e9257ad7f5bd47ff593e9d6a3fbf52bca72b2a51 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Fri, 27 Sep 2024 11:35:46 +0300 Subject: [PATCH 528/752] Update test --- .../Services/OpenApiFilterServiceTests.cs | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index f91d0db93..ebb863461 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using Microsoft.Extensions.Logging; @@ -105,6 +105,57 @@ public void TestPredicateFiltersUsingRelativeRequestUrls() Assert.False(predicate("/foo", OperationType.Patch, null)); } + [Fact] + public void CreateFilteredDocumentUsingPredicateFromRequestUrl() + { + // Arrange + var openApiDocument = new OpenApiDocument + { + Info = new() { Title = "Test", Version = "1.0" }, + Servers = new List { new() { Url = "https://localhost/" } }, + Paths = new() + { + ["/test/{id}"] = new() + { + Operations = new Dictionary + { + { OperationType.Get, new() }, + { OperationType.Patch, new() } + }, + Parameters = new List + { + new() + { + Name = "id", + In = ParameterLocation.Path, + Required = true, + Schema = new() + { + Type = "string" + } + } + } + } + + + } + }; + + var requestUrls = new Dictionary> + { + {"/test/{id}", new List {"GET","PATCH"}} + }; + + // Act + var predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: openApiDocument); + var subsetDoc = OpenApiFilterService.CreateFilteredDocument(openApiDocument, predicate); + + // Assert that there's only 1 parameter in the subset document + Assert.NotNull(subsetDoc); + Assert.NotEmpty(subsetDoc.Paths); + Assert.Single(subsetDoc.Paths.First().Value.Parameters); + } + [Fact] public void ShouldParseNestedPostmanCollection() { From 15e671dd4e6bc9f508915dc6dd953d246ab30134 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 27 Sep 2024 21:18:28 +0000 Subject: [PATCH 529/752] Bump xunit from 2.9.1 to 2.9.2 Bumps [xunit](https://github.com/xunit/xunit) from 2.9.1 to 2.9.2. - [Commits](https://github.com/xunit/xunit/compare/v2-2.9.1...v2-2.9.2) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index c5f7d9ee8..397831833 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - +
From 42a43046f0bfb3545257f40c2f0622a9d8979fb6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 21:44:27 +0000 Subject: [PATCH 530/752] Bump Microsoft.OData.Edm from 8.0.1 to 8.0.2 Bumps Microsoft.OData.Edm from 8.0.1 to 8.0.2. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 377f67995..6a31bbe20 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ all
- + From 51d8de5741b0ae24f502d439787ab88dd3e4af39 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 2 Oct 2024 18:18:45 +0300 Subject: [PATCH 531/752] Add support for transforming 3.1 docs --- .../OpenApiSpecVersionHelper.cs | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs b/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs index 234298481..222f7a8c6 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. using System; -using System.Linq; namespace Microsoft.OpenApi.Hidi { @@ -14,17 +13,30 @@ public static OpenApiSpecVersion TryParseOpenApiSpecVersion(string value) { throw new InvalidOperationException("Please provide a version"); } - var res = value.Split('.', StringSplitOptions.RemoveEmptyEntries).FirstOrDefault(); + // Split the version string by the dot + var versionSegments = value.Split('.', StringSplitOptions.RemoveEmptyEntries); - if (int.TryParse(res, out var result)) + if (!int.TryParse(versionSegments[0], out var majorVersion) + || !int.TryParse(versionSegments[1], out var minorVersion)) { - if (result is >= 2 and < 3) - { - return OpenApiSpecVersion.OpenApi2_0; - } + throw new InvalidOperationException("Invalid version format. Please provide a valid OpenAPI version (e.g., 2.0, 3.0, 3.1)."); } - return OpenApiSpecVersion.OpenApi3_0; // default + // Check for specific version matches + if (majorVersion == 2) + { + return OpenApiSpecVersion.OpenApi2_0; + } + else if (majorVersion == 3 && minorVersion == 0) + { + return OpenApiSpecVersion.OpenApi3_0; + } + else if (majorVersion == 3 && minorVersion == 1) + { + return OpenApiSpecVersion.OpenApi3_1; + } + + return OpenApiSpecVersion.OpenApi3_1; // default } } } From 4dbe0813c4e2233214270b6ad6dd8e6d90b7191a Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 2 Oct 2024 18:18:53 +0300 Subject: [PATCH 532/752] set 3.1 as the default version --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index fd53086d2..7cde3f2fb 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System; @@ -79,7 +79,7 @@ public static async Task TransformOpenApiDocument(HidiOptions options, ILogger l // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion var openApiFormat = options.OpenApiFormat ?? (!string.IsNullOrEmpty(options.OpenApi) ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiFormat.Yaml); - var openApiVersion = options.Version != null ? TryParseOpenApiSpecVersion(options.Version) : OpenApiSpecVersion.OpenApi3_0; + var openApiVersion = options.Version != null ? TryParseOpenApiSpecVersion(options.Version) : OpenApiSpecVersion.OpenApi3_1; // If ApiManifest is provided, set the referenced OpenAPI document var apiDependency = await FindApiDependency(options.FilterOptions.FilterByApiManifest, logger, cancellationToken).ConfigureAwait(false); @@ -768,7 +768,7 @@ internal static async Task PluginManifest(HidiOptions options, ILogger logger, C // Write OpenAPI to Output folder options.Output = new(Path.Combine(options.OutputFolder, "openapi.json")); options.TerseOutput = true; - WriteOpenApi(options, OpenApiFormat.Json, OpenApiSpecVersion.OpenApi3_0, document, logger); + WriteOpenApi(options, OpenApiFormat.Json, OpenApiSpecVersion.OpenApi3_1, document, logger); // Create OpenAIPluginManifest from ApiDependency and OpenAPI document var manifest = new OpenAIPluginManifest From 4fd982018e8373abc5f79a2b88a57cd62f43c080 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 3 Oct 2024 21:55:44 +0000 Subject: [PATCH 533/752] Bump Microsoft.OpenApi.OData from 2.0.0-preview.2 to 2.0.0-preview.3 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 2.0.0-preview.2 to 2.0.0-preview.3. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 6a31bbe20..f33a9b689 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -39,7 +39,7 @@ - + From bac4c4874ab2847f8f8ceb1f3126fefb1faddb12 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Mon, 7 Oct 2024 15:48:53 +0300 Subject: [PATCH 535/752] Fix merge conflicts --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 12 +-- .../Services/OpenApiFilterServiceTests.cs | 4 +- .../Services/OpenApiServiceTests.cs | 76 +------------------ 3 files changed, 10 insertions(+), 82 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 72f691b0e..c981639e9 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -98,7 +98,7 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog // Load OpenAPI document var format = OpenApiModelFactory.GetFormat(options.OpenApi); - var document = await GetOpenApi(options, format, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); + var document = await GetOpenApiAsync(options, format, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); if (options.FilterOptions != null) { @@ -225,7 +225,7 @@ private static void WriteOpenApi(HidiOptions options, OpenApiFormat openApiForma } // Get OpenAPI document either from OpenAPI or CSDL - private static async Task GetOpenApi(HidiOptions options, string format, ILogger logger, string? metadataVersion = null, CancellationToken cancellationToken = default) + private static async Task GetOpenApiAsync(HidiOptions options, string format, ILogger logger, string? metadataVersion = null, CancellationToken cancellationToken = default) { OpenApiDocument document; Stream stream; @@ -246,7 +246,7 @@ private static async Task GetOpenApi(HidiOptions options, strin await stream.DisposeAsync().ConfigureAwait(false); } - document = await ConvertCsdlToOpenApi(filteredStream ?? stream, format, metadataVersion, options.SettingsConfig, cancellationToken).ConfigureAwait(false); + document = await ConvertCsdlToOpenApiAsync(filteredStream ?? stream, format, metadataVersion, options.SettingsConfig, cancellationToken).ConfigureAwait(false); stopwatch.Stop(); logger.LogTrace("{Timestamp}ms: Generated OpenAPI with {Paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); } @@ -413,7 +413,7 @@ private static async Task ParseOpenApiAsync(string openApiFile, bool /// /// The CSDL stream. /// An OpenAPI document. - public static async Task ConvertCsdlToOpenApi(Stream csdl, string format, string? metadataVersion = null, IConfiguration? settings = null, CancellationToken token = default) + public static async Task ConvertCsdlToOpenApiAsync(Stream csdl, string format, string? metadataVersion = null, IConfiguration? settings = null, CancellationToken token = default) { using var reader = new StreamReader(csdl); var csdlText = await reader.ReadToEndAsync(token).ConfigureAwait(false); @@ -588,7 +588,7 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl } var format = OpenApiModelFactory.GetFormat(options.OpenApi); - var document = await GetOpenApi(options, format, logger, null, cancellationToken).ConfigureAwait(false); + var document = await GetOpenApiAsync(options, format, logger, null, cancellationToken).ConfigureAwait(false); using (logger.BeginScope("Creating diagram")) { @@ -750,7 +750,7 @@ internal static async Task PluginManifestAsync(HidiOptions options, ILogger logg // Load OpenAPI document var format = OpenApiModelFactory.GetFormat(options.OpenApi); - var document = await GetOpenApi(options, format, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); + var document = await GetOpenApiAsync(options, format, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index ebb863461..83e79d07c 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using Microsoft.Extensions.Logging; @@ -232,7 +232,7 @@ public void CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly() // Act using var stream = File.OpenRead(filePath); - var doc = new OpenApiStreamReader().Read(stream, out var diagnostic); + var doc = OpenApiDocument.Load(stream, "yaml").OpenApiDocument; var predicate = OpenApiFilterService.CreatePredicate(operationIds: operationIds); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(doc, predicate); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index d282ded8f..798b7532e 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. +// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. using System.CommandLine; @@ -13,6 +13,7 @@ using Microsoft.OpenApi.OData; using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Readers; +using Microsoft.OpenApi.Services; using Xunit; namespace Microsoft.OpenApi.Hidi.Tests @@ -27,44 +28,6 @@ public OpenApiServiceTests() _logger = new Logger(_loggerFactory); OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader()); OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader()); - - [Fact] - public async Task ReturnConvertedCSDLFileAsync() - { - // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "Todo.xml"); - var fileInput = new FileInfo(filePath); - var csdlStream = fileInput.OpenRead(); - // Act - var openApiDoc = await OpenApiService.ConvertCsdlToOpenApiAsync(csdlStream); - var expectedPathCount = 5; - - // Assert - Assert.NotNull(openApiDoc); - Assert.NotEmpty(openApiDoc.Paths); - Assert.Equal(expectedPathCount, openApiDoc.Paths.Count); - } - - [Theory] - [InlineData("Todos.Todo.UpdateTodo", null, 1)] - [InlineData("Todos.Todo.ListTodo", null, 1)] - [InlineData(null, "Todos.Todo", 5)] - public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocumentAsync(string? operationIds, string? tags, int expectedPathCount) - { - // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "Todo.xml"); - var fileInput = new FileInfo(filePath); - var csdlStream = fileInput.OpenRead(); - - // Act - var openApiDoc = await OpenApiService.ConvertCsdlToOpenApiAsync(csdlStream); - var predicate = OpenApiFilterService.CreatePredicate(operationIds, tags); - var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(openApiDoc, predicate); - - // Assert - Assert.NotNull(subsetOpenApiDocument); - Assert.NotEmpty(subsetOpenApiDocument.Paths); - Assert.Equal(expectedPathCount, subsetOpenApiDocument.Paths.Count); } [Fact] @@ -198,23 +161,6 @@ public async Task ShowCommandGeneratesMermaidHtmlFileWithMermaidDiagramAsync() Assert.True(File.Exists(filePath)); } - [Fact] - public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiagramAsync() - { - var options = new HidiOptions - { - Csdl = Path.Combine("UtilityFiles", "Todo.xml"), - CsdlFilter = "todos", - Output = new("sample.md") - }; - - // create a dummy ILogger instance for testing - await OpenApiService.ShowOpenApiDocumentAsync(options, _logger); - - var output = await File.ReadAllTextAsync(options.Output.FullName); - Assert.Contains("graph LR", output, StringComparison.Ordinal); - } - [Fact] public Task ThrowIfOpenApiUrlIsNotProvidedWhenValidatingAsync() { @@ -309,24 +255,6 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAsync() Assert.NotEmpty(output); } - [Fact] - public async Task TransformCommandConvertsCsdlWithDefaultOutputNameAsync() - { - var options = new HidiOptions - { - Csdl = Path.Combine("UtilityFiles", "Todo.xml"), - CleanOutput = true, - TerseOutput = false, - InlineLocal = false, - InlineExternal = false, - }; - // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocumentAsync(options, _logger); - - var output = await File.ReadAllTextAsync("output.yml"); - Assert.NotEmpty(output); - } - [Fact] public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchFormatAsync() { From b1683a72913744caff5a1a58acba2683dd23e72d Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 8 Oct 2024 21:53:23 +0300 Subject: [PATCH 536/752] Declare Annotations as nullable to prevent null reference assignment --- .../Services/OpenApiFilterServiceTests.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 83e79d07c..99e559e37 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -237,17 +237,19 @@ public void CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly() var predicate = OpenApiFilterService.CreatePredicate(operationIds: operationIds); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(doc, predicate); - var response = subsetOpenApiDocument.Paths["/items"].Operations[OperationType.Get].Responses["200"]; - var responseHeader = response.Headers["x-custom-header"]; - var mediaTypeExample = response.Content["application/json"].Examples.First().Value; - var targetHeaders = subsetOpenApiDocument.Components.Headers; - var targetExamples = subsetOpenApiDocument.Components.Examples; + var response = subsetOpenApiDocument.Paths["/items"].Operations[OperationType.Get]?.Responses?["200"]; + var responseHeader = response?.Headers["x-custom-header"]; + var mediaTypeExample = response?.Content["application/json"]?.Examples?.First().Value; + var targetHeaders = subsetOpenApiDocument.Components?.Headers; + var targetExamples = subsetOpenApiDocument.Components?.Examples; // Assert Assert.Same(doc.Servers, subsetOpenApiDocument.Servers); - Assert.False(responseHeader.UnresolvedReference); - Assert.False(mediaTypeExample.UnresolvedReference); + Assert.False(responseHeader?.UnresolvedReference); + Assert.False(mediaTypeExample?.UnresolvedReference); + Assert.NotNull(targetHeaders); Assert.Single(targetHeaders); + Assert.NotNull(targetExamples); Assert.Single(targetExamples); } From 6fcada9c7a53cbad2adaa9b352a2f00c4d3ce4f6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 21:08:48 +0000 Subject: [PATCH 537/752] Bump System.Text.Json from 8.0.4 to 8.0.5 Bumps [System.Text.Json](https://github.com/dotnet/runtime) from 8.0.4 to 8.0.5. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v8.0.4...v8.0.5) --- updated-dependencies: - dependency-name: System.Text.Json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 4ff96a2fb..525132254 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -45,7 +45,7 @@ - +
From d995facbb6ace02c5b5a73207fc18881f61e0041 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 07:02:39 +0000 Subject: [PATCH 538/752] Bump Microsoft.Extensions.Logging and Microsoft.Extensions.Logging.Abstractions Bumps [Microsoft.Extensions.Logging](https://github.com/dotnet/runtime) and [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime). These dependencies needed to be updated together. Updates `Microsoft.Extensions.Logging` from 8.0.0 to 8.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v8.0.0...v8.0.1) Updates `Microsoft.Extensions.Logging.Abstractions` from 8.0.1 to 8.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v8.0.1...v8.0.2) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 525132254..54d3c612f 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,8 +29,8 @@ - - + + From 9b56a4b3d625e6d5cb7ec88b34b1b26277c63c1b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 21:12:13 +0000 Subject: [PATCH 539/752] Bump Microsoft.Extensions.Logging.Console from 8.0.0 to 8.0.1 Bumps [Microsoft.Extensions.Logging.Console](https://github.com/dotnet/runtime) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v8.0.0...v8.0.1) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Console dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 54d3c612f..cab2dcf85 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -31,7 +31,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive From 632ef683e1532895271d04fe24de815c551b72ba Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 07:22:22 +0000 Subject: [PATCH 540/752] Bump Microsoft.Extensions.Logging.Debug from 8.0.0 to 8.0.1 Bumps [Microsoft.Extensions.Logging.Debug](https://github.com/dotnet/runtime) from 8.0.0 to 8.0.1. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v8.0.0...v8.0.1) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Debug dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index cab2dcf85..7e65e7f7c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -32,7 +32,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 51adc16f30057c3be5c123bdfd28ff5279e98d57 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 21:36:05 +0000 Subject: [PATCH 541/752] Bump Microsoft.OpenApi.OData from 2.0.0-preview.3 to 2.0.0-preview.4 Bumps [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET.OData) from 2.0.0-preview.3 to 2.0.0-preview.4. - [Release notes](https://github.com/Microsoft/OpenAPI.NET.OData/releases) - [Commits](https://github.com/Microsoft/OpenAPI.NET.OData/commits) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7e65e7f7c..550f483d6 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -39,7 +39,7 @@ - + @@ -39,7 +39,7 @@ - + From d715181d98ffb8ad1061977bcaaf239d1226dc1d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 5 Sep 2024 13:06:05 -0400 Subject: [PATCH 546/752] feat: bumps v3 patch version to 3.0.4 Signed-off-by: Vincent Biret --- .../UtilityFiles/docWithReusableHeadersAndExamples.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml index 3260ea430..60ee7e5c8 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.1 +openapi: 3.0.4 info: title: Example with Multiple Operations and Local $refs version: 1.0.0 From b11935853570595492448b36e473d896fd8ca654 Mon Sep 17 00:00:00 2001 From: Irvine Sunday Date: Mon, 28 Oct 2024 16:12:43 +0300 Subject: [PATCH 547/752] Bump up hidi and yoko lib versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 3cea6d29c..ce51fae51 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.4.13 + 1.4.14 OpenAPI.NET CLI tool for slicing OpenAPI documents true @@ -39,7 +39,7 @@ - + From 55139b1d16d042517293edb1c53bf5cc6c8a4b9c Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 6 Nov 2024 20:47:31 +0300 Subject: [PATCH 551/752] Update comment --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index c981639e9..7dfb5d797 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -77,7 +77,7 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog throw new IOException($"The file {options.Output} already exists. Please input a new file path."); } - // Default to yaml and OpenApiVersion 3 during csdl to OpenApi conversion + // Default to yaml and OpenApiVersion 3_1 during csdl to OpenApi conversion var openApiFormat = options.OpenApiFormat ?? (!string.IsNullOrEmpty(options.OpenApi) ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiFormat.Yaml); var openApiVersion = options.Version != null ? TryParseOpenApiSpecVersion(options.Version) : OpenApiSpecVersion.OpenApi3_1; From b2e0ff4c81cd059c3b01286ede5467df042e6a0e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Nov 2024 21:06:59 +0000 Subject: [PATCH 552/752] chore(deps): bump Microsoft.OData.Edm from 8.1.0 to 8.2.0 Bumps Microsoft.OData.Edm from 8.1.0 to 8.2.0. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 05461793c..c47865eb4 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ all - + From e4bb34e0cf42189447e819c338484e2993ddce7d Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 12 Nov 2024 13:20:16 +0300 Subject: [PATCH 553/752] Bump up lib and hidi versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c47865eb4..07f2e3e7d 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.4.15 + 1.4.16 OpenAPI.NET CLI tool for slicing OpenAPI documents true From 90817ec691e4639cfa136e41801eb523ef60866c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 21:59:46 +0000 Subject: [PATCH 554/752] chore(deps): bump Microsoft.Extensions.Logging.Abstractions Bumps [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime) from 8.0.2 to 9.0.0. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v8.0.2...v9.0.0) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 07f2e3e7d..549864fa3 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -30,7 +30,7 @@ - + From 4988f270d9e36d9eec11bfda4c54135f74bfad28 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:27:38 +0300 Subject: [PATCH 555/752] chore(deps): bump System.Text.Json from 8.0.5 to 9.0.0 (#1920) Bumps [System.Text.Json](https://github.com/dotnet/runtime) from 8.0.5 to 9.0.0. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v8.0.5...v9.0.0) --- updated-dependencies: - dependency-name: System.Text.Json dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 07f2e3e7d..8bdebc507 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -45,7 +45,7 @@ - + From 58770a739e73733b3d9c0ad58598b8607cd03d1c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 21:21:07 +0000 Subject: [PATCH 556/752] chore(deps): bump Microsoft.Extensions.Logging and Microsoft.Extensions.Logging.Abstractions Bumps [Microsoft.Extensions.Logging](https://github.com/dotnet/runtime) and [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime). These dependencies needed to be updated together. Updates `Microsoft.Extensions.Logging` from 8.0.1 to 9.0.0 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v8.0.1...v9.0.0) Updates `Microsoft.Extensions.Logging.Abstractions` from 9.0.0 to 9.0.0 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.0) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging dependency-type: direct:production update-type: version-update:semver-major - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 720163977..ecdb2f382 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,7 +29,7 @@ - + From 995d94e41b661d21dcd48610c06bdfdcb70e426e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 21:21:26 +0000 Subject: [PATCH 557/752] chore(deps): bump Microsoft.OData.Edm from 8.2.0 to 8.2.1 Bumps Microsoft.OData.Edm from 8.2.0 to 8.2.1. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 720163977..0cd90d008 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ all - + From f9cccf9afe4ef7d743a4b369ea618940d1d29664 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 21:22:21 +0000 Subject: [PATCH 558/752] chore(deps): bump Microsoft.VisualStudio.Threading.Analyzers Bumps [Microsoft.VisualStudio.Threading.Analyzers](https://github.com/microsoft/vs-threading) from 17.11.20 to 17.12.19. - [Release notes](https://github.com/microsoft/vs-threading/releases) - [Commits](https://github.com/microsoft/vs-threading/commits) --- updated-dependencies: - dependency-name: Microsoft.VisualStudio.Threading.Analyzers dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 720163977..9af98f513 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -33,7 +33,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From b2ebe0c821f2b46278c218fbe77256f87dc8a891 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 14 Nov 2024 07:32:31 -0500 Subject: [PATCH 559/752] chore: removes newtonsoft dependency all together --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 397831833..07a571a57 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,6 @@ - From b340192957e10287204019957db9898a829a19c2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 15 Nov 2024 02:14:47 +0300 Subject: [PATCH 560/752] chore(deps): bump Microsoft.Extensions.Logging, Microsoft.Extensions.Logging.Abstractions, Microsoft.Extensions.Logging.Console and System.Text.Json (#1932) Bumps [Microsoft.Extensions.Logging](https://github.com/dotnet/runtime), [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime), [Microsoft.Extensions.Logging.Console](https://github.com/dotnet/runtime) and [System.Text.Json](https://github.com/dotnet/runtime). These dependencies needed to be updated together. Updates `Microsoft.Extensions.Logging` from 9.0.0 to 9.0.0 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.0) Updates `Microsoft.Extensions.Logging.Abstractions` from 9.0.0 to 9.0.0 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.0) Updates `Microsoft.Extensions.Logging.Console` from 8.0.1 to 9.0.0 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v8.0.1...v9.0.0) Updates `System.Text.Json` from 9.0.0 to 9.0.0 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.0) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Console dependency-type: direct:production update-type: version-update:semver-major - dependency-name: System.Text.Json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 995d50008..ec5d4c1cc 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -31,7 +31,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive From 4af166b1e5b5b81455190d8e5494e71a46704d2e Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 19 Nov 2024 13:15:39 +0300 Subject: [PATCH 561/752] Use range for STJ reference and suppress warnings --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index ec5d4c1cc..1e4f0bc95 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -45,7 +45,9 @@ - + + + From 9e9c5c105417242f74ff24fb36fbb1d46614fa53 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 19 Nov 2024 13:21:57 +0300 Subject: [PATCH 562/752] Revert change for hidi --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 1e4f0bc95..ec5d4c1cc 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -45,9 +45,7 @@ - - - + From 391fd5347662b5a1d32273391b67ccacfab32cfa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 21:39:39 +0000 Subject: [PATCH 563/752] chore(deps): bump Microsoft.OData.Edm from 8.2.1 to 8.2.2 Bumps Microsoft.OData.Edm from 8.2.1 to 8.2.2. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index ec5d4c1cc..2b0582db7 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ all - + From 195c668744429ec872fd035f17693dd83beb96f0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Nov 2024 21:40:22 +0000 Subject: [PATCH 564/752] chore(deps): bump Microsoft.NET.Test.Sdk from 17.11.1 to 17.12.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.11.1 to 17.12.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.11.1...v17.12.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 07a571a57..7b214091d 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -12,7 +12,7 @@ - + From d05cc833862d76d789b82f10cf7e263d2bc1c729 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Thu, 28 Nov 2024 12:16:06 +0300 Subject: [PATCH 565/752] Use the provided format in hidi options --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 24 ++++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 7dfb5d797..b100eafb1 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -66,7 +66,7 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog #pragma warning restore CA1308 // Normalize strings to uppercase options.Output = new($"./output{inputExtension}"); - }; + } if (options.CleanOutput && options.Output.Exists) { @@ -97,8 +97,7 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog } // Load OpenAPI document - var format = OpenApiModelFactory.GetFormat(options.OpenApi); - var document = await GetOpenApiAsync(options, format, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); + var document = await GetOpenApiAsync(options, openApiFormat.GetDisplayName(), logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); if (options.FilterOptions != null) { @@ -254,7 +253,7 @@ private static async Task GetOpenApiAsync(HidiOptions options, else if (!string.IsNullOrEmpty(options.OpenApi)) { stream = await GetStreamAsync(options.OpenApi, logger, cancellationToken).ConfigureAwait(false); - var result = await ParseOpenApiAsync(options.OpenApi, options.InlineExternal, logger, stream, cancellationToken).ConfigureAwait(false); + var result = await ParseOpenApiAsync(options.OpenApi, format, options.InlineExternal, logger, stream, cancellationToken).ConfigureAwait(false); document = result.OpenApiDocument; } else throw new InvalidOperationException("No input file path or URL provided"); @@ -351,8 +350,8 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe try { using var stream = await GetStreamAsync(openApi, logger, cancellationToken).ConfigureAwait(false); - - result = await ParseOpenApiAsync(openApi, false, logger, stream, cancellationToken).ConfigureAwait(false); + var openApiFormat = !string.IsNullOrEmpty(openApi) ? GetOpenApiFormat(openApi, logger) : OpenApiFormat.Yaml; + result = await ParseOpenApiAsync(openApi, openApiFormat.GetDisplayName(),false, logger, stream, cancellationToken).ConfigureAwait(false); using (logger.BeginScope("Calculating statistics")) { @@ -380,7 +379,7 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe return result.OpenApiDiagnostic.Errors.Count == 0; } - private static async Task ParseOpenApiAsync(string openApiFile, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken = default) + private static async Task ParseOpenApiAsync(string openApiFile, string format, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken = default) { ReadResult result; var stopwatch = Stopwatch.StartNew(); @@ -396,7 +395,6 @@ private static async Task ParseOpenApiAsync(string openApiFile, bool new Uri("file://" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar) }; - var format = OpenApiModelFactory.GetFormat(openApiFile); result = await OpenApiDocument.LoadAsync(stream, format, settings, cancellationToken).ConfigureAwait(false); logger.LogTrace("{Timestamp}ms: Completed parsing.", stopwatch.ElapsedMilliseconds); @@ -587,8 +585,8 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl throw new ArgumentException("Please input a file path or URL"); } - var format = OpenApiModelFactory.GetFormat(options.OpenApi); - var document = await GetOpenApiAsync(options, format, logger, null, cancellationToken).ConfigureAwait(false); + var openApiFormat = options.OpenApiFormat ?? (!string.IsNullOrEmpty(options.OpenApi) ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiFormat.Yaml); + var document = await GetOpenApiAsync(options, openApiFormat.GetDisplayName(), logger, null, cancellationToken).ConfigureAwait(false); using (logger.BeginScope("Creating diagram")) { @@ -748,9 +746,11 @@ internal static async Task PluginManifestAsync(HidiOptions options, ILogger logg options.OpenApi = apiDependency.ApiDescripionUrl; } + var openApiFormat = options.OpenApiFormat ?? (!string.IsNullOrEmpty(options.OpenApi) + ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiFormat.Yaml); + // Load OpenAPI document - var format = OpenApiModelFactory.GetFormat(options.OpenApi); - var document = await GetOpenApiAsync(options, format, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); + var document = await GetOpenApiAsync(options, openApiFormat.GetDisplayName(), logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); From 70857c1af081b5a614c02f60eb16c02721a25892 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Thu, 28 Nov 2024 12:18:28 +0300 Subject: [PATCH 566/752] Clean up tests; refactor to use async --- .../Services/OpenApiFilterServiceTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 3bd9efd2a..602a69021 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -224,7 +224,7 @@ public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidArguments } [Fact] - public void CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly() + public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly() { // Arrange var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "docWithReusableHeadersAndExamples.yaml"); @@ -232,7 +232,7 @@ public void CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly() // Act using var stream = File.OpenRead(filePath); - var doc = OpenApiDocument.Load(stream, "yaml").OpenApiDocument; + var doc = (await OpenApiDocument.LoadAsync(stream, "yaml")).OpenApiDocument; var predicate = OpenApiFilterService.CreatePredicate(operationIds: operationIds); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(doc, predicate); From bf6d4461ea8d66963179ba809928ad37d5ee697b Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Mon, 9 Dec 2024 10:34:05 +0300 Subject: [PATCH 567/752] Rename Read Result properties --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 10 +++++----- .../Services/OpenApiFilterServiceTests.cs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 7dfb5d797..8a121f7ad 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -255,7 +255,7 @@ private static async Task GetOpenApiAsync(HidiOptions options, { stream = await GetStreamAsync(options.OpenApi, logger, cancellationToken).ConfigureAwait(false); var result = await ParseOpenApiAsync(options.OpenApi, options.InlineExternal, logger, stream, cancellationToken).ConfigureAwait(false); - document = result.OpenApiDocument; + document = result.Document; } else throw new InvalidOperationException("No input file path or URL provided"); @@ -358,7 +358,7 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe { var statsVisitor = new StatsVisitor(); var walker = new OpenApiWalker(statsVisitor); - walker.Walk(result.OpenApiDocument); + walker.Walk(result.Document); logger.LogTrace("Finished walking through the OpenApi document. Generating a statistics report.."); #pragma warning disable CA2254 @@ -377,7 +377,7 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe if (result is null) return null; - return result.OpenApiDiagnostic.Errors.Count == 0; + return result.Diagnostic.Errors.Count == 0; } private static async Task ParseOpenApiAsync(string openApiFile, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken = default) @@ -439,7 +439,7 @@ public static OpenApiDocument FixReferences(OpenApiDocument document, string for var sb = new StringBuilder(); document.SerializeAsV3(new OpenApiYamlWriter(new StringWriter(sb))); - var doc = OpenApiDocument.Parse(sb.ToString(), format).OpenApiDocument; + var doc = OpenApiDocument.Parse(sb.ToString(), format).Document; return doc; } @@ -649,7 +649,7 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl private static void LogErrors(ILogger logger, ReadResult result) { - var context = result.OpenApiDiagnostic; + var context = result.Diagnostic; if (context.Errors.Count != 0) { using (logger.BeginScope("Detected errors")) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 3bd9efd2a..01c4c59fa 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -232,7 +232,7 @@ public void CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly() // Act using var stream = File.OpenRead(filePath); - var doc = OpenApiDocument.Load(stream, "yaml").OpenApiDocument; + var doc = OpenApiDocument.Load(stream, "yaml").Document; var predicate = OpenApiFilterService.CreatePredicate(operationIds: operationIds); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(doc, predicate); From 0e2c1f4aa9619ae6eb4fcee464882a0de46c49ce Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Dec 2024 21:31:11 +0000 Subject: [PATCH 568/752] chore(deps): bump Microsoft.OData.Edm from 8.2.2 to 8.2.3 Bumps Microsoft.OData.Edm from 8.2.2 to 8.2.3. --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 2b0582db7..0a31b1199 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ all - + From c1139cdc73549424e1fb5700c1207555fb837ece Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Dec 2024 21:50:20 +0000 Subject: [PATCH 569/752] chore(deps): bump xunit.runner.visualstudio from 2.8.2 to 3.0.0 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 2.8.2 to 3.0.0. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/2.8.2...3.0.0) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 7b214091d..a0cc5337f 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From 608acafbfd31fe4825e7b47e7b8fed83b80a72c8 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Thu, 19 Dec 2024 15:18:44 +0300 Subject: [PATCH 570/752] Fix issues from resolving merge conflicts --- .../Services/OpenApiFilterServiceTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index f51c1ec9b..12293c4e5 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -232,7 +232,7 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly( // Act using var stream = File.OpenRead(filePath); - var doc = OpenApiDocument.Load(stream, "yaml").Document; + var doc = (await OpenApiDocument.LoadAsync(stream, "yaml")).Document; var predicate = OpenApiFilterService.CreatePredicate(operationIds: operationIds); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(doc, predicate); From 50891198c2dba2e5220562cf94ee475b4c7736da Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 19 Dec 2024 07:56:20 -0500 Subject: [PATCH 571/752] chore: aligns parameter names Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index b6af07778..d1f6f7f64 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -61,7 +61,7 @@ public override void Visit(OpenApiOperation operation) public int LinkCount { get; set; } - public override void Visit(OpenApiLink operation) + public override void Visit(OpenApiLink link) { LinkCount++; } From 6aadf90a66b599cf6e62d9244d71796e73c0b50c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 19 Dec 2024 09:22:10 -0500 Subject: [PATCH 572/752] fix: sets hidi version to a preview Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 0a31b1199..a42c91879 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 1.4.16 + 2.0.0-preview3 OpenAPI.NET CLI tool for slicing OpenAPI documents true From 5c737fe1e9b54d57266659f7ae2263f4737016ba Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 19 Dec 2024 09:54:20 -0500 Subject: [PATCH 573/752] ci: renames vnext to dev Signed-off-by: Vincent Biret --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index fd821e3e4..25f1ec589 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,5 +19,5 @@ VOLUME /app/collection.json ENV HIDI_CONTAINER=true DOTNET_TieredPGO=1 DOTNET_TC_QuickJitForLoops=1 ENTRYPOINT ["dotnet", "Microsoft.OpenApi.Hidi.dll"] LABEL description="# Welcome to Hidi \ -To start transforming OpenAPI documents checkout [the getting started documentation](https://github.com/microsoft/OpenAPI.NET/tree/vnext/src/Microsoft.OpenApi.Hidi) \ -[Source dockerfile](https://github.com/microsoft/OpenAPI.NET/blob/vnext/Dockerfile)" +To start transforming OpenAPI documents checkout [the getting started documentation](https://github.com/microsoft/OpenAPI.NET/tree/main/src/Microsoft.OpenApi.Hidi) \ +[Source dockerfile](https://github.com/microsoft/OpenAPI.NET/blob/main/Dockerfile)" From 35d8d62707a9b264b8c6fcd0f6e9030af4ad3fe7 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 20 Dec 2024 08:05:21 -0500 Subject: [PATCH 574/752] chore: updates api manifest dependency Signed-off-by: Vincent Biret --- .../Microsoft.OpenApi.Hidi.csproj | 2 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 17 +++++++---------- .../UtilityFiles/exampleapimanifest.json | 3 ++- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index a42c91879..04c42ee47 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -40,7 +40,7 @@ - + From d6b1cbfec48a207465cd84e74f4f0d8f5befd5e9 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 31 Dec 2024 15:16:16 -0500 Subject: [PATCH 577/752] fix: side effects in tag references Signed-off-by: Vincent Biret --- .../UtilityFiles/OpenApiDocumentMock.cs | 198 ++++++++---------- 1 file changed, 83 insertions(+), 115 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 91dd59919..edbf143fe 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -4,6 +4,7 @@ using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Models.References; namespace Microsoft.OpenApi.Tests.UtilityFiles { @@ -19,6 +20,17 @@ public static class OpenApiDocumentMock public static OpenApiDocument CreateOpenApiDocument() { var applicationJsonMediaType = "application/json"; + const string getTeamsActivityByPeriodPath = "/reports/microsoft.graph.getTeamsUserActivityCounts(period={period})"; + const string getTeamsActivityByDatePath = "/reports/microsoft.graph.getTeamsUserActivityUserDetail(date={date})"; + const string usersPath = "/users"; + const string usersByIdPath = "/users/{user-id}"; + const string messagesByIdPath = "/users/{user-id}/messages/{message-id}"; + const string administrativeUnitRestorePath = "/administrativeUnits/{administrativeUnit-id}/microsoft.graph.restore"; + const string logoPath = "/applications/{application-id}/logo"; + const string securityProfilesPath = "/security/hostSecurityProfiles"; + const string communicationsCallsKeepAlivePath = "/communications/calls/{call-id}/microsoft.graph.keepAlive"; + const string eventsDeltaPath = "/groups/{group-id}/events/{event-id}/calendar/events/microsoft.graph.delta"; + const string refPath = "/applications/{application-id}/createdOnBehalfOf/$ref"; var document = new OpenApiDocument { @@ -57,22 +69,13 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/reports/microsoft.graph.getTeamsUserActivityCounts(period={period})"] = new() + [getTeamsActivityByPeriodPath] = new() { Operations = new Dictionary { { OperationType.Get, new OpenApiOperation { - Tags = new List - { - { - new() - { - Name = "reports.Functions" - } - } - }, OperationId = "reports.getTeamsUserActivityCounts", Summary = "Invoke function getTeamsUserActivityUserCounts", Parameters = new List @@ -131,22 +134,13 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/reports/microsoft.graph.getTeamsUserActivityUserDetail(date={date})"] = new() + [getTeamsActivityByDatePath] = new() { Operations = new Dictionary { { OperationType.Get, new OpenApiOperation { - Tags = new List - { - { - new() - { - Name = "reports.Functions" - } - } - }, OperationId = "reports.getTeamsUserActivityUserDetail-a3f1", Summary = "Invoke function getTeamsUserActivityUserDetail", Parameters = new List @@ -203,22 +197,13 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/users"] = new() + [usersPath] = new() { Operations = new Dictionary { { OperationType.Get, new OpenApiOperation { - Tags = new List - { - { - new() - { - Name = "users.user" - } - } - }, OperationId = "users.user.ListUser", Summary = "Get entities from users", Responses = new() @@ -266,22 +251,13 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/users/{user-id}"] = new() + [usersByIdPath] = new() { Operations = new Dictionary { { OperationType.Get, new OpenApiOperation { - Tags = new List - { - { - new() - { - Name = "users.user" - } - } - }, OperationId = "users.user.GetUser", Summary = "Get entity from users by key", Responses = new() @@ -315,15 +291,6 @@ public static OpenApiDocument CreateOpenApiDocument() { OperationType.Patch, new OpenApiOperation { - Tags = new List - { - { - new() - { - Name = "users.user" - } - } - }, OperationId = "users.user.UpdateUser", Summary = "Update entity in users", Responses = new() @@ -339,22 +306,13 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/users/{user-id}/messages/{message-id}"] = new() + [messagesByIdPath] = new() { Operations = new Dictionary { { OperationType.Get, new OpenApiOperation { - Tags = new List - { - { - new() - { - Name = "users.message" - } - } - }, OperationId = "users.GetMessages", Summary = "Get messages from users", Description = "The messages in a mailbox or folder. Read-only. Nullable.", @@ -403,22 +361,13 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/administrativeUnits/{administrativeUnit-id}/microsoft.graph.restore"] = new() + [administrativeUnitRestorePath] = new() { Operations = new Dictionary { { OperationType.Post, new OpenApiOperation { - Tags = new List - { - { - new() - { - Name = "administrativeUnits.Actions" - } - } - }, OperationId = "administrativeUnits.restore", Summary = "Invoke action restore", Parameters = new List @@ -470,22 +419,13 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/applications/{application-id}/logo"] = new() + [logoPath] = new() { Operations = new Dictionary { { OperationType.Put, new OpenApiOperation { - Tags = new List - { - { - new() - { - Name = "applications.application" - } - } - }, OperationId = "applications.application.UpdateLogo", Summary = "Update media content for application in applications", Responses = new() @@ -501,22 +441,13 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/security/hostSecurityProfiles"] = new() + [securityProfilesPath] = new() { Operations = new Dictionary { { OperationType.Get, new OpenApiOperation { - Tags = new List - { - { - new() - { - Name = "security.hostSecurityProfile" - } - } - }, OperationId = "security.ListHostSecurityProfiles", Summary = "Get hostSecurityProfiles from security", Responses = new() @@ -564,22 +495,13 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/communications/calls/{call-id}/microsoft.graph.keepAlive"] = new() + [communicationsCallsKeepAlivePath] = new() { Operations = new Dictionary { { OperationType.Post, new OpenApiOperation { - Tags = new List - { - { - new() - { - Name = "communications.Actions" - } - } - }, OperationId = "communications.calls.call.keepAlive", Summary = "Invoke action keepAlive", Parameters = new List @@ -621,20 +543,13 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/groups/{group-id}/events/{event-id}/calendar/events/microsoft.graph.delta"] = new() + [eventsDeltaPath] = new() { Operations = new Dictionary { { OperationType.Get, new OpenApiOperation { - Tags = new List - { - new() - { - Name = "groups.Functions" - } - }, OperationId = "groups.group.events.event.calendar.events.delta", Summary = "Invoke function delta", Parameters = new List @@ -711,20 +626,13 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - ["/applications/{application-id}/createdOnBehalfOf/$ref"] = new() + [refPath] = new() { Operations = new Dictionary { { OperationType.Get, new OpenApiOperation { - Tags = new List - { - new() - { - Name = "applications.directoryObject" - } - }, OperationId = "applications.GetRefCreatedOnBehalfOf", Summary = "Get ref of createdOnBehalfOf from applications" } @@ -755,8 +663,68 @@ public static OpenApiDocument CreateOpenApiDocument() } } } + }, + Tags = new List + { + new() + { + Name = "reports.Functions", + Description = "The reports.Functions operations" + }, + new() + { + Name = "users.user", + Description = "The users.user operations" + }, + new() + { + Name = "users.message", + Description = "The users.message operations" + }, + new() + { + Name = "administrativeUnits.Actions", + Description = "The administrativeUnits.Actions operations" + }, + new() + { + Name = "applications.application", + Description = "The applications.application operations" + }, + new() + { + Name = "security.hostSecurityProfile", + Description = "The security.hostSecurityProfile operations" + }, + new() + { + Name = "communications.Actions", + Description = "The communications.Actions operations" + }, + new() + { + Name = "groups.Functions", + Description = "The groups.Functions operations" + }, + new() + { + Name = "applications.directoryObject", + Description = "The applications.directoryObject operations" + } } }; + document.Paths[getTeamsActivityByPeriodPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("reports.Functions", document)); + document.Paths[getTeamsActivityByDatePath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("reports.Functions", document)); + document.Paths[usersPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("users.user", document)); + document.Paths[usersByIdPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("users.user", document)); + document.Paths[usersByIdPath].Operations[OperationType.Patch].Tags!.Add(new OpenApiTagReference("users.user", document)); + document.Paths[messagesByIdPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("users.message", document)); + document.Paths[administrativeUnitRestorePath].Operations[OperationType.Post].Tags!.Add(new OpenApiTagReference("administrativeUnits.Actions", document)); + document.Paths[logoPath].Operations[OperationType.Put].Tags!.Add(new OpenApiTagReference("applications.application", document)); + document.Paths[securityProfilesPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("security.hostSecurityProfile", document)); + document.Paths[communicationsCallsKeepAlivePath].Operations[OperationType.Post].Tags!.Add(new OpenApiTagReference("communications.Actions", document)); + document.Paths[eventsDeltaPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("groups.Functions", document)); + document.Paths[refPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("applications.directoryObject", document)); return document; } } From 23885ad448bf3653de518129c088a63eb681d5b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Dec 2024 21:47:22 +0000 Subject: [PATCH 578/752] chore(deps): bump coverlet.collector from 6.0.2 to 6.0.3 Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 6.0.2 to 6.0.3. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.2...v6.0.3) --- updated-dependencies: - dependency-name: coverlet.collector dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index a0cc5337f..7dbfbed6a 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -16,7 +16,7 @@ - + From b2faf7a9d773d99ff7b954beb7bb3af5a84ff6e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 31 Dec 2024 22:17:00 +0000 Subject: [PATCH 579/752] chore(deps): bump coverlet.msbuild from 6.0.2 to 6.0.3 Bumps [coverlet.msbuild](https://github.com/coverlet-coverage/coverlet) from 6.0.2 to 6.0.3. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.2...v6.0.3) --- updated-dependencies: - dependency-name: coverlet.msbuild dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 7dbfbed6a..c04e5b149 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -11,7 +11,7 @@
- + From 5def4966ff4ce66a5c027a2355d8c715a1c98c30 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 21:52:48 +0000 Subject: [PATCH 580/752] chore(deps): bump xunit from 2.9.2 to 2.9.3 Bumps [xunit](https://github.com/xunit/xunit) from 2.9.2 to 2.9.3. - [Commits](https://github.com/xunit/xunit/compare/v2-2.9.2...v2-2.9.3) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index c04e5b149..2a614ea53 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 131a86df8f4326754157ebd7aad8f81d1ca2bbfa Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 8 Jan 2025 17:24:42 -0500 Subject: [PATCH 581/752] fix: inconsistant API surface usage --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 069f8cd67..c7bf1a558 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -113,7 +113,7 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog var walker = new OpenApiWalker(powerShellFormatter); walker.Walk(document); } - WriteOpenApi(options, openApiFormat, openApiVersion, document, logger); + await WriteOpenApiAsync(options, openApiFormat, openApiVersion, document, logger, cancellationToken).ConfigureAwait(false); } catch (TaskCanceledException) { @@ -191,7 +191,7 @@ private static OpenApiDocument ApplyFilters(HidiOptions options, ILogger logger, return document; } - private static void WriteOpenApi(HidiOptions options, OpenApiFormat openApiFormat, OpenApiSpecVersion openApiVersion, OpenApiDocument document, ILogger logger) + private static async Task WriteOpenApiAsync(HidiOptions options, OpenApiFormat openApiFormat, OpenApiSpecVersion openApiVersion, OpenApiDocument document, ILogger logger, CancellationToken cancellationToken) { using (logger.BeginScope("Output")) { @@ -216,11 +216,11 @@ private static void WriteOpenApi(HidiOptions options, OpenApiFormat openApiForma var stopwatch = new Stopwatch(); stopwatch.Start(); - document.Serialize(writer, openApiVersion); + await document.SerializeAsync(writer, openApiVersion, cancellationToken).ConfigureAwait(false); stopwatch.Stop(); logger.LogTrace("Finished serializing in {ElapsedMilliseconds}ms", stopwatch.ElapsedMilliseconds); - textWriter.Flush(); + await textWriter.FlushAsync(cancellationToken).ConfigureAwait(false); } } @@ -769,7 +769,7 @@ internal static async Task PluginManifestAsync(HidiOptions options, ILogger logg // Write OpenAPI to Output folder options.Output = new(Path.Combine(options.OutputFolder, "openapi.json")); options.TerseOutput = true; - WriteOpenApi(options, OpenApiFormat.Json, OpenApiSpecVersion.OpenApi3_1, document, logger); + await WriteOpenApiAsync(options, OpenApiFormat.Json, OpenApiSpecVersion.OpenApi3_1, document, logger, cancellationToken).ConfigureAwait(false); // Create OpenAIPluginManifest from ApiDependency and OpenAPI document var manifest = new OpenAIPluginManifest(document.Info?.Title ?? "Title", document.Info?.Title ?? "Title", "https://go.microsoft.com/fwlink/?LinkID=288890", document.Info?.Contact?.Email ?? "placeholder@contoso.com", document.Info?.License?.Url.ToString() ?? "https://placeholderlicenseurl.com") From 4116f059aa845c50d3075f2d5bb4c671b1e16781 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Jan 2025 21:23:16 +0000 Subject: [PATCH 582/752] chore(deps): bump xunit.runner.visualstudio from 3.0.0 to 3.0.1 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 3.0.0 to 3.0.1. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/3.0.0...3.0.1) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 2a614ea53..ad4dff3fb 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From bb3d79825d9fa888afc15fbd573365a4c6105a94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Jan 2025 21:28:42 +0000 Subject: [PATCH 583/752] chore(deps): bump Microsoft.Extensions.Logging, Microsoft.Extensions.Logging.Abstractions and Microsoft.Extensions.Logging.Debug Bumps [Microsoft.Extensions.Logging](https://github.com/dotnet/runtime), [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime) and [Microsoft.Extensions.Logging.Debug](https://github.com/dotnet/runtime). These dependencies needed to be updated together. Updates `Microsoft.Extensions.Logging` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.1) Updates `Microsoft.Extensions.Logging.Abstractions` from 9.0.0 to 9.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.0...v9.0.1) Updates `Microsoft.Extensions.Logging.Debug` from 8.0.1 to 9.0.1 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v8.0.1...v9.0.1) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Debug dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 52672405e..46c9a1977 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - - + + - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 48538d3b2bc67a4438464454876869af57b5db4b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 15 Jan 2025 09:26:52 -0500 Subject: [PATCH 584/752] chore: removes unused usings Signed-off-by: Vincent Biret --- .../Services/OpenApiFilterServiceTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 12293c4e5..77f2c9ae9 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -3,11 +3,9 @@ using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Models; -using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Tests.UtilityFiles; using Moq; -using SharpYaml.Tokens; using Xunit; namespace Microsoft.OpenApi.Hidi.Tests From c14a440ef8d186f52de7103c0315d418c131b7ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 21:30:48 +0000 Subject: [PATCH 585/752] chore(deps): bump coverlet.msbuild from 6.0.3 to 6.0.4 Bumps [coverlet.msbuild](https://github.com/coverlet-coverage/coverlet) from 6.0.3 to 6.0.4. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.3...v6.0.4) --- updated-dependencies: - dependency-name: coverlet.msbuild dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index ad4dff3fb..c009e1f06 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -11,7 +11,7 @@
- + From 9767a8c09ed3e0b59040f5d4a41161a953c4079d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 21:48:12 +0000 Subject: [PATCH 586/752] chore(deps): bump coverlet.collector from 6.0.3 to 6.0.4 Bumps [coverlet.collector](https://github.com/coverlet-coverage/coverlet) from 6.0.3 to 6.0.4. - [Release notes](https://github.com/coverlet-coverage/coverlet/releases) - [Commits](https://github.com/coverlet-coverage/coverlet/compare/v6.0.3...v6.0.4) --- updated-dependencies: - dependency-name: coverlet.collector dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index c009e1f06..b611d0b32 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -16,7 +16,7 @@ - + From 1d8b9ed8eb54dddde9c5725be588b934040a2bc0 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 21 Jan 2025 09:16:18 +0300 Subject: [PATCH 587/752] Bump preview versions --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 46c9a1977..1e13eb157 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,7 @@ enable hidi ./../../artifacts - 2.0.0-preview4 + 2.0.0-preview5 OpenAPI.NET CLI tool for slicing OpenAPI documents true From 617d18a1ee8282cea70186a034c010a7cf81a3cc Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 24 Jan 2025 13:17:42 -0500 Subject: [PATCH 588/752] fix: proxy design pattern implementation for OpenAPiExample Signed-off-by: Vincent Biret --- .../Services/OpenApiFilterServiceTests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 77f2c9ae9..e8c49bbc8 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Tests.UtilityFiles; using Moq; @@ -243,7 +244,8 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly( // Assert Assert.Same(doc.Servers, subsetOpenApiDocument.Servers); Assert.False(responseHeader?.UnresolvedReference); - Assert.False(mediaTypeExample?.UnresolvedReference); + var exampleReference = Assert.IsType(mediaTypeExample); + Assert.False(exampleReference?.UnresolvedReference); Assert.NotNull(targetHeaders); Assert.Single(targetHeaders); Assert.NotNull(targetExamples); From 0f401be84a1f4fa4a770847dad02db3962ca5d5c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 24 Jan 2025 13:49:34 -0500 Subject: [PATCH 589/752] fix: callback reference proxy implementation --- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index d1f6f7f64..a0dc1ae0e 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Services; namespace Microsoft.OpenApi.Hidi @@ -68,7 +69,7 @@ public override void Visit(OpenApiLink link) public int CallbackCount { get; set; } - public override void Visit(OpenApiCallback callback) + public override void Visit(IOpenApiCallback callback) { CallbackCount++; } From 0c775c18a7c9f8436313ea225806b6da8f421f12 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 24 Jan 2025 14:51:08 -0500 Subject: [PATCH 590/752] fix: Open API header proxy design pattern implementation Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 2 +- .../Services/OpenApiFilterServiceTests.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index a0dc1ae0e..a6ea032f1 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -27,7 +27,7 @@ public override void Visit(OpenApiSchema schema) public int HeaderCount { get; set; } - public override void Visit(IDictionary headers) + public override void Visit(IDictionary headers) { HeaderCount++; } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index e8c49bbc8..8f0d04004 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -243,7 +243,8 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly( // Assert Assert.Same(doc.Servers, subsetOpenApiDocument.Servers); - Assert.False(responseHeader?.UnresolvedReference); + var headerReference = Assert.IsType(responseHeader); + Assert.False(headerReference.UnresolvedReference); var exampleReference = Assert.IsType(mediaTypeExample); Assert.False(exampleReference?.UnresolvedReference); Assert.NotNull(targetHeaders); From 4133fd3d8c22ded9615919ceac962ae7ab7b7fbd Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 24 Jan 2025 15:30:48 -0500 Subject: [PATCH 591/752] fix: open API link reference proxy design pattern implementation Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index a6ea032f1..700918f4e 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -62,7 +62,7 @@ public override void Visit(OpenApiOperation operation) public int LinkCount { get; set; } - public override void Visit(OpenApiLink link) + public override void Visit(IOpenApiLink link) { LinkCount++; } From ace09e0bca13e4cc9fc0692e5f9e58afa85fd6b1 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 24 Jan 2025 17:33:09 -0500 Subject: [PATCH 592/752] fix: parameter reference proxy design pattern implementation Signed-off-by: Vincent Biret --- .../Formatters/PowerShellFormatter.cs | 14 ++++---- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 2 +- .../Formatters/PowerShellFormatterTests.cs | 9 ++--- .../Services/OpenApiFilterServiceTests.cs | 9 ++--- .../UtilityFiles/OpenApiDocumentMock.cs | 35 ++++++++++--------- 5 files changed, 36 insertions(+), 33 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index c2bbc97d0..109799381 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -7,6 +7,7 @@ using Humanizer.Inflections; using Microsoft.OpenApi.Hidi.Extensions; using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Services; namespace Microsoft.OpenApi.Hidi.Formatters @@ -69,13 +70,13 @@ public override void Visit(OpenApiOperation operation) var operationId = operation.OperationId; var operationTypeExtension = operation.Extensions?.GetExtension("x-ms-docs-operation-type"); - if (operationTypeExtension.IsEquals("function")) - operation.Parameters = ResolveFunctionParameters(operation.Parameters ?? new List()); + if (operationTypeExtension.IsEquals("function") && operation.Parameters is { Count :> 0}) + ResolveFunctionParameters(operation.Parameters); // Order matters. Resolve operationId. operationId = RemoveHashSuffix(operationId); if (operationTypeExtension.IsEquals("action") || operationTypeExtension.IsEquals("function")) - operationId = RemoveKeyTypeSegment(operationId, operation.Parameters ?? new List()); + operationId = RemoveKeyTypeSegment(operationId, operation.Parameters ?? new List()); operationId = SingularizeAndDeduplicateOperationId(operationId.SplitByChar('.')); operationId = ResolveODataCastOperationId(operationId); operationId = ResolveByRefOperationId(operationId); @@ -143,7 +144,7 @@ private static string RemoveHashSuffix(string operationId) return s_hashSuffixRegex.Match(operationId).Value; } - private static string RemoveKeyTypeSegment(string operationId, IList parameters) + private static string RemoveKeyTypeSegment(string operationId, IList parameters) { var segments = operationId.SplitByChar('.'); foreach (var parameter in parameters) @@ -157,9 +158,9 @@ private static string RemoveKeyTypeSegment(string operationId, IList ResolveFunctionParameters(IList parameters) + private static void ResolveFunctionParameters(IList parameters) { - foreach (var parameter in parameters.Where(static p => p.Content?.Any() ?? false)) + foreach (var parameter in parameters.OfType().Where(static p => p.Content?.Any() ?? false)) { // Replace content with a schema object of type array // for structured or collection-valued function parameters @@ -173,7 +174,6 @@ private static IList ResolveFunctionParameters(IList - { - new() + Parameters = + [ + new OpenApiParameter() { Name = "ids", In = ParameterLocation.Query, @@ -133,7 +134,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() } } } - }, + ], Extensions = new Dictionary { { diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 8f0d04004..0dceb6127 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Tests.UtilityFiles; @@ -121,9 +122,9 @@ public void CreateFilteredDocumentUsingPredicateFromRequestUrl() { OperationType.Get, new() }, { OperationType.Patch, new() } }, - Parameters = new List - { - new() + Parameters = + [ + new OpenApiParameter() { Name = "id", In = ParameterLocation.Path, @@ -133,7 +134,7 @@ public void CreateFilteredDocumentUsingPredicateFromRequestUrl() Type = JsonSchemaType.String } } - } + ] } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index edbf143fe..f2f6386c4 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -4,6 +4,7 @@ using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Models.References; namespace Microsoft.OpenApi.Tests.UtilityFiles @@ -78,10 +79,10 @@ public static OpenApiDocument CreateOpenApiDocument() { OperationId = "reports.getTeamsUserActivityCounts", Summary = "Invoke function getTeamsUserActivityUserCounts", - Parameters = new List + Parameters = new List { { - new() + new OpenApiParameter() { Name = "period", In = ParameterLocation.Path, @@ -118,10 +119,10 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Parameters = new List + Parameters = new List { { - new() + new OpenApiParameter() { Name = "period", In = ParameterLocation.Path, @@ -143,10 +144,10 @@ public static OpenApiDocument CreateOpenApiDocument() { OperationId = "reports.getTeamsUserActivityUserDetail-a3f1", Summary = "Invoke function getTeamsUserActivityUserDetail", - Parameters = new List + Parameters = new List { { - new() + new OpenApiParameter() { Name = "period", In = ParameterLocation.Path, @@ -183,9 +184,9 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Parameters = new List + Parameters = new List { - new() + new OpenApiParameter() { Name = "period", In = ParameterLocation.Path, @@ -316,9 +317,9 @@ public static OpenApiDocument CreateOpenApiDocument() OperationId = "users.GetMessages", Summary = "Get messages from users", Description = "The messages in a mailbox or folder. Read-only. Nullable.", - Parameters = new List + Parameters = new List { - new() + new OpenApiParameter() { Name = "$select", In = ParameterLocation.Query, @@ -370,10 +371,10 @@ public static OpenApiDocument CreateOpenApiDocument() { OperationId = "administrativeUnits.restore", Summary = "Invoke action restore", - Parameters = new List + Parameters = new List { { - new() + new OpenApiParameter() { Name = "administrativeUnit-id", In = ParameterLocation.Path, @@ -504,9 +505,9 @@ public static OpenApiDocument CreateOpenApiDocument() { OperationId = "communications.calls.call.keepAlive", Summary = "Invoke action keepAlive", - Parameters = new List + Parameters = new List { - new() + new OpenApiParameter() { Name = "call-id", In = ParameterLocation.Path, @@ -552,9 +553,9 @@ public static OpenApiDocument CreateOpenApiDocument() { OperationId = "groups.group.events.event.calendar.events.delta", Summary = "Invoke function delta", - Parameters = new List + Parameters = new List { - new() + new OpenApiParameter() { Name = "group-id", In = ParameterLocation.Path, @@ -571,7 +572,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - new() + new OpenApiParameter() { Name = "event-id", In = ParameterLocation.Path, From e4bb0701e2bba62fb722cb08d90cce2ddec9d4bf Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 27 Jan 2025 12:21:56 -0500 Subject: [PATCH 593/752] fix: path item reference implementation Signed-off-by: Vincent Biret --- .../Formatters/PowerShellFormatter.cs | 6 ++--- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 2 +- .../Formatters/PowerShellFormatterTests.cs | 4 ++-- .../Services/OpenApiFilterServiceTests.cs | 4 ++-- .../UtilityFiles/OpenApiDocumentMock.cs | 24 +++++++++---------- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index 109799381..a6b6380d6 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -51,7 +51,7 @@ public override void Visit(OpenApiSchema schema) base.Visit(schema); } - public override void Visit(OpenApiPathItem pathItem) + public override void Visit(IOpenApiPathItem pathItem) { if (pathItem.Operations.TryGetValue(OperationType.Put, out var value) && value.OperationId != null) @@ -81,13 +81,13 @@ public override void Visit(OpenApiOperation operation) operationId = ResolveODataCastOperationId(operationId); operationId = ResolveByRefOperationId(operationId); // Verb segment resolution should always be last. user.get -> user_Get - operationId = ResolveVerbSegmentInOpertationId(operationId); + operationId = ResolveVerbSegmentInOperationId(operationId); operation.OperationId = operationId; base.Visit(operation); } - private static string ResolveVerbSegmentInOpertationId(string operationId) + private static string ResolveVerbSegmentInOperationId(string operationId) { var charPos = operationId.LastIndexOf('.', operationId.Length - 1); if (operationId.Contains('_', StringComparison.OrdinalIgnoreCase) || charPos < 0) diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index 7ffe77062..53f52ab3d 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -34,7 +34,7 @@ public override void Visit(IDictionary headers) public int PathItemCount { get; set; } - public override void Visit(OpenApiPathItem pathItem) + public override void Visit(IOpenApiPathItem pathItem) { PathItemCount++; } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 8d0e6010a..abf7232d1 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -28,7 +28,7 @@ public void FormatOperationIdsInOpenAPIDocument(string operationId, string expec Servers = new List { new() { Url = "https://localhost/" } }, Paths = new() { - { path, new() { + { path, new OpenApiPathItem() { Operations = new Dictionary { { operationType, new() { OperationId = operationId } } @@ -102,7 +102,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() Info = new() { Title = "Test", Version = "1.0" }, Servers = new List { new() { Url = "https://localhost/" } }, Paths = new() { - { "/foo", new() + { "/foo", new OpenApiPathItem() { Operations = new Dictionary { diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 0dceb6127..ca4416ae6 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -78,7 +78,7 @@ public void TestPredicateFiltersUsingRelativeRequestUrls() Servers = new List { new() { Url = "https://localhost/" } }, Paths = new() { - {"/foo", new() { + {"/foo", new OpenApiPathItem() { Operations = new Dictionary { { OperationType.Get, new() }, @@ -115,7 +115,7 @@ public void CreateFilteredDocumentUsingPredicateFromRequestUrl() Servers = new List { new() { Url = "https://localhost/" } }, Paths = new() { - ["/test/{id}"] = new() + ["/test/{id}"] = new OpenApiPathItem() { Operations = new Dictionary { diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index f2f6386c4..3c3644adf 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -49,7 +49,7 @@ public static OpenApiDocument CreateOpenApiDocument() }, Paths = new() { - ["/"] = new() // root path + ["/"] = new OpenApiPathItem() // root path { Operations = new Dictionary { @@ -70,7 +70,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - [getTeamsActivityByPeriodPath] = new() + [getTeamsActivityByPeriodPath] = new OpenApiPathItem() { Operations = new Dictionary { @@ -135,7 +135,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - [getTeamsActivityByDatePath] = new() + [getTeamsActivityByDatePath] = new OpenApiPathItem() { Operations = new Dictionary { @@ -198,7 +198,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - [usersPath] = new() + [usersPath] = new OpenApiPathItem() { Operations = new Dictionary { @@ -252,7 +252,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - [usersByIdPath] = new() + [usersByIdPath] = new OpenApiPathItem() { Operations = new Dictionary { @@ -307,7 +307,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - [messagesByIdPath] = new() + [messagesByIdPath] = new OpenApiPathItem() { Operations = new Dictionary { @@ -362,7 +362,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - [administrativeUnitRestorePath] = new() + [administrativeUnitRestorePath] = new OpenApiPathItem() { Operations = new Dictionary { @@ -420,7 +420,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - [logoPath] = new() + [logoPath] = new OpenApiPathItem() { Operations = new Dictionary { @@ -442,7 +442,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - [securityProfilesPath] = new() + [securityProfilesPath] = new OpenApiPathItem() { Operations = new Dictionary { @@ -496,7 +496,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - [communicationsCallsKeepAlivePath] = new() + [communicationsCallsKeepAlivePath] = new OpenApiPathItem() { Operations = new Dictionary { @@ -544,7 +544,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - [eventsDeltaPath] = new() + [eventsDeltaPath] = new OpenApiPathItem() { Operations = new Dictionary { @@ -627,7 +627,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - [refPath] = new() + [refPath] = new OpenApiPathItem() { Operations = new Dictionary { From 97e84e0bd61442aa3342f971b0950d1e3b6a7e93 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 27 Jan 2025 13:40:17 -0500 Subject: [PATCH 594/752] fix: proxy design pattern implementation for request body Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index 53f52ab3d..645f94319 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -41,7 +41,7 @@ public override void Visit(IOpenApiPathItem pathItem) public int RequestBodyCount { get; set; } - public override void Visit(OpenApiRequestBody requestBody) + public override void Visit(IOpenApiRequestBody requestBody) { RequestBodyCount++; } From 2d3df83c5ac038fec06666b60db120bfee7ec373 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 27 Jan 2025 15:27:58 -0500 Subject: [PATCH 595/752] fix: response reference proxy design pattern implementation Signed-off-by: Vincent Biret --- .../UtilityFiles/OpenApiDocumentMock.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 3c3644adf..0d25c7704 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -60,7 +60,7 @@ public static OpenApiDocument CreateOpenApiDocument() Responses = new() { { - "200",new() + "200",new OpenApiResponse() { Description = "OK" } @@ -97,7 +97,7 @@ public static OpenApiDocument CreateOpenApiDocument() Responses = new() { { - "200", new() + "200", new OpenApiResponse() { Description = "Success", Content = new Dictionary @@ -162,7 +162,7 @@ public static OpenApiDocument CreateOpenApiDocument() Responses = new() { { - "200", new() + "200", new OpenApiResponse() { Description = "Success", Content = new Dictionary @@ -210,7 +210,7 @@ public static OpenApiDocument CreateOpenApiDocument() Responses = new() { { - "200", new() + "200", new OpenApiResponse() { Description = "Retrieved entities", Content = new Dictionary @@ -264,7 +264,7 @@ public static OpenApiDocument CreateOpenApiDocument() Responses = new() { { - "200", new() + "200", new OpenApiResponse() { Description = "Retrieved entity", Content = new Dictionary @@ -297,7 +297,7 @@ public static OpenApiDocument CreateOpenApiDocument() Responses = new() { { - "204", new() + "204", new OpenApiResponse() { Description = "Success" } @@ -335,7 +335,7 @@ public static OpenApiDocument CreateOpenApiDocument() Responses = new() { { - "200", new() + "200", new OpenApiResponse() { Description = "Retrieved navigation property", Content = new Dictionary @@ -390,7 +390,7 @@ public static OpenApiDocument CreateOpenApiDocument() Responses = new() { { - "200", new() + "200", new OpenApiResponse() { Description = "Success", Content = new Dictionary @@ -432,7 +432,7 @@ public static OpenApiDocument CreateOpenApiDocument() Responses = new() { { - "204", new() + "204", new OpenApiResponse() { Description = "Success" } @@ -454,7 +454,7 @@ public static OpenApiDocument CreateOpenApiDocument() Responses = new() { { - "200", new() + "200", new OpenApiResponse() { Description = "Retrieved navigation property", Content = new Dictionary @@ -528,7 +528,7 @@ public static OpenApiDocument CreateOpenApiDocument() Responses = new() { { - "204", new() + "204", new OpenApiResponse() { Description = "Success" } @@ -593,7 +593,7 @@ public static OpenApiDocument CreateOpenApiDocument() Responses = new() { { - "200", new() + "200", new OpenApiResponse() { Description = "Success", Content = new Dictionary From 73dc49f6b670c1f31138dcfce019c79d0abc109d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 28 Jan 2025 16:52:02 -0500 Subject: [PATCH 596/752] fix: open api schema reference proxy design pattern implementation Signed-off-by: Vincent Biret --- .../Formatters/PowerShellFormatter.cs | 46 ++++------ src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 2 +- .../Formatters/PowerShellFormatterTests.cs | 20 ++-- .../Services/OpenApiFilterServiceTests.cs | 2 +- .../UtilityFiles/OpenApiDocumentMock.cs | 91 +++++++------------ 5 files changed, 64 insertions(+), 97 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index a6b6380d6..2224f6f96 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -16,7 +16,7 @@ internal class PowerShellFormatter : OpenApiVisitorBase { private const string DefaultPutPrefix = ".Update"; private const string PowerShellPutPrefix = ".Set"; - private readonly Stack _schemaLoop = new(); + private readonly Stack _schemaLoop = new(); private static readonly Regex s_oDataCastRegex = new("(.*(?<=[a-z]))\\.(As(?=[A-Z]).*)", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); private static readonly Regex s_hashSuffixRegex = new(@"^[^-]+", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); private static readonly Regex s_oDataRefRegex = new("(?<=[a-z])Ref(?=[A-Z])", RegexOptions.Compiled, TimeSpan.FromSeconds(5)); @@ -42,7 +42,7 @@ static PowerShellFormatter() // 5. Fix anyOf and oneOf schema. // 6. Add AdditionalProperties to object schemas. - public override void Visit(OpenApiSchema schema) + public override void Visit(IOpenApiSchema schema) { AddAdditionalPropertiesToSchema(schema); ResolveAnyOfSchema(schema); @@ -165,10 +165,10 @@ private static void ResolveFunctionParameters(IList parameter // Replace content with a schema object of type array // for structured or collection-valued function parameters parameter.Content = null; - parameter.Schema = new() + parameter.Schema = new OpenApiSchema() { Type = JsonSchemaType.Array, - Items = new() + Items = new OpenApiSchema() { Type = JsonSchemaType.String } @@ -176,11 +176,11 @@ private static void ResolveFunctionParameters(IList parameter } } - private void AddAdditionalPropertiesToSchema(OpenApiSchema schema) + private void AddAdditionalPropertiesToSchema(IOpenApiSchema schema) { - if (schema != null && !_schemaLoop.Contains(schema) && schema.Type.Equals(JsonSchemaType.Object)) + if (schema is OpenApiSchema openApiSchema && !_schemaLoop.Contains(schema) && schema.Type.Equals(JsonSchemaType.Object)) { - schema.AdditionalProperties = new() { Type = JsonSchemaType.Object }; + openApiSchema.AdditionalProperties = new OpenApiSchema() { Type = JsonSchemaType.Object }; /* Because 'additionalProperties' are now being walked, * we need a way to keep track of visited schemas to avoid @@ -190,39 +190,29 @@ private void AddAdditionalPropertiesToSchema(OpenApiSchema schema) } } - private static void ResolveOneOfSchema(OpenApiSchema schema) + private static void ResolveOneOfSchema(IOpenApiSchema schema) { - if (schema.OneOf?.FirstOrDefault() is { } newSchema) + if (schema is OpenApiSchema openApiSchema && schema.OneOf?.FirstOrDefault() is OpenApiSchema newSchema) { - schema.OneOf = null; - FlattenSchema(schema, newSchema); + openApiSchema.OneOf = null; + FlattenSchema(openApiSchema, newSchema); } } - private static void ResolveAnyOfSchema(OpenApiSchema schema) + private static void ResolveAnyOfSchema(IOpenApiSchema schema) { - if (schema.AnyOf?.FirstOrDefault() is { } newSchema) + if (schema is OpenApiSchema openApiSchema && schema.AnyOf?.FirstOrDefault() is OpenApiSchema newSchema) { - schema.AnyOf = null; - FlattenSchema(schema, newSchema); + openApiSchema.AnyOf = null; + FlattenSchema(openApiSchema, newSchema); } } private static void FlattenSchema(OpenApiSchema schema, OpenApiSchema newSchema) { - if (newSchema != null) - { - if (newSchema.Reference != null) - { - schema.Reference = newSchema.Reference; - schema.UnresolvedReference = true; - } - else - { - // Copies schema properties based on https://github.com/microsoft/OpenAPI.NET.OData/pull/264. - CopySchema(schema, newSchema); - } - } + if (newSchema is null) return; + // Copies schema properties based on https://github.com/microsoft/OpenAPI.NET.OData/pull/264. + CopySchema(schema, newSchema); } private static void CopySchema(OpenApiSchema schema, OpenApiSchema newSchema) diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index 645f94319..d157a6c42 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -20,7 +20,7 @@ public override void Visit(IOpenApiParameter parameter) public int SchemaCount { get; set; } - public override void Visit(OpenApiSchema schema) + public override void Visit(IOpenApiSchema schema) { SchemaCount++; } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index abf7232d1..f868dfa07 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -122,10 +122,10 @@ private static OpenApiDocument GetSampleOpenApiDocument() "application/json", new OpenApiMediaType { - Schema = new() + Schema = new OpenApiSchema() { Type = JsonSchemaType.Array, - Items = new() + Items = new OpenApiSchema() { Type = JsonSchemaType.String } @@ -149,20 +149,20 @@ private static OpenApiDocument GetSampleOpenApiDocument() }, Components = new() { - Schemas = new Dictionary + Schemas = new Dictionary { { "TestSchema", new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new Dictionary + Properties = new Dictionary { { "averageAudioDegradation", new OpenApiSchema { - AnyOf = new List + AnyOf = new List { - new() { Type = JsonSchemaType.Number }, - new() { Type = JsonSchemaType.String } + new OpenApiSchema() { Type = JsonSchemaType.Number }, + new OpenApiSchema() { Type = JsonSchemaType.String } }, Format = "float", Nullable = true @@ -171,10 +171,10 @@ private static OpenApiDocument GetSampleOpenApiDocument() { "defaultPrice", new OpenApiSchema { - OneOf = new List + OneOf = new List { - new() { Type = JsonSchemaType.Number, Format = "double" }, - new() { Type = JsonSchemaType.String } + new OpenApiSchema() { Type = JsonSchemaType.Number, Format = "double" }, + new OpenApiSchema() { Type = JsonSchemaType.String } } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index ca4416ae6..a3494ba13 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -129,7 +129,7 @@ public void CreateFilteredDocumentUsingPredicateFromRequestUrl() Name = "id", In = ParameterLocation.Path, Required = true, - Schema = new() + Schema = new OpenApiSchema() { Type = JsonSchemaType.String } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 0d25c7704..b5289c1ef 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -87,7 +87,7 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new() + Schema = new OpenApiSchema() { Type = JsonSchemaType.String } @@ -106,7 +106,7 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new() + Schema = new OpenApiSchema() { Type = JsonSchemaType.Array } @@ -127,7 +127,7 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new() + Schema = new OpenApiSchema() { Type = JsonSchemaType.String } @@ -152,7 +152,7 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new() + Schema = new OpenApiSchema() { Type = JsonSchemaType.String } @@ -171,7 +171,7 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new() + Schema = new OpenApiSchema() { Type = JsonSchemaType.Array } @@ -191,7 +191,7 @@ public static OpenApiDocument CreateOpenApiDocument() Name = "period", In = ParameterLocation.Path, Required = true, - Schema = new() + Schema = new OpenApiSchema() { Type = JsonSchemaType.String } @@ -219,25 +219,17 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new() + Schema = new OpenApiSchema() { Title = "Collection of user", Type = JsonSchemaType.Object, - Properties = new Dictionary + Properties = new Dictionary { { "value", new OpenApiSchema { Type = JsonSchemaType.Array, - Items = new() - { - Reference = new() - { - Type = ReferenceType.Schema, - Id = "microsoft.graph.user" - } - } } } } @@ -273,14 +265,6 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new() - { - Reference = new() - { - Type = ReferenceType.Schema, - Id = "microsoft.graph.user" - } - } } } } @@ -325,7 +309,7 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Query, Required = true, Description = "Select properties to be returned", - Schema = new() + Schema = new OpenApiSchema() { Type = JsonSchemaType.Array } @@ -344,14 +328,6 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new() - { - Reference = new() - { - Type = ReferenceType.Schema, - Id = "microsoft.graph.message" - } - } } } } @@ -380,7 +356,7 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Required = true, Description = "key: id of administrativeUnit", - Schema = new() + Schema = new OpenApiSchema() { Type = JsonSchemaType.String } @@ -399,11 +375,11 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new() + Schema = new OpenApiSchema() { - AnyOf = new List + AnyOf = new List { - new() + new OpenApiSchema() { Type = JsonSchemaType.String } @@ -463,25 +439,17 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new() + Schema = new OpenApiSchema() { Title = "Collection of hostSecurityProfile", Type = JsonSchemaType.Object, - Properties = new Dictionary + Properties = new Dictionary { { "value", new OpenApiSchema { Type = JsonSchemaType.Array, - Items = new() - { - Reference = new() - { - Type = ReferenceType.Schema, - Id = "microsoft.graph.networkInterface" - } - } } } } @@ -513,7 +481,7 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Description = "key: id of call", Required = true, - Schema = new() + Schema = new OpenApiSchema() { Type = JsonSchemaType.String }, @@ -561,7 +529,7 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Description = "key: id of group", Required = true, - Schema = new() + Schema = new OpenApiSchema() { Type = JsonSchemaType.String }, @@ -578,7 +546,7 @@ public static OpenApiDocument CreateOpenApiDocument() In = ParameterLocation.Path, Description = "key: id of event", Required = true, - Schema = new() + Schema = new OpenApiSchema() { Type = JsonSchemaType.String }, @@ -602,13 +570,17 @@ public static OpenApiDocument CreateOpenApiDocument() applicationJsonMediaType, new OpenApiMediaType { - Schema = new() + Schema = new OpenApiSchema() { - Type = JsonSchemaType.Array, - Reference = new() + Properties = new Dictionary { - Type = ReferenceType.Schema, - Id = "microsoft.graph.event" + { + "value", + new OpenApiSchema + { + Type = JsonSchemaType.Array, + } + } } } } @@ -643,14 +615,14 @@ public static OpenApiDocument CreateOpenApiDocument() }, Components = new() { - Schemas = new Dictionary + Schemas = new Dictionary { { "microsoft.graph.networkInterface", new OpenApiSchema { Title = "networkInterface", Type = JsonSchemaType.Object, - Properties = new Dictionary + Properties = new Dictionary { { "description", new OpenApiSchema @@ -726,6 +698,11 @@ public static OpenApiDocument CreateOpenApiDocument() document.Paths[communicationsCallsKeepAlivePath].Operations[OperationType.Post].Tags!.Add(new OpenApiTagReference("communications.Actions", document)); document.Paths[eventsDeltaPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("groups.Functions", document)); document.Paths[refPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("applications.directoryObject", document)); + ((OpenApiSchema)document.Paths[usersPath].Operations[OperationType.Get].Responses!["200"].Content[applicationJsonMediaType].Schema!.Properties["value"]).Items = new OpenApiSchemaReference("microsoft.graph.user", document); + document.Paths[usersByIdPath].Operations[OperationType.Get].Responses!["200"].Content[applicationJsonMediaType].Schema = new OpenApiSchemaReference("microsoft.graph.user", document); + document.Paths[messagesByIdPath].Operations[OperationType.Get].Responses!["200"].Content[applicationJsonMediaType].Schema = new OpenApiSchemaReference("microsoft.graph.message", document); + ((OpenApiSchema)document.Paths[securityProfilesPath].Operations[OperationType.Get].Responses!["200"].Content[applicationJsonMediaType].Schema!.Properties["value"]).Items = new OpenApiSchemaReference("microsoft.graph.networkInterface", document); + ((OpenApiSchema)document.Paths[eventsDeltaPath].Operations[OperationType.Get].Responses!["200"].Content[applicationJsonMediaType].Schema!.Properties["value"]).Items = new OpenApiSchemaReference("microsoft.graph.event", document); return document; } } From 72f22baa8935e8567af01ad475b2032238e1443c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 3 Feb 2025 10:00:40 -0500 Subject: [PATCH 597/752] ci: adds release please configuration Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 1e13eb157..b4bfa6189 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -9,7 +9,6 @@ enable hidi ./../../artifacts - 2.0.0-preview5 OpenAPI.NET CLI tool for slicing OpenAPI documents true From ef7eb17319beb1cbd481a04d209e4f47225c53a0 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 3 Feb 2025 14:55:47 -0500 Subject: [PATCH 598/752] fix: removes nullable property that shouldn't be part of dom --- .../Formatters/PowerShellFormatter.cs | 1 - .../Formatters/PowerShellFormatterTests.cs | 24 ++++++++++--------- .../UtilityFiles/OpenApiDocumentMock.cs | 12 ++-------- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index 2224f6f96..df632b78a 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -243,7 +243,6 @@ private static void CopySchema(OpenApiSchema schema, OpenApiSchema newSchema) schema.Enum ??= newSchema.Enum; schema.ReadOnly = !schema.ReadOnly ? newSchema.ReadOnly : schema.ReadOnly; schema.WriteOnly = !schema.WriteOnly ? newSchema.WriteOnly : schema.WriteOnly; - schema.Nullable = !schema.Nullable ? newSchema.Nullable : schema.Nullable; schema.Deprecated = !schema.Deprecated ? newSchema.Deprecated : schema.Deprecated; } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index f868dfa07..cad3b4548 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -58,21 +58,23 @@ public void RemoveAnyOfAndOneOfFromSchema() var walker = new OpenApiWalker(powerShellFormatter); walker.Walk(openApiDocument); - var testSchema = openApiDocument.Components?.Schemas?["TestSchema"]; - var averageAudioDegradationProperty = testSchema?.Properties["averageAudioDegradation"]; - var defaultPriceProperty = testSchema?.Properties["defaultPrice"]; + Assert.NotNull(openApiDocument.Components); + Assert.NotNull(openApiDocument.Components.Schemas); + var testSchema = openApiDocument.Components.Schemas["TestSchema"]; + var averageAudioDegradationProperty = testSchema.Properties["averageAudioDegradation"]; + var defaultPriceProperty = testSchema.Properties["defaultPrice"]; // Assert Assert.NotNull(openApiDocument.Components); Assert.NotNull(openApiDocument.Components.Schemas); Assert.NotNull(testSchema); - Assert.Null(averageAudioDegradationProperty?.AnyOf); - Assert.Equal(JsonSchemaType.Number, averageAudioDegradationProperty?.Type); - Assert.Equal("float", averageAudioDegradationProperty?.Format); - Assert.True(averageAudioDegradationProperty?.Nullable); - Assert.Null(defaultPriceProperty?.OneOf); - Assert.Equal(JsonSchemaType.Number, defaultPriceProperty?.Type); - Assert.Equal("double", defaultPriceProperty?.Format); + Assert.Null(averageAudioDegradationProperty.AnyOf); + Assert.Equal(JsonSchemaType.Number, averageAudioDegradationProperty.Type); + Assert.Equal("float", averageAudioDegradationProperty.Format); + Assert.Equal(JsonSchemaType.Null, averageAudioDegradationProperty.Type & JsonSchemaType.Null); + Assert.Null(defaultPriceProperty.OneOf); + Assert.Equal(JsonSchemaType.Number, defaultPriceProperty.Type); + Assert.Equal("double", defaultPriceProperty.Format); Assert.NotNull(testSchema.AdditionalProperties); } @@ -165,7 +167,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() new OpenApiSchema() { Type = JsonSchemaType.String } }, Format = "float", - Nullable = true + Type = JsonSchemaType.Number | JsonSchemaType.Null | JsonSchemaType.String } }, { diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index b5289c1ef..3f81c71a3 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -377,14 +377,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Schema = new OpenApiSchema() { - AnyOf = new List - { - new OpenApiSchema() - { - Type = JsonSchemaType.String - } - }, - Nullable = true + Type = JsonSchemaType.String | JsonSchemaType.Null } } } @@ -627,9 +620,8 @@ public static OpenApiDocument CreateOpenApiDocument() { "description", new OpenApiSchema { - Type = JsonSchemaType.String, + Type = JsonSchemaType.String | JsonSchemaType.Null, Description = "Description of the NIC (e.g. Ethernet adapter, Wireless LAN adapter Local Area Connection <#>, etc.).", - Nullable = true } } } From c70894e6511a155fa639629bc17796a32a3d115a Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 3 Feb 2025 15:34:07 -0500 Subject: [PATCH 599/752] fix: multiple unit test failures Signed-off-by: Vincent Biret --- .../Formatters/PowerShellFormatterTests.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index cad3b4548..da6d8c61e 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -69,7 +69,7 @@ public void RemoveAnyOfAndOneOfFromSchema() Assert.NotNull(openApiDocument.Components.Schemas); Assert.NotNull(testSchema); Assert.Null(averageAudioDegradationProperty.AnyOf); - Assert.Equal(JsonSchemaType.Number, averageAudioDegradationProperty.Type); + Assert.Equal(JsonSchemaType.Number | JsonSchemaType.Null, averageAudioDegradationProperty.Type); Assert.Equal("float", averageAudioDegradationProperty.Format); Assert.Equal(JsonSchemaType.Null, averageAudioDegradationProperty.Type & JsonSchemaType.Null); Assert.Null(defaultPriceProperty.OneOf); @@ -163,11 +163,10 @@ private static OpenApiDocument GetSampleOpenApiDocument() { AnyOf = new List { - new OpenApiSchema() { Type = JsonSchemaType.Number }, + new OpenApiSchema() { Type = JsonSchemaType.Number | JsonSchemaType.Null }, new OpenApiSchema() { Type = JsonSchemaType.String } }, Format = "float", - Type = JsonSchemaType.Number | JsonSchemaType.Null | JsonSchemaType.String } }, { From b5a0620c6903f88021eb6e4041c0db194e0f2553 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 5 Feb 2025 14:10:04 +0300 Subject: [PATCH 600/752] Remove unnecessary format param; clean up extra semi-colon --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index c7bf1a558..c757f4031 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -254,7 +254,7 @@ private static async Task GetOpenApiAsync(HidiOptions options, else if (!string.IsNullOrEmpty(options.OpenApi)) { stream = await GetStreamAsync(options.OpenApi, logger, cancellationToken).ConfigureAwait(false); - var result = await ParseOpenApiAsync(options.OpenApi, format, options.InlineExternal, logger, stream, cancellationToken).ConfigureAwait(false); + var result = await ParseOpenApiAsync(options.OpenApi, options.InlineExternal, logger, stream, cancellationToken).ConfigureAwait(false); document = result.Document; } else throw new InvalidOperationException("No input file path or URL provided"); @@ -351,8 +351,7 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe try { using var stream = await GetStreamAsync(openApi, logger, cancellationToken).ConfigureAwait(false); - var openApiFormat = !string.IsNullOrEmpty(openApi) ? GetOpenApiFormat(openApi, logger) : OpenApiFormat.Yaml; - result = await ParseOpenApiAsync(openApi, openApiFormat.GetDisplayName(),false, logger, stream, cancellationToken).ConfigureAwait(false); + result = await ParseOpenApiAsync(openApi, false, logger, stream, cancellationToken).ConfigureAwait(false); using (logger.BeginScope("Calculating statistics")) { @@ -380,7 +379,7 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe return result.Diagnostic.Errors.Count == 0; } - private static async Task ParseOpenApiAsync(string openApiFile, string format, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken = default) + private static async Task ParseOpenApiAsync(string openApiFile, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken = default) { ReadResult result; var stopwatch = Stopwatch.StartNew(); @@ -396,7 +395,7 @@ private static async Task ParseOpenApiAsync(string openApiFile, stri new Uri("file://" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar) }; - result = await OpenApiDocument.LoadAsync(stream, format, settings, cancellationToken).ConfigureAwait(false); + result = await OpenApiDocument.LoadAsync(stream, settings: settings, cancellationToken: cancellationToken).ConfigureAwait(false); logger.LogTrace("{Timestamp}ms: Completed parsing.", stopwatch.ElapsedMilliseconds); From f9198fa37414656320de6d193e74ad83295de322 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Feb 2025 21:42:40 +0000 Subject: [PATCH 601/752] chore(deps): bump xunit.runner.visualstudio from 3.0.1 to 3.0.2 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 3.0.1 to 3.0.2. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/3.0.1...3.0.2) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index b611d0b32..4bdb251c0 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From 0279cca6708e4dfaaae4b9e451944ac8704cde51 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Feb 2025 21:41:05 +0000 Subject: [PATCH 602/752] chore(deps): bump Microsoft.NET.Test.Sdk from 17.12.0 to 17.13.0 Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.12.0 to 17.13.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.12.0...v17.13.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 4bdb251c0..13e98bc0e 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -12,7 +12,7 @@ - + From 3fd5a0ebaf2fb215f8727695e1043a751a5ad5f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 21:53:56 +0000 Subject: [PATCH 603/752] chore(deps): bump Microsoft.Extensions.Logging, Microsoft.Extensions.Logging.Abstractions and Microsoft.Extensions.Logging.Debug Bumps [Microsoft.Extensions.Logging](https://github.com/dotnet/runtime), [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime) and [Microsoft.Extensions.Logging.Debug](https://github.com/dotnet/runtime). These dependencies needed to be updated together. Updates `Microsoft.Extensions.Logging` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2) Updates `Microsoft.Extensions.Logging.Abstractions` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2) Updates `Microsoft.Extensions.Logging.Debug` from 9.0.1 to 9.0.2 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.1...v9.0.2) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Debug dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b4bfa6189..e895ef57b 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -28,10 +28,10 @@ - - + + - + runtime; build; native; contentfiles; analyzers; buildtransitive all From df15756c697dfa17ec7ad7eb20e760551eae4403 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 22:00:23 +0000 Subject: [PATCH 604/752] chore(deps): bump Microsoft.OData.Edm, Microsoft.OpenApi.OData and System.Text.Json Bumps Microsoft.OData.Edm, [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET) and [System.Text.Json](https://github.com/dotnet/runtime). These dependencies needed to be updated together. Updates `Microsoft.OData.Edm` from 8.2.3 to 8.2.3 Updates `Microsoft.OpenApi.OData` from 2.0.0-preview.7 to 2.0.0-preview8 - [Release notes](https://github.com/Microsoft/OpenAPI.NET/releases) - [Changelog](https://github.com/microsoft/OpenAPI.NET/blob/main/CHANGELOG.md) - [Commits](https://github.com/Microsoft/OpenAPI.NET/commits) Updates `System.Text.Json` from 8.0.5 to 8.0.5 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v8.0.5...v8.0.5) --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.Text.Json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b4bfa6189..c72e5c86a 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + - From 064f5c66a64e86635dc7d7cfa6d8f5f611d776f5 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 18 Feb 2025 14:52:07 -0500 Subject: [PATCH 608/752] chore: cleanup of GetValues where possible --- .../Extensions/OpenApiExtensibleExtensions.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs index ee57125dd..f4b4f77c5 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs @@ -1,6 +1,7 @@ using Microsoft.OpenApi.Any; using Microsoft.OpenApi.Interfaces; using System.Collections.Generic; +using System.Text.Json.Nodes; namespace Microsoft.OpenApi.Hidi.Extensions { @@ -14,9 +15,9 @@ internal static class OpenApiExtensibleExtensions /// A value matching the provided extensionKey. Return null when extensionKey is not found. internal static string GetExtension(this IDictionary extensions, string extensionKey) { - if (extensions.TryGetValue(extensionKey, out var value) && value is OpenApiAny castValue) + if (extensions.TryGetValue(extensionKey, out var value) && value is OpenApiAny { Node: JsonValue castValue } && castValue.TryGetValue(out var stringValue)) { - return castValue.Node.GetValue(); + return stringValue; } return string.Empty; } From b9a6c398537d3504705aa57e0f74f73e2a726986 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 24 Feb 2025 13:41:41 -0500 Subject: [PATCH 609/752] draft: removes static registry for readers Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index c757f4031..6e9aab6e6 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -40,12 +40,6 @@ namespace Microsoft.OpenApi.Hidi { internal static class OpenApiService { - static OpenApiService() - { - OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader()); - OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader()); - } - /// /// Implementation of the transform command /// @@ -394,6 +388,9 @@ private static async Task ParseOpenApiAsync(string openApiFile, bool new(openApiFile) : new Uri("file://" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar) }; + var yamlReader = new OpenApiYamlReader(); + settings.Readers.Add(OpenApiConstants.Yaml, yamlReader); + settings.Readers.Add(OpenApiConstants.Yml, yamlReader); result = await OpenApiDocument.LoadAsync(stream, settings: settings, cancellationToken: cancellationToken).ConfigureAwait(false); From d6291f413ece30ad98e6933c880a570b3da520f0 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 24 Feb 2025 13:56:00 -0500 Subject: [PATCH 610/752] fix: removes static readers registry Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 +--- .../Services/OpenApiServiceTests.cs | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 6e9aab6e6..68f79790c 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -388,9 +388,7 @@ private static async Task ParseOpenApiAsync(string openApiFile, bool new(openApiFile) : new Uri("file://" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar) }; - var yamlReader = new OpenApiYamlReader(); - settings.Readers.Add(OpenApiConstants.Yaml, yamlReader); - settings.Readers.Add(OpenApiConstants.Yml, yamlReader); + settings.AddYamlReader(); result = await OpenApiDocument.LoadAsync(stream, settings: settings, cancellationToken: cancellationToken).ConfigureAwait(false); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index b4a04c4ce..c23222eb6 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -26,8 +26,6 @@ public sealed class OpenApiServiceTests : IDisposable public OpenApiServiceTests() { _logger = new Logger(_loggerFactory); - OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yml, new OpenApiYamlReader()); - OpenApiReaderRegistry.RegisterReader(OpenApiConstants.Yaml, new OpenApiYamlReader()); } [Fact] From 30277a3e690ddf3ca5355ac147f73de87be11a87 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 25 Feb 2025 08:05:10 -0500 Subject: [PATCH 611/752] chore: adds missing yaml reader for test Signed-off-by: Vincent Biret --- .../Services/OpenApiFilterServiceTests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index a3494ba13..513355b50 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -5,6 +5,7 @@ using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Models.References; +using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Tests.UtilityFiles; using Moq; @@ -232,7 +233,9 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly( // Act using var stream = File.OpenRead(filePath); - var doc = (await OpenApiDocument.LoadAsync(stream, "yaml")).Document; + var settings = new OpenApiReaderSettings(); + settings.AddYamlReader(); + var doc = (await OpenApiDocument.LoadAsync(stream, "yaml", settings)).Document; var predicate = OpenApiFilterService.CreatePredicate(operationIds: operationIds); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(doc, predicate); From 725409dcb540b361b67971c2a0a49abdf2a1971d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 25 Feb 2025 09:24:31 -0500 Subject: [PATCH 612/752] fix avoid creating a client for each request in hidi Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 68f79790c..72bb66231 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -492,6 +492,11 @@ private static Dictionary> EnumerateJsonDocument(JsonElemen return paths; } + private static readonly Lazy httpClient = new(() => new HttpClient() + { + DefaultRequestVersion = HttpVersion.Version20 + }); + /// /// Reads stream from file system or makes HTTP request depending on the input string /// @@ -507,11 +512,7 @@ private static async Task GetStreamAsync(string input, ILogger logger, C { try { - using var httpClient = new HttpClient - { - DefaultRequestVersion = HttpVersion.Version20 - }; - stream = await httpClient.GetStreamAsync(new Uri(input), cancellationToken).ConfigureAwait(false); + stream = await httpClient.Value.GetStreamAsync(new Uri(input), cancellationToken).ConfigureAwait(false); } catch (HttpRequestException ex) { From 5e9d3ce5b8f0d9abb9cdebe469e0bc4432f815be Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 25 Feb 2025 09:32:52 -0500 Subject: [PATCH 613/752] fix: use a single http client in hidi Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 72bb66231..692e35c0d 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -386,7 +386,8 @@ private static async Task ParseOpenApiAsync(string openApiFile, bool LoadExternalRefs = inlineExternal, BaseUrl = openApiFile.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? new(openApiFile) : - new Uri("file://" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar) + new Uri("file://" + new FileInfo(openApiFile).DirectoryName + Path.DirectorySeparatorChar), + HttpClient = httpClient.Value }; settings.AddYamlReader(); From 1e0b2412c77531f381aa16304a40842b51a7ef86 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 25 Feb 2025 17:47:51 +0300 Subject: [PATCH 614/752] BREAKING CHANGE: Rename Readers project to YamlReader --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- .../Services/OpenApiServiceTests.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c68a24ee0..2aa25527c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -44,7 +44,7 @@ - + diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index c757f4031..49e905cbc 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -31,9 +31,9 @@ using Microsoft.OpenApi.Models; using Microsoft.OpenApi.OData; using Microsoft.OpenApi.Reader; -using Microsoft.OpenApi.Readers; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Writers; +using Microsoft.OpenApi.YamlReader; using static Microsoft.OpenApi.Hidi.OpenApiSpecVersionHelper; namespace Microsoft.OpenApi.Hidi diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index b4a04c4ce..1389d3246 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -12,7 +12,7 @@ using Microsoft.OpenApi.Models; using Microsoft.OpenApi.OData; using Microsoft.OpenApi.Reader; -using Microsoft.OpenApi.Readers; +using Microsoft.OpenApi.YamlReader; using Microsoft.OpenApi.Services; using Xunit; From e6b06fef235b0c79c91ea8e48c743c5219325af0 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 25 Feb 2025 18:23:36 +0300 Subject: [PATCH 615/752] fix: clean up project references --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 13e98bc0e..47d67fc5b 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -21,6 +21,7 @@ + From 85c37d963f5661358137ddcdcff00d7be068092e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 25 Feb 2025 14:31:48 -0500 Subject: [PATCH 616/752] feat: deduplicates tags at the document level Signed-off-by: Vincent Biret --- .../UtilityFiles/OpenApiDocumentMock.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 3f81c71a3..1bdcd2463 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -629,7 +629,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Tags = new List + Tags = new HashSet { new() { From 539d333e0938455948a89e8fbef672a73412a6ed Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 25 Feb 2025 15:09:57 -0500 Subject: [PATCH 617/752] feat: tags references are now deduplicated as well Signed-off-by: Vincent Biret --- .../UtilityFiles/OpenApiDocumentMock.cs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 1bdcd2463..0da220427 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -678,18 +678,18 @@ public static OpenApiDocument CreateOpenApiDocument() } } }; - document.Paths[getTeamsActivityByPeriodPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("reports.Functions", document)); - document.Paths[getTeamsActivityByDatePath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("reports.Functions", document)); - document.Paths[usersPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("users.user", document)); - document.Paths[usersByIdPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("users.user", document)); - document.Paths[usersByIdPath].Operations[OperationType.Patch].Tags!.Add(new OpenApiTagReference("users.user", document)); - document.Paths[messagesByIdPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("users.message", document)); - document.Paths[administrativeUnitRestorePath].Operations[OperationType.Post].Tags!.Add(new OpenApiTagReference("administrativeUnits.Actions", document)); - document.Paths[logoPath].Operations[OperationType.Put].Tags!.Add(new OpenApiTagReference("applications.application", document)); - document.Paths[securityProfilesPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("security.hostSecurityProfile", document)); - document.Paths[communicationsCallsKeepAlivePath].Operations[OperationType.Post].Tags!.Add(new OpenApiTagReference("communications.Actions", document)); - document.Paths[eventsDeltaPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("groups.Functions", document)); - document.Paths[refPath].Operations[OperationType.Get].Tags!.Add(new OpenApiTagReference("applications.directoryObject", document)); + document.Paths[getTeamsActivityByPeriodPath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("reports.Functions", document)}; + document.Paths[getTeamsActivityByDatePath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("reports.Functions", document)}; + document.Paths[usersPath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; + document.Paths[usersByIdPath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; + document.Paths[usersByIdPath].Operations[OperationType.Patch].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; + document.Paths[messagesByIdPath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("users.message", document)}; + document.Paths[administrativeUnitRestorePath].Operations[OperationType.Post].Tags = new HashSet {new OpenApiTagReference("administrativeUnits.Actions", document)}; + document.Paths[logoPath].Operations[OperationType.Put].Tags = new HashSet {new OpenApiTagReference("applications.application", document)}; + document.Paths[securityProfilesPath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("security.hostSecurityProfile", document)}; + document.Paths[communicationsCallsKeepAlivePath].Operations[OperationType.Post].Tags = new HashSet {new OpenApiTagReference("communications.Actions", document)}; + document.Paths[eventsDeltaPath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("groups.Functions", document)}; + document.Paths[refPath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("applications.directoryObject", document)}; ((OpenApiSchema)document.Paths[usersPath].Operations[OperationType.Get].Responses!["200"].Content[applicationJsonMediaType].Schema!.Properties["value"]).Items = new OpenApiSchemaReference("microsoft.graph.user", document); document.Paths[usersByIdPath].Operations[OperationType.Get].Responses!["200"].Content[applicationJsonMediaType].Schema = new OpenApiSchemaReference("microsoft.graph.user", document); document.Paths[messagesByIdPath].Operations[OperationType.Get].Responses!["200"].Content[applicationJsonMediaType].Schema = new OpenApiSchemaReference("microsoft.graph.message", document); From 9772be4bd5f65a6e18dc54aa4ccf0c670089d112 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 25 Feb 2025 21:07:21 +0000 Subject: [PATCH 618/752] chore(deps): bump Microsoft.OData.Edm and Microsoft.OpenApi.OData Bumps Microsoft.OData.Edm and [Microsoft.OpenApi.OData](https://github.com/Microsoft/OpenAPI.NET). These dependencies needed to be updated together. Updates `Microsoft.OData.Edm` from 8.2.3 to 8.2.3 Updates `Microsoft.OpenApi.OData` from 2.0.0-preview8 to 2.0.0-preview9 - [Release notes](https://github.com/Microsoft/OpenAPI.NET/releases) - [Changelog](https://github.com/microsoft/OpenAPI.NET/blob/main/CHANGELOG.md) - [Commits](https://github.com/Microsoft/OpenAPI.NET/compare/v2.0.0-preview8...v2.0.0-preview9) --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.OpenApi.OData dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c68a24ee0..0ed78ac1d 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From f471ec43fb8066a48a0cc17e7a886f4a1f2c0e2c Mon Sep 17 00:00:00 2001 From: Andrew Omondi Date: Fri, 7 Mar 2025 11:13:47 +0300 Subject: [PATCH 619/752] fix: fixes serialization of openApidocs with operation tags with settings to inline references. --- .../Services/OpenApiFilterServiceTests.cs | 32 ++++++++++++++++++- .../docWithReusableHeadersAndExamples.yaml | 2 ++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 513355b50..753f2e9d9 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -1,13 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. +using System.Globalization; using Microsoft.Extensions.Logging; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Tests.UtilityFiles; +using Microsoft.OpenApi.Writers; using Moq; using Xunit; @@ -235,7 +238,14 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly( using var stream = File.OpenRead(filePath); var settings = new OpenApiReaderSettings(); settings.AddYamlReader(); - var doc = (await OpenApiDocument.LoadAsync(stream, "yaml", settings)).Document; + var doc = (await OpenApiDocument.LoadAsync(stream, "yaml", settings)).Document; + + // validated the tags are read as references + var openApiOperationTags = doc.Paths["/items"].Operations[OperationType.Get].Tags?.ToArray(); + Assert.NotNull(openApiOperationTags); + Assert.Single(openApiOperationTags); + Assert.True(openApiOperationTags[0].UnresolvedReference); + var predicate = OpenApiFilterService.CreatePredicate(operationIds: operationIds); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(doc, predicate); @@ -255,6 +265,26 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly( Assert.Single(targetHeaders); Assert.NotNull(targetExamples); Assert.Single(targetExamples); + // validated the tags of the trimmed document are read as references + var trimmedOpenApiOperationTags = subsetOpenApiDocument.Paths["/items"].Operations[OperationType.Get].Tags?.ToArray(); + Assert.NotNull(trimmedOpenApiOperationTags); + Assert.Single(trimmedOpenApiOperationTags); + Assert.True(trimmedOpenApiOperationTags[0].UnresolvedReference); + + // Finally try to write the trimmed document as v3 document + var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); + var writer = new OpenApiJsonWriter(outputStringWriter) + { + Settings = new OpenApiWriterSettings() + { + InlineExternalReferences = true, + InlineLocalReferences = true + } + }; + subsetOpenApiDocument.SerializeAsV3(writer); + await writer.FlushAsync(); + var result = outputStringWriter.ToString(); + Assert.NotEmpty(result); } [Theory] diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml index 60ee7e5c8..8edeb1945 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml @@ -7,6 +7,8 @@ servers: paths: /items: get: + tags: + - list.items operationId: getItems summary: Get a list of items responses: From fd326d7cb6868b8393c67973cc8b4f62d7be1c76 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 7 Mar 2025 22:00:13 +0000 Subject: [PATCH 620/752] chore(deps): bump Microsoft.OpenApi.ApiManifest and SharpYaml Bumps [Microsoft.OpenApi.ApiManifest](https://github.com/Microsoft/OpenApi.ApiManifest) and [SharpYaml](https://github.com/xoofx/SharpYaml). These dependencies needed to be updated together. Updates `Microsoft.OpenApi.ApiManifest` from 2.0.0-preview1 to 2.0.0-preview2 - [Release notes](https://github.com/Microsoft/OpenApi.ApiManifest/releases) - [Changelog](https://github.com/microsoft/OpenApi.ApiManifest/blob/main/CHANGELOG.md) - [Commits](https://github.com/Microsoft/OpenApi.ApiManifest/compare/v2.0.0-preview1...v2.0.0-preview2) Updates `SharpYaml` from 2.1.1 to 2.1.1 - [Release notes](https://github.com/xoofx/SharpYaml/releases) - [Changelog](https://github.com/xoofx/SharpYaml/blob/master/changelog.md) - [Commits](https://github.com/xoofx/SharpYaml/compare/2.1.1...2.1.1) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.ApiManifest dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: SharpYaml dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 0ed78ac1d..82426e875 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -39,7 +39,7 @@ - + From 5b41e84c05b51ce54cacf6aec374287000698dac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 21:14:30 +0000 Subject: [PATCH 621/752] chore(deps): bump Microsoft.Extensions.Logging, Microsoft.Extensions.Logging.Abstractions and Microsoft.Extensions.Logging.Console Bumps [Microsoft.Extensions.Logging](https://github.com/dotnet/runtime), [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime) and [Microsoft.Extensions.Logging.Console](https://github.com/dotnet/runtime). These dependencies needed to be updated together. Updates `Microsoft.Extensions.Logging` from 9.0.2 to 9.0.3 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.2...v9.0.3) Updates `Microsoft.Extensions.Logging.Abstractions` from 9.0.2 to 9.0.3 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.2...v9.0.3) Updates `Microsoft.Extensions.Logging.Console` from 9.0.2 to 9.0.3 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.2...v9.0.3) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Console dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 82426e875..60437d3f1 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -28,9 +28,9 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive From 57757bda4c88d564dcd6d63d46dbd09c657224c2 Mon Sep 17 00:00:00 2001 From: Michael Mutunga Date: Wed, 12 Mar 2025 14:45:01 +0300 Subject: [PATCH 622/752] feat/use-http-method-object-instead-of-enum --- .../Formatters/PowerShellFormatter.cs | 5 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 +- .../Formatters/PowerShellFormatterTests.cs | 33 +++++--- .../Services/OpenApiFilterServiceTests.cs | 26 +++--- .../Services/OpenApiServiceTests.cs | 4 +- .../UtilityFiles/OpenApiDocumentMock.cs | 84 +++++++++---------- 6 files changed, 82 insertions(+), 74 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index df632b78a..f263dae0e 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Net.Http; using System.Text; using System.Text.RegularExpressions; using Humanizer; @@ -53,11 +54,11 @@ public override void Visit(IOpenApiSchema schema) public override void Visit(IOpenApiPathItem pathItem) { - if (pathItem.Operations.TryGetValue(OperationType.Put, out var value) && + if (pathItem.Operations.TryGetValue(HttpMethod.Put, out var value) && value.OperationId != null) { var operationId = value.OperationId; - pathItem.Operations[OperationType.Put].OperationId = ResolvePutOperationId(operationId); + pathItem.Operations[HttpMethod.Put].OperationId = ResolvePutOperationId(operationId); } base.Visit(pathItem); diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 692e35c0d..e0cce5896 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -256,9 +256,9 @@ private static async Task GetOpenApiAsync(HidiOptions options, return document; } - private static Func? FilterOpenApiDocument(string? filterByOperationIds, string? filterByTags, Dictionary> requestUrls, OpenApiDocument document, ILogger logger) + private static Func? FilterOpenApiDocument(string? filterByOperationIds, string? filterByTags, Dictionary> requestUrls, OpenApiDocument document, ILogger logger) { - Func? predicate = null; + Func? predicate = null; using (logger.BeginScope("Create Filter")) { diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index da6d8c61e..49b020a10 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -10,16 +10,23 @@ namespace Microsoft.OpenApi.Hidi.Tests.Formatters { public class PowerShellFormatterTests { + public static IEnumerable TestCases + { + get + { + yield return new object[] { "drives.drive.ListDrive", "drive_ListDrive", HttpMethod.Get }; + yield return new object[] { "print.taskDefinitions.tasks.GetTrigger", "print.taskDefinition.task_GetTrigger", HttpMethod.Get }; + yield return new object[] { "groups.sites.termStore.groups.GetSets", "group.site.termStore.group_GetSet", HttpMethod.Get }; + yield return new object[] { "external.industryData.ListDataConnectors", "external.industryData_ListDataConnector", HttpMethod.Get }; + yield return new object[] { "applications.application.UpdateLogo", "application_SetLogo", HttpMethod.Put }; + yield return new object[] { "identityGovernance.lifecycleWorkflows.workflows.workflow.activate", "identityGovernance.lifecycleWorkflow.workflow_activate", HttpMethod.Post }; + yield return new object[] { "directory.GetDeletedItems.AsApplication", "directory_GetDeletedItemAsApplication", HttpMethod.Get }; + yield return new object[] { "education.users.GetCount-6be9", "education.user_GetCount", HttpMethod.Get }; + } + } [Theory] - [InlineData("drives.drive.ListDrive", "drive_ListDrive", OperationType.Get)] - [InlineData("print.taskDefinitions.tasks.GetTrigger", "print.taskDefinition.task_GetTrigger", OperationType.Get)] - [InlineData("groups.sites.termStore.groups.GetSets", "group.site.termStore.group_GetSet", OperationType.Get)] - [InlineData("external.industryData.ListDataConnectors", "external.industryData_ListDataConnector", OperationType.Get)] - [InlineData("applications.application.UpdateLogo", "application_SetLogo", OperationType.Put)] - [InlineData("identityGovernance.lifecycleWorkflows.workflows.workflow.activate", "identityGovernance.lifecycleWorkflow.workflow_activate", OperationType.Post)] - [InlineData("directory.GetDeletedItems.AsApplication", "directory_GetDeletedItemAsApplication", OperationType.Get)] - [InlineData("education.users.GetCount-6be9", "education.user_GetCount", OperationType.Get)] - public void FormatOperationIdsInOpenAPIDocument(string operationId, string expectedOperationId, OperationType operationType, string path = "/foo") + [MemberData(nameof(TestCases))] + public void FormatOperationIdsInOpenAPIDocument(string operationId, string expectedOperationId, HttpMethod operationType, string path = "/foo") { // Arrange var openApiDocument = new OpenApiDocument @@ -29,7 +36,7 @@ public void FormatOperationIdsInOpenAPIDocument(string operationId, string expec Paths = new() { { path, new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { { operationType, new() { OperationId = operationId } } } @@ -89,7 +96,7 @@ public void ResolveFunctionParameters() var walker = new OpenApiWalker(powerShellFormatter); walker.Walk(openApiDocument); - var idsParameter = openApiDocument.Paths["/foo"].Operations[OperationType.Get].Parameters?.Where(static p => p.Name == "ids").FirstOrDefault(); + var idsParameter = openApiDocument.Paths["/foo"].Operations[HttpMethod.Get].Parameters?.Where(static p => p.Name == "ids").FirstOrDefault(); // Assert Assert.Null(idsParameter?.Content); @@ -106,10 +113,10 @@ private static OpenApiDocument GetSampleOpenApiDocument() Paths = new() { { "/foo", new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { { - OperationType.Get, new() + HttpMethod.Get, new() { OperationId = "Foo.GetFoo", Parameters = diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 753f2e9d9..57d2d5098 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -83,11 +83,11 @@ public void TestPredicateFiltersUsingRelativeRequestUrls() Paths = new() { {"/foo", new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { - { OperationType.Get, new() }, - { OperationType.Patch, new() }, - { OperationType.Post, new() } + { HttpMethod.Get, new() }, + { HttpMethod.Patch, new() }, + { HttpMethod.Post, new() } } } } @@ -104,9 +104,9 @@ public void TestPredicateFiltersUsingRelativeRequestUrls() var predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: openApiDocument); // Then - Assert.True(predicate("/foo", OperationType.Get, null)); - Assert.True(predicate("/foo", OperationType.Post, null)); - Assert.False(predicate("/foo", OperationType.Patch, null)); + Assert.True(predicate("/foo", HttpMethod.Get, null)); + Assert.True(predicate("/foo", HttpMethod.Post, null)); + Assert.False(predicate("/foo", HttpMethod.Patch, null)); } [Fact] @@ -121,10 +121,10 @@ public void CreateFilteredDocumentUsingPredicateFromRequestUrl() { ["/test/{id}"] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { - { OperationType.Get, new() }, - { OperationType.Patch, new() } + { HttpMethod.Get, new() }, + { HttpMethod.Patch, new() } }, Parameters = [ @@ -241,7 +241,7 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly( var doc = (await OpenApiDocument.LoadAsync(stream, "yaml", settings)).Document; // validated the tags are read as references - var openApiOperationTags = doc.Paths["/items"].Operations[OperationType.Get].Tags?.ToArray(); + var openApiOperationTags = doc.Paths["/items"].Operations[HttpMethod.Get].Tags?.ToArray(); Assert.NotNull(openApiOperationTags); Assert.Single(openApiOperationTags); Assert.True(openApiOperationTags[0].UnresolvedReference); @@ -249,7 +249,7 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly( var predicate = OpenApiFilterService.CreatePredicate(operationIds: operationIds); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(doc, predicate); - var response = subsetOpenApiDocument.Paths["/items"].Operations[OperationType.Get]?.Responses?["200"]; + var response = subsetOpenApiDocument.Paths["/items"].Operations[HttpMethod.Get]?.Responses?["200"]; var responseHeader = response?.Headers["x-custom-header"]; var mediaTypeExample = response?.Content["application/json"]?.Examples?.First().Value; var targetHeaders = subsetOpenApiDocument.Components?.Headers; @@ -266,7 +266,7 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly( Assert.NotNull(targetExamples); Assert.Single(targetExamples); // validated the tags of the trimmed document are read as references - var trimmedOpenApiOperationTags = subsetOpenApiDocument.Paths["/items"].Operations[OperationType.Get].Tags?.ToArray(); + var trimmedOpenApiOperationTags = subsetOpenApiDocument.Paths["/items"].Operations[HttpMethod.Get].Tags?.ToArray(); Assert.NotNull(trimmedOpenApiOperationTags); Assert.Single(trimmedOpenApiOperationTags); Assert.True(trimmedOpenApiOperationTags[0].UnresolvedReference); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index c23222eb6..ec306bc55 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -45,9 +45,9 @@ public void CreateFilteredDocumentOnMinimalOpenApi() { ["/test"] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { - [OperationType.Get] = new OpenApiOperation() + [HttpMethod.Get] = new OpenApiOperation() } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 0da220427..0cc1bc2fb 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -51,10 +51,10 @@ public static OpenApiDocument CreateOpenApiDocument() { ["/"] = new OpenApiPathItem() // root path { - Operations = new Dictionary + Operations = new Dictionary { { - OperationType.Get, new OpenApiOperation + HttpMethod.Get, new OpenApiOperation { OperationId = "graphService.GetGraphService", Responses = new() @@ -72,10 +72,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, [getTeamsActivityByPeriodPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { { - OperationType.Get, new OpenApiOperation + HttpMethod.Get, new OpenApiOperation { OperationId = "reports.getTeamsUserActivityCounts", Summary = "Invoke function getTeamsUserActivityUserCounts", @@ -137,10 +137,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, [getTeamsActivityByDatePath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { { - OperationType.Get, new OpenApiOperation + HttpMethod.Get, new OpenApiOperation { OperationId = "reports.getTeamsUserActivityUserDetail-a3f1", Summary = "Invoke function getTeamsUserActivityUserDetail", @@ -200,10 +200,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, [usersPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { { - OperationType.Get, new OpenApiOperation + HttpMethod.Get, new OpenApiOperation { OperationId = "users.user.ListUser", Summary = "Get entities from users", @@ -246,10 +246,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, [usersByIdPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { { - OperationType.Get, new OpenApiOperation + HttpMethod.Get, new OpenApiOperation { OperationId = "users.user.GetUser", Summary = "Get entity from users by key", @@ -274,7 +274,7 @@ public static OpenApiDocument CreateOpenApiDocument() } }, { - OperationType.Patch, new OpenApiOperation + HttpMethod.Patch, new OpenApiOperation { OperationId = "users.user.UpdateUser", Summary = "Update entity in users", @@ -293,10 +293,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, [messagesByIdPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { { - OperationType.Get, new OpenApiOperation + HttpMethod.Get, new OpenApiOperation { OperationId = "users.GetMessages", Summary = "Get messages from users", @@ -340,10 +340,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, [administrativeUnitRestorePath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { { - OperationType.Post, new OpenApiOperation + HttpMethod.Post, new OpenApiOperation { OperationId = "administrativeUnits.restore", Summary = "Invoke action restore", @@ -391,10 +391,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, [logoPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { { - OperationType.Put, new OpenApiOperation + HttpMethod.Put, new OpenApiOperation { OperationId = "applications.application.UpdateLogo", Summary = "Update media content for application in applications", @@ -413,10 +413,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, [securityProfilesPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { { - OperationType.Get, new OpenApiOperation + HttpMethod.Get, new OpenApiOperation { OperationId = "security.ListHostSecurityProfiles", Summary = "Get hostSecurityProfiles from security", @@ -459,10 +459,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, [communicationsCallsKeepAlivePath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { { - OperationType.Post, new OpenApiOperation + HttpMethod.Post, new OpenApiOperation { OperationId = "communications.calls.call.keepAlive", Summary = "Invoke action keepAlive", @@ -507,10 +507,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, [eventsDeltaPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { { - OperationType.Get, new OpenApiOperation + HttpMethod.Get, new OpenApiOperation { OperationId = "groups.group.events.event.calendar.events.delta", Summary = "Invoke function delta", @@ -594,10 +594,10 @@ public static OpenApiDocument CreateOpenApiDocument() }, [refPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new Dictionary { { - OperationType.Get, new OpenApiOperation + HttpMethod.Get, new OpenApiOperation { OperationId = "applications.GetRefCreatedOnBehalfOf", Summary = "Get ref of createdOnBehalfOf from applications" @@ -678,23 +678,23 @@ public static OpenApiDocument CreateOpenApiDocument() } } }; - document.Paths[getTeamsActivityByPeriodPath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("reports.Functions", document)}; - document.Paths[getTeamsActivityByDatePath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("reports.Functions", document)}; - document.Paths[usersPath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; - document.Paths[usersByIdPath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; - document.Paths[usersByIdPath].Operations[OperationType.Patch].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; - document.Paths[messagesByIdPath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("users.message", document)}; - document.Paths[administrativeUnitRestorePath].Operations[OperationType.Post].Tags = new HashSet {new OpenApiTagReference("administrativeUnits.Actions", document)}; - document.Paths[logoPath].Operations[OperationType.Put].Tags = new HashSet {new OpenApiTagReference("applications.application", document)}; - document.Paths[securityProfilesPath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("security.hostSecurityProfile", document)}; - document.Paths[communicationsCallsKeepAlivePath].Operations[OperationType.Post].Tags = new HashSet {new OpenApiTagReference("communications.Actions", document)}; - document.Paths[eventsDeltaPath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("groups.Functions", document)}; - document.Paths[refPath].Operations[OperationType.Get].Tags = new HashSet {new OpenApiTagReference("applications.directoryObject", document)}; - ((OpenApiSchema)document.Paths[usersPath].Operations[OperationType.Get].Responses!["200"].Content[applicationJsonMediaType].Schema!.Properties["value"]).Items = new OpenApiSchemaReference("microsoft.graph.user", document); - document.Paths[usersByIdPath].Operations[OperationType.Get].Responses!["200"].Content[applicationJsonMediaType].Schema = new OpenApiSchemaReference("microsoft.graph.user", document); - document.Paths[messagesByIdPath].Operations[OperationType.Get].Responses!["200"].Content[applicationJsonMediaType].Schema = new OpenApiSchemaReference("microsoft.graph.message", document); - ((OpenApiSchema)document.Paths[securityProfilesPath].Operations[OperationType.Get].Responses!["200"].Content[applicationJsonMediaType].Schema!.Properties["value"]).Items = new OpenApiSchemaReference("microsoft.graph.networkInterface", document); - ((OpenApiSchema)document.Paths[eventsDeltaPath].Operations[OperationType.Get].Responses!["200"].Content[applicationJsonMediaType].Schema!.Properties["value"]).Items = new OpenApiSchemaReference("microsoft.graph.event", document); + document.Paths[getTeamsActivityByPeriodPath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("reports.Functions", document)}; + document.Paths[getTeamsActivityByDatePath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("reports.Functions", document)}; + document.Paths[usersPath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; + document.Paths[usersByIdPath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; + document.Paths[usersByIdPath].Operations[HttpMethod.Patch].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; + document.Paths[messagesByIdPath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("users.message", document)}; + document.Paths[administrativeUnitRestorePath].Operations[HttpMethod.Post].Tags = new HashSet {new OpenApiTagReference("administrativeUnits.Actions", document)}; + document.Paths[logoPath].Operations[HttpMethod.Put].Tags = new HashSet {new OpenApiTagReference("applications.application", document)}; + document.Paths[securityProfilesPath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("security.hostSecurityProfile", document)}; + document.Paths[communicationsCallsKeepAlivePath].Operations[HttpMethod.Post].Tags = new HashSet {new OpenApiTagReference("communications.Actions", document)}; + document.Paths[eventsDeltaPath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("groups.Functions", document)}; + document.Paths[refPath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("applications.directoryObject", document)}; + ((OpenApiSchema)document.Paths[usersPath].Operations[HttpMethod.Get].Responses!["200"].Content[applicationJsonMediaType].Schema!.Properties["value"]).Items = new OpenApiSchemaReference("microsoft.graph.user", document); + document.Paths[usersByIdPath].Operations[HttpMethod.Get].Responses!["200"].Content[applicationJsonMediaType].Schema = new OpenApiSchemaReference("microsoft.graph.user", document); + document.Paths[messagesByIdPath].Operations[HttpMethod.Get].Responses!["200"].Content[applicationJsonMediaType].Schema = new OpenApiSchemaReference("microsoft.graph.message", document); + ((OpenApiSchema)document.Paths[securityProfilesPath].Operations[HttpMethod.Get].Responses!["200"].Content[applicationJsonMediaType].Schema!.Properties["value"]).Items = new OpenApiSchemaReference("microsoft.graph.networkInterface", document); + ((OpenApiSchema)document.Paths[eventsDeltaPath].Operations[HttpMethod.Get].Responses!["200"].Content[applicationJsonMediaType].Schema!.Properties["value"]).Items = new OpenApiSchemaReference("microsoft.graph.event", document); return document; } } From 5b96d4d60eddabb11f0a0f86f471cb1f68bc2661 Mon Sep 17 00:00:00 2001 From: Musale Martin Date: Thu, 13 Mar 2025 12:11:21 +0300 Subject: [PATCH 623/752] chore: update the readme for hidi examples and commands --- src/Microsoft.OpenApi.Hidi/readme.md | 112 ++++++++++++++++----------- 1 file changed, 67 insertions(+), 45 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md index 55986d14b..7a7667e02 100644 --- a/src/Microsoft.OpenApi.Hidi/readme.md +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -17,21 +17,22 @@ Install [Microsoft.OpenApi.Hidi](https://www.nuget.org/packages/Microsoft.OpenAp ### .NET CLI(Global) - 1. dotnet tool install --global Microsoft.OpenApi.Hidi --prerelease - +```bash +dotnet tool install --global Microsoft.OpenApi.Hidi --prerelease +``` ### .NET CLI(local) - - 1. dotnet new tool-manifest #if you are setting up the OpenAPI.NET repo - 2. dotnet tool install --local Microsoft.OpenApi.Hidi --prerelease +```bash +dotnet new tool-manifest #if you are setting up the OpenAPI.NET repo +dotnet tool install --local Microsoft.OpenApi.Hidi --prerelease +``` ## How to use Hidi -Once you've installed the package locally, you can invoke the Hidi by running: hidi [command]. -You can access the list of command options we have by running hidi -h +Once you've installed the package locally, you can invoke the Hidi by running: `hidi [command]`. You can access the list of command options we have by running `hidi -h` The tool avails the following commands: • Validate @@ -57,9 +58,13 @@ It accepts the following command: • --loglevel(-ll) - The log level to use when logging messages to the main output -**Example:** `hidi.exe validate --openapi C:\OpenApidocs\Mail.yml --loglevel trace` +#### Example: -Run validate -h to see the options available. +```bash +hidi validate --openapi C:\OpenApidocs\Mail.yml --loglevel trace` +``` + +> Run `hidi validate -h` to see the options available. ### Transform @@ -67,53 +72,70 @@ Used to convert file formats from JSON to YAML and vice versa and performs slici This command accepts the following parameters: - • --openapi(-d) - OpenAPI description file path in the local filesystem or a valid URL hosted on a HTTPS server - • --csdl(--cs) - CSDL file path in the local filesystem or a valid URL hosted on a HTTPS server - • --csdlfilter(--csf) - a filter parameter that a user can use to select a subset of a large CSDL file. They do so by providing a comma delimited list of EntitySet and Singleton names that appear in the EntityContainer. - • --output(-o) - Output directory path for the transformed document. - • --output-folder(--of) - The output directory path for the generated files. - • --clean-ouput(--co) - an optional param that allows a user to overwrite an existing file. - • --version(-v) - OpenAPI specification version. - • --metadata-version(--mv) - the metadata version to use. - • --format(-f) - File format - • --terse-output(--to) - Produce terse json output - • --settings-path(--sp) - The configuration file with CSDL conversion settings. - • --loglevel(--ll) - The log level to use when logging messages to the main output - • --inline-local - Inline local $ref instances - • --inline-external(--ex) - Inline external $refs - • --filterByOperationIds(--op) - Slice document based on OperationId(s) provided. Accepts a comma delimited list of operation ids. - • --filterByTags(-t) - Slice document based on tag(s) provided. Accepts a comma delimited list of tags. - • --filterByCollection(-c) - Slices the OpenAPI document based on the Postman Collection file generated by Resource Explorer - • --manifest (-m) - Slices the OpenAPI document based on the requests defined in the API Manifest file referenced by the provided URI. For API manifests with multiple API Dependenties, use a fragment identifier to select the desired one. e.g ./apimanifest.json#example + + • --openapi, (-d) - OpenAPI description file path in the local filesystem or a valid URL hosted on a HTTPS server + • --csdl (--cs) - CSDL file path in the local filesystem or a valid URL hosted on a HTTPS server + • --csdl-filter (--csf) - a filter parameter that a user can use to select a subset of a large CSDL file. They do so by providing a comma delimited list of EntitySet and Singleton names that appear in the EntityContainer. + • --output (-o) - Output directory path for the transformed document. + • --clean-output (--co) - an optional param that allows a user to overwrite an existing file. + • --version (-v) - OpenAPI specification version. + • --metadata-version (--mv) - the metadata version to use. + • --format (-f) - File format + • --terse-output (--to) - Produce terse json output + • --settings-path (--sp) - The configuration file with CSDL conversion settings. + • --log-level (--ll) - The log level to use when logging messages to the main output + • --inline-local (--il) - Inline local $ref instances + • --inline-external (--ie) - Inline external $refs instances + • --filter-by-operationids(--op) - Slice document based on OperationId(s) provided. Accepts a comma delimited list of operation ids. + • --filter-by-tags (--t) - Slice document based on tag(s) provided. Accepts a comma delimited list of tags. + • --filter-by-collection (-c) - Slices the OpenAPI document based on the Postman Collection file generated by Resource Explorer - **Examples:** + #### Examples: - 1. Filtering by OperationIds - hidi transform -d files\People.yml -f yaml -o files\People.yml -v OpenApi3_0 --op users_UpdateInsights --co - - 2. Filtering by Postman collection - hidi transform --openapi files\People.yml --format yaml --output files\People2.yml --version OpenApi3_0 --filterByCollection Graph-Collection-0017059134807617005.postman_collection.json - - 3. CSDL--->OpenAPI conversion and filtering - hidi transform --csdl Files/Todo.xml --output Files/Todo-subset.yml --format yaml --version OpenApi3_0 --filterByOperationIds Todos.Todo.UpdateTodo - - 4. CSDL Filtering by EntitySets and Singletons - hidi transform --cs dataverse.csdl --csdlFilter "appointments,opportunities" -o appointmentsAndOpportunities.yaml --ll trace - -Run transform -h to see all the available usage options. +1. Filtering by OperationIds + +```bash +hidi transform -d files\People.yml -f yaml -o files\People.yml -v OpenApi3_0 --op users_UpdateInsights --co +``` + +2. Filtering by Postman collection + +```bash +hidi transform --openapi files\People.yml --format yaml --output files\People2.yml --version OpenApi3_0 --filter-by-collection Graph-Collection-0017059134807617005.postman_collection.json +``` + +3. CSDL--->OpenAPI conversion and filtering + +```bash +hidi transform --csdl Files/Todo.xml --output Files/Todo-subset.yml --format yaml --version OpenApi3_0 --filter-by-operationids Todos.Todo.UpdateTodo +``` + +4. CSDL Filtering by EntitySets and Singletons + +```bash +hidi transform --cs dataverse.csdl --csdl-filter "appointments,opportunities" -o appointmentsAndOpportunities.yaml --ll trace +``` + +> Run `hidi transform -h` to see all the available usage options. ### Show This command accepts an OpenAPI document as an input parameter and generates a Markdown file that contains a diagram of the API using Mermaid syntax. -**Examples:** +#### Examples: - 1. hidi show -d files\People.yml -o People.md -ll trace +```bash +hidi show -d files\People.yml -o People.md -ll trace +``` ### Plugin This command generates an OpenAI style Plugin manifest and minimal OpenAPI file based on the provided API Manifest -**Examples:** +#### Examples: + +```bash +hidi plugin -m exampleApiManifest.yml -o mypluginfolder +``` - 1. hidi plugin -m exampleApiManifest.yml -o mypluginfolder +> Run `hidi plugin -h` to see all the available usage options. \ No newline at end of file From a0273ad10f71897a3cddbfc09602b7cb2caf7eb5 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Fri, 14 Mar 2025 16:36:14 +0300 Subject: [PATCH 624/752] feat: enable null reference type support (#2146) * feat: enable NRT * fix: dereference of a possible null reference * chore: code cleanup * chore: convert to conditional expression * Update src/Microsoft.OpenApi/Models/OpenApiOperation.cs Co-authored-by: Vincent Biret * Update src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs Co-authored-by: Vincent Biret * chore: PR feedback * fix: resolve merge conflict errors * chore: remove deprecated code and tests; make param required * chore: code refactor and cleanup * chore: update public API * chore: address PR comments * fix: remove nullable Json node params * chore: use conditional compilation to make reference a required field * refactor: apply nullable to new changes * chore: bad merge Signed-off-by: Vincent Biret * chore: simplifies filtering condition * Update src/Microsoft.OpenApi/Models/OpenApiRequestBody.cs Co-authored-by: Vincent Biret * chore: address more PR feedback * chore: add check for both null and empty strings * chore: revert to include check for empty strings * chore: cleanup * chore: clean up public API * Update src/Microsoft.OpenApi/Reader/Services/OpenApiRemoteReferenceCollector.cs Co-authored-by: Vincent Biret * fix: resolve PR feedback * chore: add defensive programming * chore: resolve merge conflicts * chore: more refactoring * Update src/Microsoft.OpenApi/Reader/V2/OpenApiOperationDeserializer.cs Co-authored-by: Vincent Biret * Update src/Microsoft.OpenApi/Reader/V2/OpenApiPathItemDeserializer.cs Co-authored-by: Vincent Biret * Update src/Microsoft.OpenApi/Reader/V31/OpenApiServerVariableDeserializer.cs Co-authored-by: Vincent Biret * Update src/Microsoft.OpenApi/Reader/V31/OpenApiSecurityRequirementDeserializer.cs Co-authored-by: Vincent Biret * Update src/Microsoft.OpenApi/Reader/V2/OpenApiSecurityRequirementDeserializer.cs Co-authored-by: Vincent Biret * Update src/Microsoft.OpenApi/Reader/V3/OpenApiServerVariableDeserializer.cs Co-authored-by: Vincent Biret * Update src/Microsoft.OpenApi/Reader/V3/OpenApiSecurityRequirementDeserializer.cs Co-authored-by: Vincent Biret * chore: another round of refactoring * chore: clean up nullability of params * fix: compiler errors * fix: remove redundant cast and update public API * chore: fix merge conflict issues * chore: apply copilot suggestion * Update src/Microsoft.OpenApi/Services/OpenApiWalker.cs --------- Signed-off-by: Vincent Biret Co-authored-by: Vincent Biret --- .../Formatters/PowerShellFormatter.cs | 13 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 146 ++++++++++-------- .../Formatters/PowerShellFormatterTests.cs | 22 +-- .../Services/OpenApiFilterServiceTests.cs | 93 +++++------ .../UtilityFiles/OpenApiDocumentMock.cs | 34 ++-- 5 files changed, 165 insertions(+), 143 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index f263dae0e..b46e0b2a6 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -54,7 +54,7 @@ public override void Visit(IOpenApiSchema schema) public override void Visit(IOpenApiPathItem pathItem) { - if (pathItem.Operations.TryGetValue(HttpMethod.Put, out var value) && + if (pathItem.Operations is not null && pathItem.Operations.TryGetValue(HttpMethod.Put, out var value) && value.OperationId != null) { var operationId = value.OperationId; @@ -150,7 +150,7 @@ private static string RemoveKeyTypeSegment(string operationId, IList parameter private void AddAdditionalPropertiesToSchema(IOpenApiSchema schema) { - if (schema is OpenApiSchema openApiSchema && !_schemaLoop.Contains(schema) && schema.Type.Equals(JsonSchemaType.Object)) + if (schema is OpenApiSchema openApiSchema + && !_schemaLoop.Contains(schema) + && schema.Type.Equals(JsonSchemaType.Object)) { openApiSchema.AdditionalProperties = new OpenApiSchema() { Type = JsonSchemaType.Object }; @@ -187,7 +189,10 @@ private void AddAdditionalPropertiesToSchema(IOpenApiSchema schema) * we need a way to keep track of visited schemas to avoid * endlessly creating and walking them in an infinite recursion. */ - _schemaLoop.Push(schema.AdditionalProperties); + if (schema.AdditionalProperties is not null) + { + _schemaLoop.Push(schema.AdditionalProperties); + } } } diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index e0cce5896..7cdf9a2cb 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -94,7 +94,7 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog // Load OpenAPI document var document = await GetOpenApiAsync(options, openApiFormat.GetDisplayName(), logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); - if (options.FilterOptions != null) + if (options.FilterOptions != null && document is not null) { document = ApplyFilters(options, logger, apiDependency, postmanCollection, document); } @@ -107,7 +107,11 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog var walker = new OpenApiWalker(powerShellFormatter); walker.Walk(document); } - await WriteOpenApiAsync(options, openApiFormat, openApiVersion, document, logger, cancellationToken).ConfigureAwait(false); + if (document is not null) + { + // Write the OpenAPI document to the output file + await WriteOpenApiAsync(options, openApiFormat, openApiVersion, document, logger, cancellationToken).ConfigureAwait(false); + } } catch (TaskCanceledException) { @@ -172,7 +176,7 @@ private static OpenApiDocument ApplyFilters(HidiOptions options, ILogger logger, options.FilterOptions.FilterByTags, requestUrls, document, - logger); + logger); if (predicate != null) { var stopwatch = new Stopwatch(); @@ -210,6 +214,7 @@ private static async Task WriteOpenApiAsync(HidiOptions options, OpenApiFormat o var stopwatch = new Stopwatch(); stopwatch.Start(); + await document.SerializeAsync(writer, openApiVersion, cancellationToken).ConfigureAwait(false); stopwatch.Stop(); @@ -219,9 +224,9 @@ private static async Task WriteOpenApiAsync(HidiOptions options, OpenApiFormat o } // Get OpenAPI document either from OpenAPI or CSDL - private static async Task GetOpenApiAsync(HidiOptions options, string format, ILogger logger, string? metadataVersion = null, CancellationToken cancellationToken = default) + private static async Task GetOpenApiAsync(HidiOptions options, string format, ILogger logger, string? metadataVersion = null, CancellationToken cancellationToken = default) { - OpenApiDocument document; + OpenApiDocument? document; Stream stream; if (!string.IsNullOrEmpty(options.Csdl)) @@ -242,7 +247,7 @@ private static async Task GetOpenApiAsync(HidiOptions options, document = await ConvertCsdlToOpenApiAsync(filteredStream ?? stream, format, metadataVersion, options.SettingsConfig, cancellationToken).ConfigureAwait(false); stopwatch.Stop(); - logger.LogTrace("{Timestamp}ms: Generated OpenAPI with {Paths} paths.", stopwatch.ElapsedMilliseconds, document.Paths.Count); + logger.LogTrace("{Timestamp}ms: Generated OpenAPI with {Paths} paths.", stopwatch.ElapsedMilliseconds, document?.Paths.Count); } } else if (!string.IsNullOrEmpty(options.OpenApi)) @@ -370,7 +375,7 @@ private static MemoryStream ApplyFilterToCsdl(Stream csdlStream, string entitySe if (result is null) return null; - return result.Diagnostic.Errors.Count == 0; + return result.Diagnostic?.Errors.Count == 0; } private static async Task ParseOpenApiAsync(string openApiFile, bool inlineExternal, ILogger logger, Stream stream, CancellationToken cancellationToken = default) @@ -407,7 +412,7 @@ private static async Task ParseOpenApiAsync(string openApiFile, bool /// /// The CSDL stream. /// An OpenAPI document. - public static async Task ConvertCsdlToOpenApiAsync(Stream csdl, string format, string? metadataVersion = null, IConfiguration? settings = null, CancellationToken token = default) + public static async Task ConvertCsdlToOpenApiAsync(Stream csdl, string format, string? metadataVersion = null, IConfiguration? settings = null, CancellationToken token = default) { using var reader = new StreamReader(csdl); var csdlText = await reader.ReadToEndAsync(token).ConfigureAwait(false); @@ -425,7 +430,7 @@ public static async Task ConvertCsdlToOpenApiAsync(Stream csdl, /// /// The converted OpenApiDocument. /// A valid OpenApiDocument instance. - public static OpenApiDocument FixReferences(OpenApiDocument document, string format) + public static OpenApiDocument? FixReferences(OpenApiDocument document, string format) { // This method is only needed because the output of ConvertToOpenApi isn't quite a valid OpenApiDocument instance. // So we write it out, and read it back in again to fix it up. @@ -584,52 +589,54 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl var openApiFormat = options.OpenApiFormat ?? (!string.IsNullOrEmpty(options.OpenApi) ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiFormat.Yaml); var document = await GetOpenApiAsync(options, openApiFormat.GetDisplayName(), logger, null, cancellationToken).ConfigureAwait(false); - - using (logger.BeginScope("Creating diagram")) + if (document is not null) { - // If output is null, create a HTML file in the user's temporary directory - var sourceUrl = (string.IsNullOrEmpty(options.OpenApi), string.IsNullOrEmpty(options.Csdl)) switch { - (false, _) => options.OpenApi!, - (_, false) => options.Csdl!, - _ => throw new InvalidOperationException("No input file path or URL provided") - }; - if (options.Output == null) + using (logger.BeginScope("Creating diagram")) { - var tempPath = Path.GetTempPath() + "/hidi/"; - if (!File.Exists(tempPath)) + // If output is null, create a HTML file in the user's temporary directory + var sourceUrl = (string.IsNullOrEmpty(options.OpenApi), string.IsNullOrEmpty(options.Csdl)) switch { - Directory.CreateDirectory(tempPath); - } - - var fileName = Path.GetRandomFileName(); - - var output = new FileInfo(Path.Combine(tempPath, fileName + ".html")); - using (var file = new FileStream(output.FullName, FileMode.Create)) + (false, _) => options.OpenApi!, + (_, false) => options.Csdl!, + _ => throw new InvalidOperationException("No input file path or URL provided") + }; + if (options.Output == null) { - using var writer = new StreamWriter(file); - WriteTreeDocumentAsHtml(sourceUrl, document, writer); + var tempPath = Path.GetTempPath() + "/hidi/"; + if (!File.Exists(tempPath)) + { + Directory.CreateDirectory(tempPath); + } + + var fileName = Path.GetRandomFileName(); + + var output = new FileInfo(Path.Combine(tempPath, fileName + ".html")); + using (var file = new FileStream(output.FullName, FileMode.Create)) + { + using var writer = new StreamWriter(file); + WriteTreeDocumentAsHtml(sourceUrl, document, writer); + } + logger.LogTrace("Created Html document with diagram "); + + // Launch a browser to display the output html file + using var process = new Process(); + process.StartInfo.FileName = output.FullName; + process.StartInfo.UseShellExecute = true; + process.Start(); + + return output.FullName; } - logger.LogTrace("Created Html document with diagram "); - - // Launch a browser to display the output html file - using var process = new Process(); - process.StartInfo.FileName = output.FullName; - process.StartInfo.UseShellExecute = true; - process.Start(); - - return output.FullName; - } - else // Write diagram as Markdown document to output file - { - using (var file = new FileStream(options.Output.FullName, FileMode.Create)) + else // Write diagram as Markdown document to output file { + using var file = new FileStream(options.Output.FullName, FileMode.Create); using var writer = new StreamWriter(file); WriteTreeDocumentAsMarkdown(sourceUrl, document, writer); + + logger.LogTrace("Created markdown document with diagram "); + return options.Output.FullName; } - logger.LogTrace("Created markdown document with diagram "); - return options.Output.FullName; } - } + } } catch (TaskCanceledException) { @@ -645,7 +652,7 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl private static void LogErrors(ILogger logger, ReadResult result) { var context = result.Diagnostic; - if (context.Errors.Count != 0) + if (context is not null && context.Errors.Count != 0) { using (logger.BeginScope("Detected errors")) { @@ -697,7 +704,7 @@ internal static void WriteTreeDocumentAsHtml(string sourceUrl, OpenApiDocument d """); - writer.WriteLine("

" + document.Info.Title + "

"); + writer.WriteLine("

" + document?.Info.Title + "

"); writer.WriteLine(); writer.WriteLine($"

API Description: {sourceUrl}

"); @@ -751,7 +758,7 @@ internal static async Task PluginManifestAsync(HidiOptions options, ILogger logg cancellationToken.ThrowIfCancellationRequested(); - if (options.FilterOptions != null) + if (options.FilterOptions != null && document is not null) { document = ApplyFilters(options, logger, apiDependency, null, document); } @@ -765,24 +772,31 @@ internal static async Task PluginManifestAsync(HidiOptions options, ILogger logg // Write OpenAPI to Output folder options.Output = new(Path.Combine(options.OutputFolder, "openapi.json")); options.TerseOutput = true; - await WriteOpenApiAsync(options, OpenApiFormat.Json, OpenApiSpecVersion.OpenApi3_1, document, logger, cancellationToken).ConfigureAwait(false); - - // Create OpenAIPluginManifest from ApiDependency and OpenAPI document - var manifest = new OpenAIPluginManifest(document.Info?.Title ?? "Title", document.Info?.Title ?? "Title", "https://go.microsoft.com/fwlink/?LinkID=288890", document.Info?.Contact?.Email ?? "placeholder@contoso.com", document.Info?.License?.Url.ToString() ?? "https://placeholderlicenseurl.com") - { - DescriptionForHuman = document.Info?.Description ?? "Description placeholder", - Api = new("openapi", "./openapi.json"), - Auth = new ManifestNoAuth(), - }; - manifest.NameForModel = manifest.NameForHuman; - manifest.DescriptionForModel = manifest.DescriptionForHuman; - - // Write OpenAIPluginManifest to Output folder - var manifestFile = new FileInfo(Path.Combine(options.OutputFolder, "ai-plugin.json")); - using var file = new FileStream(manifestFile.FullName, FileMode.Create); - using var jsonWriter = new Utf8JsonWriter(file, new() { Indented = true }); - manifest.Write(jsonWriter); - await jsonWriter.FlushAsync(cancellationToken).ConfigureAwait(false); + if (document is not null) + { + await WriteOpenApiAsync(options, OpenApiFormat.Json, OpenApiSpecVersion.OpenApi3_1, document, logger, cancellationToken).ConfigureAwait(false); + + // Create OpenAIPluginManifest from ApiDependency and OpenAPI document + var manifest = new OpenAIPluginManifest(document.Info.Title ?? "Title", + document.Info.Title ?? "Title", + "https://go.microsoft.com/fwlink/?LinkID=288890", + document.Info?.Contact?.Email ?? "placeholder@contoso.com", + document.Info?.License?.Url?.ToString() ?? "https://placeholderlicenseurl.com") + { + DescriptionForHuman = document.Info?.Description ?? "Description placeholder", + Api = new("openapi", "./openapi.json"), + Auth = new ManifestNoAuth(), + }; + manifest.NameForModel = manifest.NameForHuman; + manifest.DescriptionForModel = manifest.DescriptionForHuman; + + // Write OpenAIPluginManifest to Output folder + var manifestFile = new FileInfo(Path.Combine(options.OutputFolder, "ai-plugin.json")); + using var file = new FileStream(manifestFile.FullName, FileMode.Create); + using var jsonWriter = new Utf8JsonWriter(file, new() { Indented = true }); + manifest.Write(jsonWriter); + await jsonWriter.FlushAsync(cancellationToken).ConfigureAwait(false); + } } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 49b020a10..92cfae013 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -51,7 +51,7 @@ public void FormatOperationIdsInOpenAPIDocument(string operationId, string expec walker.Walk(openApiDocument); // Assert - Assert.Equal(expectedOperationId, openApiDocument.Paths[path].Operations[operationType].OperationId); + Assert.Equal(expectedOperationId, openApiDocument.Paths[path].Operations?[operationType].OperationId); } [Fact] @@ -68,20 +68,20 @@ public void RemoveAnyOfAndOneOfFromSchema() Assert.NotNull(openApiDocument.Components); Assert.NotNull(openApiDocument.Components.Schemas); var testSchema = openApiDocument.Components.Schemas["TestSchema"]; - var averageAudioDegradationProperty = testSchema.Properties["averageAudioDegradation"]; - var defaultPriceProperty = testSchema.Properties["defaultPrice"]; + var averageAudioDegradationProperty = testSchema.Properties?["averageAudioDegradation"]; + var defaultPriceProperty = testSchema.Properties?["defaultPrice"]; // Assert Assert.NotNull(openApiDocument.Components); Assert.NotNull(openApiDocument.Components.Schemas); Assert.NotNull(testSchema); - Assert.Null(averageAudioDegradationProperty.AnyOf); - Assert.Equal(JsonSchemaType.Number | JsonSchemaType.Null, averageAudioDegradationProperty.Type); - Assert.Equal("float", averageAudioDegradationProperty.Format); - Assert.Equal(JsonSchemaType.Null, averageAudioDegradationProperty.Type & JsonSchemaType.Null); - Assert.Null(defaultPriceProperty.OneOf); - Assert.Equal(JsonSchemaType.Number, defaultPriceProperty.Type); - Assert.Equal("double", defaultPriceProperty.Format); + Assert.Null(averageAudioDegradationProperty?.AnyOf); + Assert.Equal(JsonSchemaType.Number | JsonSchemaType.Null, averageAudioDegradationProperty?.Type); + Assert.Equal("float", averageAudioDegradationProperty?.Format); + Assert.Equal(JsonSchemaType.Null, averageAudioDegradationProperty?.Type & JsonSchemaType.Null); + Assert.Null(defaultPriceProperty?.OneOf); + Assert.Equal(JsonSchemaType.Number, defaultPriceProperty?.Type); + Assert.Equal("double", defaultPriceProperty?.Format); Assert.NotNull(testSchema.AdditionalProperties); } @@ -96,7 +96,7 @@ public void ResolveFunctionParameters() var walker = new OpenApiWalker(powerShellFormatter); walker.Walk(openApiDocument); - var idsParameter = openApiDocument.Paths["/foo"].Operations[HttpMethod.Get].Parameters?.Where(static p => p.Name == "ids").FirstOrDefault(); + var idsParameter = openApiDocument.Paths["/foo"].Operations?[HttpMethod.Get].Parameters?.Where(static p => p.Name == "ids").FirstOrDefault(); // Assert Assert.Null(idsParameter?.Content); diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 57d2d5098..7702c56c1 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -104,9 +104,9 @@ public void TestPredicateFiltersUsingRelativeRequestUrls() var predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: openApiDocument); // Then - Assert.True(predicate("/foo", HttpMethod.Get, null)); - Assert.True(predicate("/foo", HttpMethod.Post, null)); - Assert.False(predicate("/foo", HttpMethod.Patch, null)); + Assert.True(predicate("/foo", HttpMethod.Get, null!)); + Assert.True(predicate("/foo", HttpMethod.Post, null!)); + Assert.False(predicate("/foo", HttpMethod.Patch, null!)); } [Fact] @@ -157,7 +157,7 @@ public void CreateFilteredDocumentUsingPredicateFromRequestUrl() // Assert that there's only 1 parameter in the subset document Assert.NotNull(subsetDoc); Assert.NotEmpty(subsetDoc.Paths); - Assert.Single(subsetDoc.Paths.First().Value.Parameters); + Assert.Single(subsetDoc.Paths.First().Value.Parameters!); } [Fact] @@ -239,52 +239,55 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly( var settings = new OpenApiReaderSettings(); settings.AddYamlReader(); var doc = (await OpenApiDocument.LoadAsync(stream, "yaml", settings)).Document; - + // validated the tags are read as references - var openApiOperationTags = doc.Paths["/items"].Operations[HttpMethod.Get].Tags?.ToArray(); + var openApiOperationTags = doc?.Paths["/items"].Operations?[HttpMethod.Get].Tags?.ToArray(); Assert.NotNull(openApiOperationTags); Assert.Single(openApiOperationTags); Assert.True(openApiOperationTags[0].UnresolvedReference); - - var predicate = OpenApiFilterService.CreatePredicate(operationIds: operationIds); - var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(doc, predicate); - - var response = subsetOpenApiDocument.Paths["/items"].Operations[HttpMethod.Get]?.Responses?["200"]; - var responseHeader = response?.Headers["x-custom-header"]; - var mediaTypeExample = response?.Content["application/json"]?.Examples?.First().Value; - var targetHeaders = subsetOpenApiDocument.Components?.Headers; - var targetExamples = subsetOpenApiDocument.Components?.Examples; - // Assert - Assert.Same(doc.Servers, subsetOpenApiDocument.Servers); - var headerReference = Assert.IsType(responseHeader); - Assert.False(headerReference.UnresolvedReference); - var exampleReference = Assert.IsType(mediaTypeExample); - Assert.False(exampleReference?.UnresolvedReference); - Assert.NotNull(targetHeaders); - Assert.Single(targetHeaders); - Assert.NotNull(targetExamples); - Assert.Single(targetExamples); - // validated the tags of the trimmed document are read as references - var trimmedOpenApiOperationTags = subsetOpenApiDocument.Paths["/items"].Operations[HttpMethod.Get].Tags?.ToArray(); - Assert.NotNull(trimmedOpenApiOperationTags); - Assert.Single(trimmedOpenApiOperationTags); - Assert.True(trimmedOpenApiOperationTags[0].UnresolvedReference); - - // Finally try to write the trimmed document as v3 document - var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); - var writer = new OpenApiJsonWriter(outputStringWriter) + var predicate = OpenApiFilterService.CreatePredicate(operationIds: operationIds); + if (doc is not null) { - Settings = new OpenApiWriterSettings() + var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(doc, predicate); + + var response = subsetOpenApiDocument.Paths?["/items"].Operations?[HttpMethod.Get]?.Responses?["200"]; + var responseHeader = response?.Headers?["x-custom-header"]; + var mediaTypeExample = response?.Content?["application/json"]?.Examples?.First().Value; + var targetHeaders = subsetOpenApiDocument.Components?.Headers; + var targetExamples = subsetOpenApiDocument.Components?.Examples; + + // Assert + Assert.Same(doc.Servers, subsetOpenApiDocument.Servers); + var headerReference = Assert.IsType(responseHeader); + Assert.False(headerReference.UnresolvedReference); + var exampleReference = Assert.IsType(mediaTypeExample); + Assert.False(exampleReference?.UnresolvedReference); + Assert.NotNull(targetHeaders); + Assert.Single(targetHeaders); + Assert.NotNull(targetExamples); + Assert.Single(targetExamples); + // validated the tags of the trimmed document are read as references + var trimmedOpenApiOperationTags = subsetOpenApiDocument.Paths?["/items"].Operations?[HttpMethod.Get].Tags?.ToArray(); + Assert.NotNull(trimmedOpenApiOperationTags); + Assert.Single(trimmedOpenApiOperationTags); + Assert.True(trimmedOpenApiOperationTags[0].UnresolvedReference); + + // Finally try to write the trimmed document as v3 document + var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); + var writer = new OpenApiJsonWriter(outputStringWriter) { - InlineExternalReferences = true, - InlineLocalReferences = true - } - }; - subsetOpenApiDocument.SerializeAsV3(writer); - await writer.FlushAsync(); - var result = outputStringWriter.ToString(); - Assert.NotEmpty(result); + Settings = new OpenApiWriterSettings() + { + InlineExternalReferences = true, + InlineLocalReferences = true + } + }; + subsetOpenApiDocument.SerializeAsV3(writer); + await writer.FlushAsync(); + var result = outputStringWriter.ToString(); + Assert.NotEmpty(result); + } } [Theory] @@ -299,8 +302,8 @@ public void ReturnsPathParametersOnSlicingBasedOnOperationIdsOrTags(string? oper // Assert foreach (var pathItem in subsetOpenApiDocument.Paths) { - Assert.True(pathItem.Value.Parameters.Any()); - Assert.Single(pathItem.Value.Parameters); + Assert.True(pathItem.Value.Parameters!.Any()); + Assert.Single(pathItem.Value.Parameters!); } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 0cc1bc2fb..71768bfbe 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -678,23 +678,23 @@ public static OpenApiDocument CreateOpenApiDocument() } } }; - document.Paths[getTeamsActivityByPeriodPath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("reports.Functions", document)}; - document.Paths[getTeamsActivityByDatePath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("reports.Functions", document)}; - document.Paths[usersPath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; - document.Paths[usersByIdPath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; - document.Paths[usersByIdPath].Operations[HttpMethod.Patch].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; - document.Paths[messagesByIdPath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("users.message", document)}; - document.Paths[administrativeUnitRestorePath].Operations[HttpMethod.Post].Tags = new HashSet {new OpenApiTagReference("administrativeUnits.Actions", document)}; - document.Paths[logoPath].Operations[HttpMethod.Put].Tags = new HashSet {new OpenApiTagReference("applications.application", document)}; - document.Paths[securityProfilesPath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("security.hostSecurityProfile", document)}; - document.Paths[communicationsCallsKeepAlivePath].Operations[HttpMethod.Post].Tags = new HashSet {new OpenApiTagReference("communications.Actions", document)}; - document.Paths[eventsDeltaPath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("groups.Functions", document)}; - document.Paths[refPath].Operations[HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("applications.directoryObject", document)}; - ((OpenApiSchema)document.Paths[usersPath].Operations[HttpMethod.Get].Responses!["200"].Content[applicationJsonMediaType].Schema!.Properties["value"]).Items = new OpenApiSchemaReference("microsoft.graph.user", document); - document.Paths[usersByIdPath].Operations[HttpMethod.Get].Responses!["200"].Content[applicationJsonMediaType].Schema = new OpenApiSchemaReference("microsoft.graph.user", document); - document.Paths[messagesByIdPath].Operations[HttpMethod.Get].Responses!["200"].Content[applicationJsonMediaType].Schema = new OpenApiSchemaReference("microsoft.graph.message", document); - ((OpenApiSchema)document.Paths[securityProfilesPath].Operations[HttpMethod.Get].Responses!["200"].Content[applicationJsonMediaType].Schema!.Properties["value"]).Items = new OpenApiSchemaReference("microsoft.graph.networkInterface", document); - ((OpenApiSchema)document.Paths[eventsDeltaPath].Operations[HttpMethod.Get].Responses!["200"].Content[applicationJsonMediaType].Schema!.Properties["value"]).Items = new OpenApiSchemaReference("microsoft.graph.event", document); + document.Paths[getTeamsActivityByPeriodPath].Operations![HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("reports.Functions", document)}; + document.Paths[getTeamsActivityByDatePath].Operations![HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("reports.Functions", document)}; + document.Paths[usersPath].Operations![HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; + document.Paths[usersByIdPath].Operations![HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; + document.Paths[usersByIdPath].Operations![HttpMethod.Patch].Tags = new HashSet {new OpenApiTagReference("users.user", document)}; + document.Paths[messagesByIdPath].Operations![HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("users.message", document)}; + document.Paths[administrativeUnitRestorePath].Operations![HttpMethod.Post].Tags = new HashSet {new OpenApiTagReference("administrativeUnits.Actions", document)}; + document.Paths[logoPath].Operations![HttpMethod.Put].Tags = new HashSet {new OpenApiTagReference("applications.application", document)}; + document.Paths[securityProfilesPath].Operations![HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("security.hostSecurityProfile", document)}; + document.Paths[communicationsCallsKeepAlivePath].Operations![HttpMethod.Post].Tags = new HashSet {new OpenApiTagReference("communications.Actions", document)}; + document.Paths[eventsDeltaPath].Operations![HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("groups.Functions", document)}; + document.Paths[refPath].Operations![HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("applications.directoryObject", document)}; + ((OpenApiSchema)document.Paths[usersPath].Operations![HttpMethod.Get].Responses!["200"].Content![applicationJsonMediaType].Schema!.Properties!["value"]).Items = new OpenApiSchemaReference("microsoft.graph.user", document); + document.Paths[usersByIdPath].Operations![HttpMethod.Get].Responses!["200"].Content![applicationJsonMediaType].Schema = new OpenApiSchemaReference("microsoft.graph.user", document); + document.Paths[messagesByIdPath].Operations![HttpMethod.Get].Responses!["200"].Content![applicationJsonMediaType].Schema = new OpenApiSchemaReference("microsoft.graph.message", document); + ((OpenApiSchema)document.Paths[securityProfilesPath].Operations![HttpMethod.Get].Responses!["200"].Content![applicationJsonMediaType].Schema!.Properties!["value"]).Items = new OpenApiSchemaReference("microsoft.graph.networkInterface", document); + ((OpenApiSchema)document.Paths[eventsDeltaPath].Operations![HttpMethod.Get].Responses!["200"].Content![applicationJsonMediaType].Schema!.Properties!["value"]).Items = new OpenApiSchemaReference("microsoft.graph.event", document); return document; } } From 4ff2061239ad91096bab3742e81b8cdcfc53eebf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Mar 2025 21:40:31 +0000 Subject: [PATCH 625/752] chore(deps): bump Microsoft.VisualStudio.Threading.Analyzers Bumps [Microsoft.VisualStudio.Threading.Analyzers](https://github.com/microsoft/vs-threading) from 17.13.2 to 17.13.61. - [Release notes](https://github.com/microsoft/vs-threading/releases) - [Commits](https://github.com/microsoft/vs-threading/commits) --- updated-dependencies: - dependency-name: Microsoft.VisualStudio.Threading.Analyzers dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 60437d3f1..f510d9876 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -1,4 +1,4 @@ - + Exe @@ -32,7 +32,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 66eb9923c5d5a2361d901b836e74800706b7a535 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 18 Mar 2025 19:28:11 +0300 Subject: [PATCH 626/752] chore: upgrade package version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index eec5874c4..f86df01d7 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -39,7 +39,7 @@ - +
From 09a5e4ad500ec0e333add6c30cb50bbef5ebaf55 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 18 Mar 2025 19:49:57 +0300 Subject: [PATCH 627/752] chore: upgrade OData lib version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index f86df01d7..3d2d9759b 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@
- + From 336446d7819b6462887f9724228d364c600d8e6d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 31 Mar 2025 14:04:41 -0400 Subject: [PATCH 628/752] fix: hidi fails to parse yaml files when fixing references --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 9f026c3e4..8b412d14f 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -438,7 +438,10 @@ private static async Task ParseOpenApiAsync(string openApiFile, bool var sb = new StringBuilder(); document.SerializeAsV3(new OpenApiYamlWriter(new StringWriter(sb))); - var doc = OpenApiDocument.Parse(sb.ToString(), format).Document; + var settings = new OpenApiReaderSettings(); + settings.AddYamlReader(); + + var doc = OpenApiDocument.Parse(sb.ToString(), format, settings).Document; return doc; } From 16c23323080d227cdea9b5d0e34439963e5eec80 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 2 Apr 2025 11:16:02 -0400 Subject: [PATCH 629/752] chore: upgrades yoko to the latest preview --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 3d2d9759b..5bc72d2c5 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From 0889cf14acd24206cb44a458edca4511550ba96b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 22:00:50 +0000 Subject: [PATCH 630/752] chore(deps): bump Microsoft.Extensions.Logging.Abstractions Bumps [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime) from 9.0.3 to 9.0.4. - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.3...v9.0.4) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 9.0.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 5bc72d2c5..437fbef5d 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,7 +29,7 @@ - + From 134c598c794f98ac5eff9d103d99a44d7f8945a5 Mon Sep 17 00:00:00 2001 From: Maggie Kimani Date: Wed, 9 Apr 2025 12:29:41 +0300 Subject: [PATCH 631/752] feat: Remove default collection initialization for perf reasons (#2284) * feat: use lazy get for collection initialization to reduce resource allocation * chore: use Lazy pattern; preserve null values * chore: replicate for collections in other components * chore: remove unnecessary usings * fix: revert lazy initialization; remove collection initialization * chore: initialize collections to prevent NREs * chore: fix failing tests * chore: revert changes * chore: remove default collection initialization across all models; clean up and fix tests * chore: clean up code; initialize collections where applicable * chore: more cleanup * chore: move assignment within the condition * chore: replace interface with concrete type * chore: simplify collection initialization * Update src/Microsoft.OpenApi/Models/OpenApiPathItem.cs Co-authored-by: Vincent Biret * chore: implement PR feedback * chore: reverts casing change --------- Co-authored-by: Vincent Biret --- .../Extensions/OpenApiExtensibleExtensions.cs | 2 +- .../Extensions/StringExtensions.cs | 2 +- .../Formatters/PowerShellFormatter.cs | 10 +- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 2 +- .../Formatters/PowerShellFormatterTests.cs | 30 ++-- .../Services/OpenApiFilterServiceTests.cs | 14 +- .../Services/OpenApiServiceTests.cs | 2 +- .../UtilityFiles/OpenApiDocumentMock.cs | 150 +++++++++--------- 8 files changed, 103 insertions(+), 109 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs index f4b4f77c5..368b67e8c 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs @@ -13,7 +13,7 @@ internal static class OpenApiExtensibleExtensions /// A dictionary of . /// The key corresponding to the . /// A value matching the provided extensionKey. Return null when extensionKey is not found. - internal static string GetExtension(this IDictionary extensions, string extensionKey) + internal static string GetExtension(this Dictionary extensions, string extensionKey) { if (extensions.TryGetValue(extensionKey, out var value) && value is OpenApiAny { Node: JsonValue castValue } && castValue.TryGetValue(out var stringValue)) { diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs index 3d6362084..bd05e9649 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/StringExtensions.cs @@ -34,7 +34,7 @@ public static bool IsEquals(this string? target, string? searchValue, StringComp /// The target string to split by char. /// The char separator. /// An containing substrings. - public static IList SplitByChar(this string target, char separator) + public static List SplitByChar(this string target, char separator) { if (string.IsNullOrWhiteSpace(target)) { diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index b46e0b2a6..a07888a99 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -77,7 +77,7 @@ public override void Visit(OpenApiOperation operation) // Order matters. Resolve operationId. operationId = RemoveHashSuffix(operationId); if (operationTypeExtension.IsEquals("action") || operationTypeExtension.IsEquals("function")) - operationId = RemoveKeyTypeSegment(operationId, operation.Parameters ?? new List()); + operationId = RemoveKeyTypeSegment(operationId, operation.Parameters ?? []); operationId = SingularizeAndDeduplicateOperationId(operationId.SplitByChar('.')); operationId = ResolveODataCastOperationId(operationId); operationId = ResolveByRefOperationId(operationId); @@ -119,7 +119,7 @@ private static string ResolveODataCastOperationId(string operationId) return match.Success ? $"{match.Groups[1]}{match.Groups[2]}" : operationId; } - private static string SingularizeAndDeduplicateOperationId(IList operationIdSegments) + private static string SingularizeAndDeduplicateOperationId(List operationIdSegments) { var segmentsCount = operationIdSegments.Count; var lastSegmentIndex = segmentsCount - 1; @@ -145,7 +145,7 @@ private static string RemoveHashSuffix(string operationId) return s_hashSuffixRegex.Match(operationId).Value; } - private static string RemoveKeyTypeSegment(string operationId, IList parameters) + private static string RemoveKeyTypeSegment(string operationId, List parameters) { var segments = operationId.SplitByChar('.'); foreach (var parameter in parameters) @@ -159,9 +159,9 @@ private static string RemoveKeyTypeSegment(string operationId, IList parameters) + private static void ResolveFunctionParameters(List parameters) { - foreach (var parameter in parameters.OfType().Where(static p => p.Content?.Any() ?? false)) + foreach (var parameter in parameters.OfType().Where(static p => p.Content?.Count > 0)) { // Replace content with a schema object of type array // for structured or collection-valued function parameters diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index d157a6c42..0f5a9faf4 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -27,7 +27,7 @@ public override void Visit(IOpenApiSchema schema) public int HeaderCount { get; set; } - public override void Visit(IDictionary headers) + public override void Visit(Dictionary headers) { HeaderCount++; } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 92cfae013..7b3cd338e 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -32,11 +32,11 @@ public void FormatOperationIdsInOpenAPIDocument(string operationId, string expec var openApiDocument = new OpenApiDocument { Info = new() { Title = "Test", Version = "1.0" }, - Servers = new List { new() { Url = "https://localhost/" } }, + Servers = [new() { Url = "https://localhost/" }], Paths = new() { { path, new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { operationType, new() { OperationId = operationId } } } @@ -96,7 +96,7 @@ public void ResolveFunctionParameters() var walker = new OpenApiWalker(powerShellFormatter); walker.Walk(openApiDocument); - var idsParameter = openApiDocument.Paths["/foo"].Operations?[HttpMethod.Get].Parameters?.Where(static p => p.Name == "ids").FirstOrDefault(); + var idsParameter = openApiDocument.Paths["/foo"].Operations?[HttpMethod.Get].Parameters?.FirstOrDefault(static p => p.Name == "ids"); // Assert Assert.Null(idsParameter?.Content); @@ -109,11 +109,11 @@ private static OpenApiDocument GetSampleOpenApiDocument() return new() { Info = new() { Title = "Test", Version = "1.0" }, - Servers = new List { new() { Url = "https://localhost/" } }, + Servers = [new() { Url = "https://localhost/" }], Paths = new() { { "/foo", new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { HttpMethod.Get, new() @@ -125,7 +125,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() { Name = "ids", In = ParameterLocation.Query, - Content = new Dictionary + Content = new() { { "application/json", @@ -144,7 +144,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() } } ], - Extensions = new Dictionary + Extensions = new() { { "x-ms-docs-operation-type", new OpenApiAny("function") @@ -158,32 +158,32 @@ private static OpenApiDocument GetSampleOpenApiDocument() }, Components = new() { - Schemas = new Dictionary + Schemas = new() { { "TestSchema", new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new Dictionary + Properties = new() { { "averageAudioDegradation", new OpenApiSchema { - AnyOf = new List - { + AnyOf = + [ new OpenApiSchema() { Type = JsonSchemaType.Number | JsonSchemaType.Null }, new OpenApiSchema() { Type = JsonSchemaType.String } - }, + ], Format = "float", } }, { "defaultPrice", new OpenApiSchema { - OneOf = new List - { + OneOf = + [ new OpenApiSchema() { Type = JsonSchemaType.Number, Format = "double" }, new OpenApiSchema() { Type = JsonSchemaType.String } - } + ] } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 7702c56c1..e617d3b3c 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -79,11 +79,11 @@ public void TestPredicateFiltersUsingRelativeRequestUrls() var openApiDocument = new OpenApiDocument { Info = new() { Title = "Test", Version = "1.0" }, - Servers = new List { new() { Url = "https://localhost/" } }, + Servers = [new() { Url = "https://localhost/" }], Paths = new() { {"/foo", new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { HttpMethod.Get, new() }, { HttpMethod.Patch, new() }, @@ -97,7 +97,7 @@ public void TestPredicateFiltersUsingRelativeRequestUrls() // Given a set of RequestUrls var requestUrls = new Dictionary> { - {"/foo", new List {"GET","POST"}} + {"/foo", ["GET","POST"]} }; // When @@ -116,12 +116,12 @@ public void CreateFilteredDocumentUsingPredicateFromRequestUrl() var openApiDocument = new OpenApiDocument { Info = new() { Title = "Test", Version = "1.0" }, - Servers = new List { new() { Url = "https://localhost/" } }, + Servers = [new() { Url = "https://localhost/" }], Paths = new() { ["/test/{id}"] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { HttpMethod.Get, new() }, { HttpMethod.Patch, new() } @@ -147,7 +147,7 @@ public void CreateFilteredDocumentUsingPredicateFromRequestUrl() var requestUrls = new Dictionary> { - {"/test/{id}", new List {"GET","PATCH"}} + {"/test/{id}",["GET","PATCH"]} }; // Act @@ -302,7 +302,7 @@ public void ReturnsPathParametersOnSlicingBasedOnOperationIdsOrTags(string? oper // Assert foreach (var pathItem in subsetOpenApiDocument.Paths) { - Assert.True(pathItem.Value.Parameters!.Any()); + Assert.True(pathItem.Value.Parameters!.Count != 0); Assert.Single(pathItem.Value.Parameters!); } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index f39e87c69..7e5b4de3c 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -45,7 +45,7 @@ public void CreateFilteredDocumentOnMinimalOpenApi() { ["/test"] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { [HttpMethod.Get] = new OpenApiOperation() } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 71768bfbe..421cecdd7 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -40,18 +40,18 @@ public static OpenApiDocument CreateOpenApiDocument() Title = "People", Version = "v1.0" }, - Servers = new List - { + Servers = + [ new() { Url = "https://graph.microsoft.com/v1.0" } - }, + ], Paths = new() { ["/"] = new OpenApiPathItem() // root path { - Operations = new Dictionary + Operations = new() { { HttpMethod.Get, new OpenApiOperation @@ -72,35 +72,33 @@ public static OpenApiDocument CreateOpenApiDocument() }, [getTeamsActivityByPeriodPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { HttpMethod.Get, new OpenApiOperation { OperationId = "reports.getTeamsUserActivityCounts", Summary = "Invoke function getTeamsUserActivityUserCounts", - Parameters = new List - { + Parameters = + [ + new OpenApiParameter() { - new OpenApiParameter() + Name = "period", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema() { - Name = "period", - In = ParameterLocation.Path, - Required = true, - Schema = new OpenApiSchema() - { - Type = JsonSchemaType.String - } + Type = JsonSchemaType.String } } - }, + ], Responses = new() { { "200", new OpenApiResponse() { Description = "Success", - Content = new Dictionary + Content = new() { { applicationJsonMediaType, @@ -119,53 +117,49 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Parameters = new List - { + Parameters = + [ + new OpenApiParameter() { - new OpenApiParameter() + Name = "period", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema() { - Name = "period", - In = ParameterLocation.Path, - Required = true, - Schema = new OpenApiSchema() - { - Type = JsonSchemaType.String - } + Type = JsonSchemaType.String } } - } + ] }, [getTeamsActivityByDatePath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { HttpMethod.Get, new OpenApiOperation { OperationId = "reports.getTeamsUserActivityUserDetail-a3f1", Summary = "Invoke function getTeamsUserActivityUserDetail", - Parameters = new List - { + Parameters = + [ + new OpenApiParameter() { - new OpenApiParameter() + Name = "period", + In = ParameterLocation.Path, + Required = true, + Schema = new OpenApiSchema() { - Name = "period", - In = ParameterLocation.Path, - Required = true, - Schema = new OpenApiSchema() - { - Type = JsonSchemaType.String - } + Type = JsonSchemaType.String } } - }, + ], Responses = new() { { "200", new OpenApiResponse() { Description = "Success", - Content = new Dictionary + Content = new() { { applicationJsonMediaType, @@ -184,8 +178,8 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Parameters = new List - { + Parameters = + [ new OpenApiParameter() { Name = "period", @@ -196,11 +190,11 @@ public static OpenApiDocument CreateOpenApiDocument() Type = JsonSchemaType.String } } - } + ] }, [usersPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { HttpMethod.Get, new OpenApiOperation @@ -213,7 +207,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved entities", - Content = new Dictionary + Content = new() { { applicationJsonMediaType, @@ -223,7 +217,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Title = "Collection of user", Type = JsonSchemaType.Object, - Properties = new Dictionary + Properties = new() { { "value", @@ -246,7 +240,7 @@ public static OpenApiDocument CreateOpenApiDocument() }, [usersByIdPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { HttpMethod.Get, new OpenApiOperation @@ -259,7 +253,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved entity", - Content = new Dictionary + Content = new() { { applicationJsonMediaType, @@ -293,7 +287,7 @@ public static OpenApiDocument CreateOpenApiDocument() }, [messagesByIdPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { HttpMethod.Get, new OpenApiOperation @@ -301,8 +295,8 @@ public static OpenApiDocument CreateOpenApiDocument() OperationId = "users.GetMessages", Summary = "Get messages from users", Description = "The messages in a mailbox or folder. Read-only. Nullable.", - Parameters = new List - { + Parameters = + [ new OpenApiParameter() { Name = "$select", @@ -315,14 +309,14 @@ public static OpenApiDocument CreateOpenApiDocument() } // missing explode parameter } - }, + ], Responses = new() { { "200", new OpenApiResponse() { Description = "Retrieved navigation property", - Content = new Dictionary + Content = new() { { applicationJsonMediaType, @@ -340,7 +334,7 @@ public static OpenApiDocument CreateOpenApiDocument() }, [administrativeUnitRestorePath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { HttpMethod.Post, new OpenApiOperation @@ -369,7 +363,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new Dictionary + Content = new() { { applicationJsonMediaType, @@ -391,7 +385,7 @@ public static OpenApiDocument CreateOpenApiDocument() }, [logoPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { HttpMethod.Put, new OpenApiOperation @@ -413,7 +407,7 @@ public static OpenApiDocument CreateOpenApiDocument() }, [securityProfilesPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { HttpMethod.Get, new OpenApiOperation @@ -426,7 +420,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved navigation property", - Content = new Dictionary + Content = new() { { applicationJsonMediaType, @@ -436,7 +430,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Title = "Collection of hostSecurityProfile", Type = JsonSchemaType.Object, - Properties = new Dictionary + Properties = new() { { "value", @@ -459,15 +453,15 @@ public static OpenApiDocument CreateOpenApiDocument() }, [communicationsCallsKeepAlivePath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { HttpMethod.Post, new OpenApiOperation { OperationId = "communications.calls.call.keepAlive", Summary = "Invoke action keepAlive", - Parameters = new List - { + Parameters = + [ new OpenApiParameter() { Name = "call-id", @@ -478,14 +472,14 @@ public static OpenApiDocument CreateOpenApiDocument() { Type = JsonSchemaType.String }, - Extensions = new Dictionary + Extensions = new() { { "x-ms-docs-key-type", new OpenApiAny("call") } } } - }, + ], Responses = new() { { @@ -495,7 +489,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Extensions = new Dictionary + Extensions = new() { { "x-ms-docs-operation-type", new OpenApiAny("action") @@ -507,15 +501,15 @@ public static OpenApiDocument CreateOpenApiDocument() }, [eventsDeltaPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { HttpMethod.Get, new OpenApiOperation { OperationId = "groups.group.events.event.calendar.events.delta", Summary = "Invoke function delta", - Parameters = new List - { + Parameters = + [ new OpenApiParameter() { Name = "group-id", @@ -526,7 +520,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Type = JsonSchemaType.String }, - Extensions = new Dictionary + Extensions = new() { { "x-ms-docs-key-type", new OpenApiAny("group") @@ -543,21 +537,21 @@ public static OpenApiDocument CreateOpenApiDocument() { Type = JsonSchemaType.String }, - Extensions = new Dictionary + Extensions = new() { { "x-ms-docs-key-type", new OpenApiAny("event") } } } - }, + ], Responses = new() { { "200", new OpenApiResponse() { Description = "Success", - Content = new Dictionary + Content = new() { { applicationJsonMediaType, @@ -565,7 +559,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Schema = new OpenApiSchema() { - Properties = new Dictionary + Properties = new() { { "value", @@ -582,7 +576,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Extensions = new Dictionary + Extensions = new() { { "x-ms-docs-operation-type", new OpenApiAny("function") @@ -594,7 +588,7 @@ public static OpenApiDocument CreateOpenApiDocument() }, [refPath] = new OpenApiPathItem() { - Operations = new Dictionary + Operations = new() { { HttpMethod.Get, new OpenApiOperation @@ -608,14 +602,14 @@ public static OpenApiDocument CreateOpenApiDocument() }, Components = new() { - Schemas = new Dictionary + Schemas = new() { { "microsoft.graph.networkInterface", new OpenApiSchema { Title = "networkInterface", Type = JsonSchemaType.Object, - Properties = new Dictionary + Properties = new() { { "description", new OpenApiSchema From 265b1f13513bbc7d9163d9cfc55344f217ed5355 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Apr 2025 22:04:40 +0000 Subject: [PATCH 632/752] chore(deps): bump Microsoft.Extensions.Logging, Microsoft.Extensions.Logging.Abstractions, Microsoft.Extensions.Logging.Console and System.Text.Json Bumps [Microsoft.Extensions.Logging](https://github.com/dotnet/runtime), [Microsoft.Extensions.Logging.Abstractions](https://github.com/dotnet/runtime), [Microsoft.Extensions.Logging.Console](https://github.com/dotnet/runtime) and [System.Text.Json](https://github.com/dotnet/runtime). These dependencies needed to be updated together. Updates `Microsoft.Extensions.Logging` from 9.0.3 to 9.0.4 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.3...v9.0.4) Updates `Microsoft.Extensions.Logging.Abstractions` from 9.0.4 to 9.0.4 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.4...v9.0.4) Updates `Microsoft.Extensions.Logging.Console` from 9.0.3 to 9.0.4 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.3...v9.0.4) Updates `System.Text.Json` from 9.0.4 to 9.0.4 - [Release notes](https://github.com/dotnet/runtime/releases) - [Commits](https://github.com/dotnet/runtime/compare/v9.0.4...v9.0.4) --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging dependency-version: 9.0.4 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 9.0.4 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 9.0.4 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.Text.Json dependency-version: 9.0.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 437fbef5d..1e1a8c803 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -28,9 +28,9 @@ - + - + runtime; build; native; contentfiles; analyzers; buildtransitive From d86cd310182bd0415d2dfac412e8647b5f0f0192 Mon Sep 17 00:00:00 2001 From: Martin Costello Date: Tue, 15 Apr 2025 13:25:00 +0100 Subject: [PATCH 633/752] fix: Improve handling of OpenAPI tag references (#2325) * Fix OpenApiTagComparer behaviour Update `OpenApiTagComparer` to behave intuitively with `OpenApiTagReference` instances pointing to tags not defined in an `OpenApiDocument`. Contributes to #2319. * Verify tag references on serialization Verify OpenAPI tag references refer to a valid OpenAPI tag in the document on serialization. Resolves #2319. --- .../Services/OpenApiFilterServiceTests.cs | 7 ++++--- .../UtilityFiles/docWithReusableHeadersAndExamples.yaml | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index e617d3b3c..4b17ad699 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -244,7 +244,7 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly( var openApiOperationTags = doc?.Paths["/items"].Operations?[HttpMethod.Get].Tags?.ToArray(); Assert.NotNull(openApiOperationTags); Assert.Single(openApiOperationTags); - Assert.True(openApiOperationTags[0].UnresolvedReference); + Assert.NotNull(openApiOperationTags[0].Target); var predicate = OpenApiFilterService.CreatePredicate(operationIds: operationIds); if (doc is not null) @@ -271,7 +271,7 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly( var trimmedOpenApiOperationTags = subsetOpenApiDocument.Paths?["/items"].Operations?[HttpMethod.Get].Tags?.ToArray(); Assert.NotNull(trimmedOpenApiOperationTags); Assert.Single(trimmedOpenApiOperationTags); - Assert.True(trimmedOpenApiOperationTags[0].UnresolvedReference); + Assert.NotNull(trimmedOpenApiOperationTags[0].Target); // Finally try to write the trimmed document as v3 document var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -302,7 +302,8 @@ public void ReturnsPathParametersOnSlicingBasedOnOperationIdsOrTags(string? oper // Assert foreach (var pathItem in subsetOpenApiDocument.Paths) { - Assert.True(pathItem.Value.Parameters!.Count != 0); + Assert.NotNull(pathItem.Value.Parameters); + Assert.NotEmpty(pathItem.Value.Parameters); Assert.Single(pathItem.Value.Parameters!); } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml index 8edeb1945..60ccbe057 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/docWithReusableHeadersAndExamples.yaml @@ -81,3 +81,5 @@ components: value: name: "New Item" +tags: + - name: list.items From efc6d77f82a06a84afc2673f0af2774c5a094b31 Mon Sep 17 00:00:00 2001 From: Michael Wamae <68949852+Michael-Wamae@users.noreply.github.com> Date: Wed, 16 Apr 2025 13:49:02 +0300 Subject: [PATCH 634/752] feat: openapiformat enum cleanup (#2326) * feat: openapiformat enum cleanup * align string options Co-authored-by: Vincent Biret * resolve PR comments --------- Co-authored-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 31 ++++++++++--------- .../Options/CommandOptions.cs | 2 +- .../Options/HidiOptions.cs | 2 +- .../Services/OpenApiServiceTests.cs | 4 +-- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 8b412d14f..52d25ef27 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -55,7 +55,7 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog if (options.Output == null) { #pragma warning disable CA1308 // Normalize strings to uppercase - var extension = options.OpenApiFormat?.GetDisplayName().ToLowerInvariant(); + var extension = options.OpenApiFormat?.ToLowerInvariant(); var inputExtension = !string.IsNullOrEmpty(extension) ? string.Concat(".", extension) : GetInputPathExtension(options.OpenApi, options.Csdl); @@ -73,7 +73,7 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog } // Default to yaml and OpenApiVersion 3_1 during csdl to OpenApi conversion - var openApiFormat = options.OpenApiFormat ?? (!string.IsNullOrEmpty(options.OpenApi) ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiFormat.Yaml); + var openApiFormat = options.OpenApiFormat ?? (!string.IsNullOrEmpty(options.OpenApi) ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiConstants.Yaml); var openApiVersion = options.Version != null ? TryParseOpenApiSpecVersion(options.Version) : OpenApiSpecVersion.OpenApi3_1; // If ApiManifest is provided, set the referenced OpenAPI document @@ -92,7 +92,7 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog } // Load OpenAPI document - var document = await GetOpenApiAsync(options, openApiFormat.GetDisplayName(), logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); + var document = await GetOpenApiAsync(options, openApiFormat, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); if (options.FilterOptions != null && document is not null) { @@ -189,7 +189,7 @@ private static OpenApiDocument ApplyFilters(HidiOptions options, ILogger logger, return document; } - private static async Task WriteOpenApiAsync(HidiOptions options, OpenApiFormat openApiFormat, OpenApiSpecVersion openApiVersion, OpenApiDocument document, ILogger logger, CancellationToken cancellationToken) + private static async Task WriteOpenApiAsync(HidiOptions options, string openApiFormat, OpenApiSpecVersion openApiVersion, OpenApiDocument document, ILogger logger, CancellationToken cancellationToken) { using (logger.BeginScope("Output")) { @@ -202,11 +202,12 @@ private static async Task WriteOpenApiAsync(HidiOptions options, OpenApiFormat o InlineLocalReferences = options.InlineLocal, InlineExternalReferences = options.InlineExternal }; - - IOpenApiWriter writer = openApiFormat switch +#pragma warning disable CA1308 + IOpenApiWriter writer = openApiFormat.ToLowerInvariant() switch +#pragma warning restore CA1308 { - OpenApiFormat.Json => options.TerseOutput ? new(textWriter, settings, options.TerseOutput) : new OpenApiJsonWriter(textWriter, settings, false), - OpenApiFormat.Yaml => new OpenApiYamlWriter(textWriter, settings), + OpenApiConstants.Json => options.TerseOutput ? new(textWriter, settings, options.TerseOutput) : new OpenApiJsonWriter(textWriter, settings, false), + OpenApiConstants.Yaml => new OpenApiYamlWriter(textWriter, settings), _ => throw new ArgumentException("Unknown format"), }; @@ -560,10 +561,10 @@ SecurityException or /// /// /// - private static OpenApiFormat GetOpenApiFormat(string input, ILogger logger) + private static string GetOpenApiFormat(string input, ILogger logger) { logger.LogTrace("Getting the OpenApi format"); - return !input.StartsWith("http", StringComparison.OrdinalIgnoreCase) && Path.GetExtension(input) == ".json" ? OpenApiFormat.Json : OpenApiFormat.Yaml; + return !input.StartsWith("http", StringComparison.OrdinalIgnoreCase) && Path.GetExtension(input) == ".json" ? OpenApiConstants.Json : OpenApiConstants.Yaml; } private static string GetInputPathExtension(string? openapi = null, string? csdl = null) @@ -590,8 +591,8 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl throw new ArgumentException("Please input a file path or URL"); } - var openApiFormat = options.OpenApiFormat ?? (!string.IsNullOrEmpty(options.OpenApi) ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiFormat.Yaml); - var document = await GetOpenApiAsync(options, openApiFormat.GetDisplayName(), logger, null, cancellationToken).ConfigureAwait(false); + var openApiFormat = options.OpenApiFormat ?? (!string.IsNullOrEmpty(options.OpenApi) ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiConstants.Yaml); + var document = await GetOpenApiAsync(options, openApiFormat, logger, null, cancellationToken).ConfigureAwait(false); if (document is not null) { using (logger.BeginScope("Creating diagram")) @@ -754,10 +755,10 @@ internal static async Task PluginManifestAsync(HidiOptions options, ILogger logg } var openApiFormat = options.OpenApiFormat ?? (!string.IsNullOrEmpty(options.OpenApi) - ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiFormat.Yaml); + ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiConstants.Yaml); // Load OpenAPI document - var document = await GetOpenApiAsync(options, openApiFormat.GetDisplayName(), logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); + var document = await GetOpenApiAsync(options, openApiFormat, logger, options.MetadataVersion, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); @@ -777,7 +778,7 @@ internal static async Task PluginManifestAsync(HidiOptions options, ILogger logg options.TerseOutput = true; if (document is not null) { - await WriteOpenApiAsync(options, OpenApiFormat.Json, OpenApiSpecVersion.OpenApi3_1, document, logger, cancellationToken).ConfigureAwait(false); + await WriteOpenApiAsync(options, OpenApiConstants.Json, OpenApiSpecVersion.OpenApi3_1, document, logger, cancellationToken).ConfigureAwait(false); // Create OpenAIPluginManifest from ApiDependency and OpenAPI document var manifest = new OpenAIPluginManifest(document.Info.Title ?? "Title", diff --git a/src/Microsoft.OpenApi.Hidi/Options/CommandOptions.cs b/src/Microsoft.OpenApi.Hidi/Options/CommandOptions.cs index 6fee866cb..908435c33 100644 --- a/src/Microsoft.OpenApi.Hidi/Options/CommandOptions.cs +++ b/src/Microsoft.OpenApi.Hidi/Options/CommandOptions.cs @@ -16,7 +16,7 @@ internal class CommandOptions public readonly Option CleanOutputOption = new("--clean-output", "Overwrite an existing file"); public readonly Option VersionOption = new("--version", "OpenAPI specification version"); public readonly Option MetadataVersionOption = new("--metadata-version", "Graph metadata version to use."); - public readonly Option FormatOption = new("--format", "File format"); + public readonly Option FormatOption = new("--format", "File format"); public readonly Option TerseOutputOption = new("--terse-output", "Produce terse json output"); public readonly Option SettingsFileOption = new("--settings-path", "The configuration file with CSDL conversion settings."); public readonly Option LogLevelOption = new("--log-level", () => LogLevel.Information, "The log level to use when logging messages to the main output."); diff --git a/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs b/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs index fca97c87f..127a0a14a 100644 --- a/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs +++ b/src/Microsoft.OpenApi.Hidi/Options/HidiOptions.cs @@ -20,7 +20,7 @@ internal class HidiOptions public bool CleanOutput { get; set; } public string? Version { get; set; } public string? MetadataVersion { get; set; } - public OpenApiFormat? OpenApiFormat { get; set; } + public string? OpenApiFormat { get; set; } public bool TerseOutput { get; set; } public IConfiguration? SettingsConfig { get; set; } public LogLevel LogLevel { get; set; } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 7e5b4de3c..97c27fe37 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -261,7 +261,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchF OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), CleanOutput = true, Version = "3.0", - OpenApiFormat = OpenApiFormat.Yaml, + OpenApiFormat = OpenApiConstants.Yaml, TerseOutput = false, InlineLocal = false, InlineExternal = false, @@ -296,7 +296,7 @@ public async Task TransformToPowerShellCompliantOpenApiAsync() OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), CleanOutput = true, Version = "3.0", - OpenApiFormat = OpenApiFormat.Yaml, + OpenApiFormat = OpenApiConstants.Yaml, TerseOutput = false, InlineLocal = false, InlineExternal = false, From dce67085091a7ecb06bf7c6111f58f735743636f Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 17 Apr 2025 16:08:57 -0400 Subject: [PATCH 635/752] feat: upgrades openapi.net.odata and apimanifest to the latest version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 1e1a8c803..1cf2489e9 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -31,15 +31,15 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + From 4f62f6e742889b445d5ffe544e485186ca35487d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Apr 2025 21:39:02 +0000 Subject: [PATCH 636/752] chore(deps): bump Microsoft.OpenApi.ApiManifest and SharpYaml Bumps [Microsoft.OpenApi.ApiManifest](https://github.com/Microsoft/OpenApi.ApiManifest) and [SharpYaml](https://github.com/xoofx/SharpYaml). These dependencies needed to be updated together. Updates `Microsoft.OpenApi.ApiManifest` from 2.0.0-preview3 to 2.0.0-preview4 - [Release notes](https://github.com/Microsoft/OpenApi.ApiManifest/releases) - [Changelog](https://github.com/microsoft/OpenApi.ApiManifest/blob/main/CHANGELOG.md) - [Commits](https://github.com/Microsoft/OpenApi.ApiManifest/compare/v2.0.0-preview3...v2.0.0-preview4) Updates `SharpYaml` from 2.1.1 to 2.1.1 - [Release notes](https://github.com/xoofx/SharpYaml/releases) - [Changelog](https://github.com/xoofx/SharpYaml/blob/master/changelog.md) - [Commits](https://github.com/xoofx/SharpYaml/compare/2.1.1...2.1.1) --- updated-dependencies: - dependency-name: Microsoft.OpenApi.ApiManifest dependency-version: 2.0.0-preview4 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: SharpYaml dependency-version: 2.1.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 1e1a8c803..fc1a2b9a5 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -39,7 +39,7 @@ - + From f001989f3b1a28120e49274822037a868c30071a Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 18 Apr 2025 12:03:23 -0400 Subject: [PATCH 637/752] Update src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 1cf2489e9..8be5b720c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From fcbde2b944e611b8c1a47b833180eb365080939a Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Wed, 23 Apr 2025 19:07:42 +0300 Subject: [PATCH 638/752] chore: rename OpenApiAny to JsonNodeExtension --- .../Extensions/OpenApiExtensibleExtensions.cs | 4 ++-- .../Formatters/PowerShellFormatterTests.cs | 6 ++---- .../UtilityFiles/OpenApiDocumentMock.cs | 13 ++++++------- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs index 368b67e8c..1287e704d 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs @@ -1,4 +1,4 @@ -using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Interfaces; using System.Collections.Generic; using System.Text.Json.Nodes; @@ -15,7 +15,7 @@ internal static class OpenApiExtensibleExtensions /// A value matching the provided extensionKey. Return null when extensionKey is not found. internal static string GetExtension(this Dictionary extensions, string extensionKey) { - if (extensions.TryGetValue(extensionKey, out var value) && value is OpenApiAny { Node: JsonValue castValue } && castValue.TryGetValue(out var stringValue)) + if (extensions.TryGetValue(extensionKey, out var value) && value is JsonNodeExtension { Node: JsonValue castValue } && castValue.TryGetValue(out var stringValue)) { return stringValue; } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 7b3cd338e..0e618ba1b 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -1,8 +1,6 @@ -using Microsoft.OpenApi.Any; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Hidi.Formatters; -using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; -using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Services; using Xunit; @@ -147,7 +145,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() Extensions = new() { { - "x-ms-docs-operation-type", new OpenApiAny("function") + "x-ms-docs-operation-type", new JsonNodeExtension("function") } } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 421cecdd7..3335f6b7f 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -1,8 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using Microsoft.OpenApi.Any; -using Microsoft.OpenApi.Interfaces; +using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Models.References; @@ -475,7 +474,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new() { { - "x-ms-docs-key-type", new OpenApiAny("call") + "x-ms-docs-key-type", new JsonNodeExtension("call") } } } @@ -492,7 +491,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new() { { - "x-ms-docs-operation-type", new OpenApiAny("action") + "x-ms-docs-operation-type", new JsonNodeExtension("action") } } } @@ -523,7 +522,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new() { { - "x-ms-docs-key-type", new OpenApiAny("group") + "x-ms-docs-key-type", new JsonNodeExtension("group") } } }, @@ -540,7 +539,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new() { { - "x-ms-docs-key-type", new OpenApiAny("event") + "x-ms-docs-key-type", new JsonNodeExtension("event") } } } @@ -579,7 +578,7 @@ public static OpenApiDocument CreateOpenApiDocument() Extensions = new() { { - "x-ms-docs-operation-type", new OpenApiAny("function") + "x-ms-docs-operation-type", new JsonNodeExtension("function") } } } From 4141f29ec6a76e638ed4f12bab8e3099a761dd8a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 5 May 2025 22:00:13 +0000 Subject: [PATCH 639/752] chore(deps): bump xunit.runner.visualstudio from 3.0.2 to 3.1.0 Bumps [xunit.runner.visualstudio](https://github.com/xunit/visualstudio.xunit) from 3.0.2 to 3.1.0. - [Release notes](https://github.com/xunit/visualstudio.xunit/releases) - [Commits](https://github.com/xunit/visualstudio.xunit/compare/3.0.2...3.1.0) --- updated-dependencies: - dependency-name: xunit.runner.visualstudio dependency-version: 3.1.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 47d67fc5b..ec82664d2 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -1,4 +1,4 @@ - + net8.0 @@ -15,7 +15,7 @@ - + From de3b3be5e640b20bba09057614621359a97532ad Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 15 May 2025 13:54:56 -0400 Subject: [PATCH 640/752] chore: upgrades yoko to preview 14 --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 8be5b720c..ae01f0860 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From cc4c56e2dea63028b7cbdb870f8189052835d665 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Mon, 19 May 2025 18:49:57 +0300 Subject: [PATCH 641/752] fix: revert to using IDictionary for collections --- .../Extensions/OpenApiExtensibleExtensions.cs | 2 +- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 2 +- .../Formatters/PowerShellFormatterTests.cs | 10 +++-- .../UtilityFiles/OpenApiDocumentMock.cs | 37 ++++++++++--------- 4 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs index 1287e704d..914a61354 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs @@ -13,7 +13,7 @@ internal static class OpenApiExtensibleExtensions /// A dictionary of . /// The key corresponding to the . /// A value matching the provided extensionKey. Return null when extensionKey is not found. - internal static string GetExtension(this Dictionary extensions, string extensionKey) + internal static string GetExtension(this IDictionary extensions, string extensionKey) { if (extensions.TryGetValue(extensionKey, out var value) && value is JsonNodeExtension { Node: JsonValue castValue } && castValue.TryGetValue(out var stringValue)) { diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index 0f5a9faf4..d157a6c42 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -27,7 +27,7 @@ public override void Visit(IOpenApiSchema schema) public int HeaderCount { get; set; } - public override void Visit(Dictionary headers) + public override void Visit(IDictionary headers) { HeaderCount++; } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 0e618ba1b..15ddf9e17 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -1,6 +1,8 @@ using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Hidi.Formatters; +using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; +using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Services; using Xunit; @@ -123,7 +125,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() { Name = "ids", In = ParameterLocation.Query, - Content = new() + Content = new Dictionary() { { "application/json", @@ -142,7 +144,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() } } ], - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-operation-type", new JsonNodeExtension("function") @@ -156,12 +158,12 @@ private static OpenApiDocument GetSampleOpenApiDocument() }, Components = new() { - Schemas = new() + Schemas = new Dictionary() { { "TestSchema", new OpenApiSchema { Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { { "averageAudioDegradation", new OpenApiSchema diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 3335f6b7f..535e04a2c 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. using Microsoft.OpenApi.Extensions; +using Microsoft.OpenApi.Interfaces; using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Models.References; @@ -97,7 +98,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -158,7 +159,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -206,7 +207,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved entities", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -216,7 +217,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Title = "Collection of user", Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { { "value", @@ -252,7 +253,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved entity", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -315,7 +316,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved navigation property", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -362,7 +363,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -419,7 +420,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved navigation property", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -429,7 +430,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Title = "Collection of hostSecurityProfile", Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { { "value", @@ -471,7 +472,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Type = JsonSchemaType.String }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-key-type", new JsonNodeExtension("call") @@ -488,7 +489,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-operation-type", new JsonNodeExtension("action") @@ -519,7 +520,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Type = JsonSchemaType.String }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-key-type", new JsonNodeExtension("group") @@ -536,7 +537,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Type = JsonSchemaType.String }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-key-type", new JsonNodeExtension("event") @@ -550,7 +551,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new() + Content = new Dictionary() { { applicationJsonMediaType, @@ -558,7 +559,7 @@ public static OpenApiDocument CreateOpenApiDocument() { Schema = new OpenApiSchema() { - Properties = new() + Properties = new Dictionary() { { "value", @@ -575,7 +576,7 @@ public static OpenApiDocument CreateOpenApiDocument() } } }, - Extensions = new() + Extensions = new Dictionary() { { "x-ms-docs-operation-type", new JsonNodeExtension("function") @@ -601,14 +602,14 @@ public static OpenApiDocument CreateOpenApiDocument() }, Components = new() { - Schemas = new() + Schemas = new Dictionary() { { "microsoft.graph.networkInterface", new OpenApiSchema { Title = "networkInterface", Type = JsonSchemaType.Object, - Properties = new() + Properties = new Dictionary() { { "description", new OpenApiSchema From 85e4c7fbb0ca0828f71c230a147f18cb4a23a030 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Fri, 23 May 2025 14:49:18 +0300 Subject: [PATCH 642/752] chore: revert collections to use interface types --- .../Formatters/PowerShellFormatter.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index a07888a99..c3aa81e6b 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -77,7 +77,7 @@ public override void Visit(OpenApiOperation operation) // Order matters. Resolve operationId. operationId = RemoveHashSuffix(operationId); if (operationTypeExtension.IsEquals("action") || operationTypeExtension.IsEquals("function")) - operationId = RemoveKeyTypeSegment(operationId, operation.Parameters ?? []); + operationId = RemoveKeyTypeSegment(operationId, operation.Parameters ?? new List()); operationId = SingularizeAndDeduplicateOperationId(operationId.SplitByChar('.')); operationId = ResolveODataCastOperationId(operationId); operationId = ResolveByRefOperationId(operationId); @@ -145,7 +145,7 @@ private static string RemoveHashSuffix(string operationId) return s_hashSuffixRegex.Match(operationId).Value; } - private static string RemoveKeyTypeSegment(string operationId, List parameters) + private static string RemoveKeyTypeSegment(string operationId, IList parameters) { var segments = operationId.SplitByChar('.'); foreach (var parameter in parameters) @@ -159,7 +159,7 @@ private static string RemoveKeyTypeSegment(string operationId, List parameters) + private static void ResolveFunctionParameters(IList parameters) { foreach (var parameter in parameters.OfType().Where(static p => p.Content?.Count > 0)) { From 33ee7516640495049df075e27de6e1a57802d443 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Mon, 26 May 2025 16:23:50 +0300 Subject: [PATCH 643/752] chore: flatten namespaces to align with top-level namespace --- .../Extensions/OpenApiExtensibleExtensions.cs | 1 - src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs | 2 -- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 5 ++--- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 2 -- .../Formatters/PowerShellFormatterTests.cs | 1 - .../Services/OpenApiFilterServiceTests.cs | 4 ---- .../Services/OpenApiServiceTests.cs | 3 --- .../UtilityFiles/OpenApiDocumentMock.cs | 3 --- 8 files changed, 2 insertions(+), 19 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs index 1287e704d..8ce7cb97b 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs @@ -1,5 +1,4 @@ using Microsoft.OpenApi.Extensions; -using Microsoft.OpenApi.Interfaces; using System.Collections.Generic; using System.Text.Json.Nodes; diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index a07888a99..d953792e9 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -7,8 +7,6 @@ using Humanizer; using Humanizer.Inflections; using Microsoft.OpenApi.Hidi.Extensions; -using Microsoft.OpenApi.Models; -using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Services; namespace Microsoft.OpenApi.Hidi.Formatters diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 52d25ef27..338c8416f 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -28,12 +28,10 @@ using Microsoft.OpenApi.Hidi.Formatters; using Microsoft.OpenApi.Hidi.Options; using Microsoft.OpenApi.Hidi.Utilities; -using Microsoft.OpenApi.Models; using Microsoft.OpenApi.OData; using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Writers; -using Microsoft.OpenApi.YamlReader; using static Microsoft.OpenApi.Hidi.OpenApiSpecVersionHelper; namespace Microsoft.OpenApi.Hidi @@ -420,7 +418,8 @@ private static async Task ParseOpenApiAsync(string openApiFile, bool var edmModel = CsdlReader.Parse(XElement.Parse(csdlText).CreateReader()); settings ??= SettingsUtilities.GetConfiguration(); - var document = edmModel.ConvertToOpenApi(SettingsUtilities.GetOpenApiConvertSettings(settings, metadataVersion)); + // TODO: uncomment when namespaces are fixed in OData lib + var document = new OpenApiDocument(); //edmModel.ConvertToOpenApi(SettingsUtilities.GetOpenApiConvertSettings(settings, metadataVersion)); document = FixReferences(document, format); return document; diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index 0f5a9faf4..8b7e31b5d 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -3,8 +3,6 @@ using System; using System.Collections.Generic; -using Microsoft.OpenApi.Models; -using Microsoft.OpenApi.Models.Interfaces; using Microsoft.OpenApi.Services; namespace Microsoft.OpenApi.Hidi diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 0e618ba1b..b366d80bb 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -1,6 +1,5 @@ using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Hidi.Formatters; -using Microsoft.OpenApi.Models; using Microsoft.OpenApi.Services; using Xunit; diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 4b17ad699..d5dc90653 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -3,10 +3,6 @@ using System.Globalization; using Microsoft.Extensions.Logging; -using Microsoft.OpenApi.Extensions; -using Microsoft.OpenApi.Models; -using Microsoft.OpenApi.Models.Interfaces; -using Microsoft.OpenApi.Models.References; using Microsoft.OpenApi.Reader; using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Tests.UtilityFiles; diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 97c27fe37..de1ef50d7 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -9,10 +9,7 @@ using Microsoft.OpenApi.ApiManifest.OpenAI; using Microsoft.OpenApi.Hidi.Options; using Microsoft.OpenApi.Hidi.Utilities; -using Microsoft.OpenApi.Models; using Microsoft.OpenApi.OData; -using Microsoft.OpenApi.Reader; -using Microsoft.OpenApi.YamlReader; using Microsoft.OpenApi.Services; using Xunit; diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 3335f6b7f..5dd089512 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -2,9 +2,6 @@ // Licensed under the MIT license. using Microsoft.OpenApi.Extensions; -using Microsoft.OpenApi.Models; -using Microsoft.OpenApi.Models.Interfaces; -using Microsoft.OpenApi.Models.References; namespace Microsoft.OpenApi.Tests.UtilityFiles { From b6e18f8285696744d5159dbedf1ccb523e78375e Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 27 May 2025 18:21:36 +0300 Subject: [PATCH 644/752] chore: flatten namespaces for more classes --- .../Extensions/OpenApiExtensibleExtensions.cs | 3 +-- src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs | 1 - src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 ---- src/Microsoft.OpenApi.Hidi/StatsVisitor.cs | 1 - .../Formatters/PowerShellFormatterTests.cs | 4 +--- .../Services/OpenApiFilterServiceTests.cs | 2 -- .../Services/OpenApiServiceTests.cs | 1 - .../UtilityFiles/OpenApiDocumentMock.cs | 2 -- 8 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs index 8ce7cb97b..0801d1d49 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/OpenApiExtensibleExtensions.cs @@ -1,5 +1,4 @@ -using Microsoft.OpenApi.Extensions; -using System.Collections.Generic; +using System.Collections.Generic; using System.Text.Json.Nodes; namespace Microsoft.OpenApi.Hidi.Extensions diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index d953792e9..a4614e583 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -7,7 +7,6 @@ using Humanizer; using Humanizer.Inflections; using Microsoft.OpenApi.Hidi.Extensions; -using Microsoft.OpenApi.Services; namespace Microsoft.OpenApi.Hidi.Formatters { diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 338c8416f..a0146af63 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -23,15 +23,11 @@ using Microsoft.OpenApi.ApiManifest; using Microsoft.OpenApi.ApiManifest.OpenAI; using Microsoft.OpenApi.ApiManifest.OpenAI.Authentication; -using Microsoft.OpenApi.Extensions; using Microsoft.OpenApi.Hidi.Extensions; using Microsoft.OpenApi.Hidi.Formatters; using Microsoft.OpenApi.Hidi.Options; using Microsoft.OpenApi.Hidi.Utilities; -using Microsoft.OpenApi.OData; using Microsoft.OpenApi.Reader; -using Microsoft.OpenApi.Services; -using Microsoft.OpenApi.Writers; using static Microsoft.OpenApi.Hidi.OpenApiSpecVersionHelper; namespace Microsoft.OpenApi.Hidi diff --git a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs index 8b7e31b5d..d12d9bdfb 100644 --- a/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs +++ b/src/Microsoft.OpenApi.Hidi/StatsVisitor.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using Microsoft.OpenApi.Services; namespace Microsoft.OpenApi.Hidi { diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index b366d80bb..2d6694b23 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -1,6 +1,4 @@ -using Microsoft.OpenApi.Extensions; -using Microsoft.OpenApi.Hidi.Formatters; -using Microsoft.OpenApi.Services; +using Microsoft.OpenApi.Hidi.Formatters; using Xunit; namespace Microsoft.OpenApi.Hidi.Tests.Formatters diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index d5dc90653..483deaf25 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -4,9 +4,7 @@ using System.Globalization; using Microsoft.Extensions.Logging; using Microsoft.OpenApi.Reader; -using Microsoft.OpenApi.Services; using Microsoft.OpenApi.Tests.UtilityFiles; -using Microsoft.OpenApi.Writers; using Moq; using Xunit; diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index de1ef50d7..af65700c7 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -10,7 +10,6 @@ using Microsoft.OpenApi.Hidi.Options; using Microsoft.OpenApi.Hidi.Utilities; using Microsoft.OpenApi.OData; -using Microsoft.OpenApi.Services; using Xunit; namespace Microsoft.OpenApi.Hidi.Tests diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 5dd089512..ce518f69a 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. -using Microsoft.OpenApi.Extensions; - namespace Microsoft.OpenApi.Tests.UtilityFiles { /// From b9557d03aceef95ff1d408694cedd80a83757517 Mon Sep 17 00:00:00 2001 From: Maggiekimani1 Date: Tue, 3 Jun 2025 23:43:47 +0300 Subject: [PATCH 645/752] feat: upgrades OData lib to preview15 --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index ae01f0860..7a3fb9680 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index a0146af63..8787e7697 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -27,6 +27,7 @@ using Microsoft.OpenApi.Hidi.Formatters; using Microsoft.OpenApi.Hidi.Options; using Microsoft.OpenApi.Hidi.Utilities; +using Microsoft.OpenApi.OData; using Microsoft.OpenApi.Reader; using static Microsoft.OpenApi.Hidi.OpenApiSpecVersionHelper; @@ -414,8 +415,7 @@ private static async Task ParseOpenApiAsync(string openApiFile, bool var edmModel = CsdlReader.Parse(XElement.Parse(csdlText).CreateReader()); settings ??= SettingsUtilities.GetConfiguration(); - // TODO: uncomment when namespaces are fixed in OData lib - var document = new OpenApiDocument(); //edmModel.ConvertToOpenApi(SettingsUtilities.GetOpenApiConvertSettings(settings, metadataVersion)); + var document = edmModel.ConvertToOpenApi(SettingsUtilities.GetOpenApiConvertSettings(settings, metadataVersion)); document = FixReferences(document, format); return document; From 965be7d4467889fbcbce0e9d4d25795ad777da17 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Jun 2025 21:58:20 +0000 Subject: [PATCH 646/752] Bump BenchmarkDotNet and 14 others Bumps BenchmarkDotNet from 0.14.0 to 0.15.0 Bumps BenchmarkDotNet.Diagnostics.Windows from 0.14.0 to 0.15.0 Bumps Microsoft.Extensions.DependencyInjection from 9.0.4 to 9.0.5 Bumps Microsoft.Extensions.Logging to 9.0.5, 9.0.5 Bumps Microsoft.Extensions.Logging.Abstractions from 9.0.4 to 9.0.5 Bumps Microsoft.Extensions.Logging.Console to 9.0.5, 9.0.5 Bumps Microsoft.Extensions.Logging.Debug to 9.0.5, 9.0.5 Bumps Microsoft.NET.Test.Sdk to 17.14.1, 17.14.1 Bumps Microsoft.OpenApi.ApiManifest from 2.0.0-preview4 to 2.0.0-preview5 Bumps Microsoft.OpenApi.OData from 2.0.0-preview.15 to 2.0.0-preview9 Bumps Microsoft.VisualStudio.Threading.Analyzers to 17.13.61, 17.14.15, 17.14.15 Bumps Microsoft.Windows.Compatibility from 9.0.4 to 9.0.5 Bumps SharpYaml to 2.1.1, 2.1.2, 2.1.2, 2.1.2 Bumps System.Text.Json to 9.0.5, 9.0.5, 9.0.5, 9.0.5 Bumps Verify.Xunit from 30.0.0 to 30.3.1 --- updated-dependencies: - dependency-name: BenchmarkDotNet dependency-version: 0.15.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: BenchmarkDotNet.Diagnostics.Windows dependency-version: 0.15.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.Text.Json dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 17.14.1 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 17.14.1 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Microsoft.OpenApi.ApiManifest dependency-version: 2.0.0-preview5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.OpenApi.OData dependency-version: 2.0.0-preview9 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.VisualStudio.Threading.Analyzers dependency-version: 17.13.61 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.VisualStudio.Threading.Analyzers dependency-version: 17.14.15 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Microsoft.VisualStudio.Threading.Analyzers dependency-version: 17.14.15 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Microsoft.Windows.Compatibility dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: SharpYaml dependency-version: 2.1.1 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: SharpYaml dependency-version: 2.1.2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: SharpYaml dependency-version: 2.1.2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: SharpYaml dependency-version: 2.1.2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.Text.Json dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: System.Text.Json dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: System.Text.Json dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Verify.Xunit dependency-version: 30.3.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.csproj | 14 +++++++------- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7a3fb9680..7108f24e2 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -28,18 +28,18 @@ - - - - - + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index ec82664d2..97ffb9b87 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -12,7 +12,7 @@ - + From 9b14af4775e0b87f86103ed60c6fdcc7b462c70c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 4 Jun 2025 18:49:16 -0400 Subject: [PATCH 647/752] Update src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7108f24e2..ffe538d11 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,8 +38,8 @@ - - + + From 47e65fdc930ec2f2b60b09a17fe268dfcc9a93c2 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 4 Jun 2025 18:50:01 -0400 Subject: [PATCH 648/752] Update src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index ffe538d11..81a2aff98 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -39,7 +39,7 @@ - + From 084255dd9a4a3e227ad0d2f21a1af53c049fe813 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Jun 2025 21:35:42 +0000 Subject: [PATCH 649/752] Bump BenchmarkDotNet and 5 others Bumps BenchmarkDotNet from 0.15.0 to 0.15.1 Bumps BenchmarkDotNet.Diagnostics.Windows from 0.15.0 to 0.15.1 Bumps Microsoft.OpenApi.ApiManifest from 2.0.0-preview4 to 2.0.0-preview5 Bumps Microsoft.OpenApi.OData from 2.0.0-preview.15 to 2.0.0-preview9 Bumps System.Text.Json to 9.0.5, 9.0.5 Bumps xunit.runner.visualstudio to 3.1.1, 3.1.1 --- updated-dependencies: - dependency-name: BenchmarkDotNet dependency-version: 0.15.1 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: BenchmarkDotNet.Diagnostics.Windows dependency-version: 0.15.1 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.OpenApi.ApiManifest dependency-version: 2.0.0-preview5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.OpenApi.OData dependency-version: 2.0.0-preview9 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.Text.Json dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: System.Text.Json dependency-version: 9.0.5 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: xunit.runner.visualstudio dependency-version: 3.1.1 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: xunit.runner.visualstudio dependency-version: 3.1.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 81a2aff98..7108f24e2 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,8 +38,8 @@ - - + + diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 97ffb9b87..b06645c39 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From c4a7a005b03770eddc2c57ce45c69f163faab5ea Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 10 Jun 2025 08:42:25 -0400 Subject: [PATCH 650/752] chore: reverts yoko changes --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7108f24e2..81a2aff98 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,8 +38,8 @@ - - + + From 98522155b0240a8b638c16cb2701f33a34ee303c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Jun 2025 21:57:01 +0000 Subject: [PATCH 651/752] Bump Microsoft.Extensions.DependencyInjection and 8 others Bumps Microsoft.Extensions.DependencyInjection from 9.0.5 to 9.0.6 Bumps Microsoft.Extensions.Logging to 9.0.6 Bumps Microsoft.Extensions.Logging.Abstractions from 9.0.5 to 9.0.6 Bumps Microsoft.Extensions.Logging.Console to 9.0.6 Bumps Microsoft.Extensions.Logging.Debug to 9.0.6 Bumps Microsoft.OpenApi.ApiManifest from 2.0.0-preview4 to 2.0.0-preview5 Bumps Microsoft.OpenApi.OData from 2.0.0-preview.15 to 2.0.0-preview9 Bumps Microsoft.Windows.Compatibility from 9.0.5 to 9.0.6 Bumps System.Text.Json to 9.0.6 --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.Text.Json dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.OpenApi.ApiManifest dependency-version: 2.0.0-preview5 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.OpenApi.OData dependency-version: 2.0.0-preview9 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Windows.Compatibility dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.Text.Json dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: System.Text.Json dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: System.Text.Json dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.csproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 81a2aff98..c08852d38 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -28,18 +28,18 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - - + + From e7cbe825f3a846b375e0d0ad442b64e4c2c9882b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 11 Jun 2025 09:35:03 -0400 Subject: [PATCH 652/752] chore: reverts yoko upgrade --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c08852d38..cf8f30cb6 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From 665c50a8fdf509c2c33cea330d1694af6160ea7a Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 11 Jun 2025 09:35:32 -0400 Subject: [PATCH 653/752] chore: typo --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index cf8f30cb6..5049653fe 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From 41c895ad49255d44b993dbc5827efe5d06d01d11 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Jun 2025 21:47:22 +0000 Subject: [PATCH 654/752] Bump Microsoft.OpenApi.OData, System.Text.Json and Verify.Xunit Bumps Microsoft.OpenApi.OData from 2.0.0-preview.15 to 2.0.0-preview9 Bumps System.Text.Json to 9.0.6 Bumps Verify.Xunit from 30.3.1 to 30.4.0 --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-version: 2.0.0-preview9 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.Text.Json dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: System.Text.Json dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: Verify.Xunit dependency-version: 30.4.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 5049653fe..c08852d38 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From 6bd65fa271e98bd6063c3c9fce7effdb028a797d Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 16 Jun 2025 08:03:39 -0400 Subject: [PATCH 655/752] chore: reverts yoko upgrade --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c08852d38..5049653fe 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From baf279a64ecf9e5f666ef7d194edff65b0772835 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Jun 2025 22:18:56 +0000 Subject: [PATCH 656/752] Bump BenchmarkDotNet and 3 others Bumps BenchmarkDotNet from 0.15.1 to 0.15.2 Bumps BenchmarkDotNet.Diagnostics.Windows from 0.15.1 to 0.15.2 Bumps Microsoft.OpenApi.OData from 2.0.0-preview.15 to 2.0.0-preview9 Bumps System.Text.Json to 9.0.6 --- updated-dependencies: - dependency-name: BenchmarkDotNet dependency-version: 0.15.2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: BenchmarkDotNet.Diagnostics.Windows dependency-version: 0.15.2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.OpenApi.OData dependency-version: 2.0.0-preview9 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.Text.Json dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: System.Text.Json dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 5049653fe..c08852d38 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From 9ab58b66167ef0cc0ee9af5ca6fddd446a99ceac Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 17 Jun 2025 09:08:00 -0400 Subject: [PATCH 657/752] chore: reverts yoko upgrade --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c08852d38..5049653fe 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From 92d7234e6421f3d3dbed6214a364c1d36b9cfd11 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 19 Jun 2025 21:26:20 +0000 Subject: [PATCH 658/752] Bump Microsoft.OpenApi.OData and 3 others Bumps Microsoft.OpenApi.OData from 2.0.0-preview.15 to 2.0.0-preview9 Bumps System.CommandLine to 2.0.0-beta5.25306.1 Bumps System.CommandLine.Hosting from 0.4.0-alpha.22272.1 to 0.4.0-alpha.25306.1 Bumps System.Text.Json to 9.0.6 --- updated-dependencies: - dependency-name: Microsoft.OpenApi.OData dependency-version: 2.0.0-preview9 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.CommandLine dependency-version: 2.0.0-beta5.25306.1 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.CommandLine dependency-version: 2.0.0-beta5.25306.1 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.CommandLine.Hosting dependency-version: 0.4.0-alpha.25306.1 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.Text.Json dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: System.Text.Json dependency-version: 9.0.6 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 5049653fe..4a884926b 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -36,11 +36,11 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + - + - + From e30b7f6a2015afa0cb6ca132929ff9faae06387e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 20 Jun 2025 07:50:02 -0400 Subject: [PATCH 659/752] chore: reverts yoko upgrade --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 4a884926b..44692376c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From d7700cc70582190696975121ad17a7f3b028506b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 30 Jun 2025 09:14:55 -0400 Subject: [PATCH 660/752] fix: migration of hidi to the latest version of system.commandline Signed-off-by: Vincent Biret --- .../Extensions/CommandExtensions.cs | 2 +- .../Handlers/AsyncCommandHandler.cs | 14 -- .../Handlers/PluginCommandHandler.cs | 9 +- .../Handlers/ShowCommandHandler.cs | 9 +- .../Handlers/TransformCommandHandler.cs | 9 +- .../Handlers/ValidateCommandHandler.cs | 9 +- .../Options/CommandOptions.cs | 139 +++++++++++------- .../Options/HidiOptions.cs | 38 ++--- src/Microsoft.OpenApi.Hidi/Program.cs | 15 +- .../Services/OpenApiServiceTests.cs | 15 +- 10 files changed, 139 insertions(+), 120 deletions(-) delete mode 100644 src/Microsoft.OpenApi.Hidi/Handlers/AsyncCommandHandler.cs diff --git a/src/Microsoft.OpenApi.Hidi/Extensions/CommandExtensions.cs b/src/Microsoft.OpenApi.Hidi/Extensions/CommandExtensions.cs index 5b83212d5..1a2dc477d 100644 --- a/src/Microsoft.OpenApi.Hidi/Extensions/CommandExtensions.cs +++ b/src/Microsoft.OpenApi.Hidi/Extensions/CommandExtensions.cs @@ -12,7 +12,7 @@ public static void AddOptions(this Command command, IReadOnlyList - - + + From 4c3b64275fa751649cb2267b0cfbbbb9d949d01a Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 1 Jul 2025 08:26:40 -0400 Subject: [PATCH 662/752] chore: reverts Yoko upgrade --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index aa4889756..263f743b8 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From d16a907ddf55b7be3d6cd74c8649c78af38b4349 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 2 Jul 2025 12:53:15 -0400 Subject: [PATCH 663/752] fix: upgrades openapi.odata to avoid hidi failing to load --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 263f743b8..657ac9431 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From 9f11d27de4300bc1657a739447de0fa85c20bf54 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 2 Jul 2025 19:27:27 -0400 Subject: [PATCH 664/752] fix: bumps openapi.net.odata to fix two critical bugs in hidi --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 657ac9431..00d354b79 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ - + From ffe73ce273c92840b53047d805b9b9ccde5c1785 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 8 Jul 2025 21:29:36 +0000 Subject: [PATCH 665/752] Bump Microsoft.Extensions.DependencyInjection and 6 others Bumps Microsoft.Extensions.DependencyInjection from 9.0.6 to 9.0.7 Bumps Microsoft.Extensions.Logging to 9.0.7 Bumps Microsoft.Extensions.Logging.Abstractions from 9.0.6 to 9.0.7 Bumps Microsoft.Extensions.Logging.Console to 9.0.7 Bumps Microsoft.Extensions.Logging.Debug to 9.0.7 Bumps Microsoft.Windows.Compatibility from 9.0.6 to 9.0.7 Bumps System.Text.Json from 9.0.6 to 9.0.7 --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.Text.Json dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Windows.Compatibility dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 00d354b79..9cec2ceab 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -28,10 +28,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From 4c33a02e6615535da1e4b8b1afafd0f1b94140e9 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 10 Jul 2025 08:14:29 -0400 Subject: [PATCH 666/752] fix: removes public mermaid types that were not usuable Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 1 + src/Microsoft.OpenApi.Hidi/Properties/AssemblyInfo.cs | 1 + .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 ++ 3 files changed, 4 insertions(+) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 9cec2ceab..623418883 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -16,6 +16,7 @@ $(NoWarn);NU5048;NU5104;CA1848; readme.md All + ..\Microsoft.OpenApi.snk diff --git a/src/Microsoft.OpenApi.Hidi/Properties/AssemblyInfo.cs b/src/Microsoft.OpenApi.Hidi/Properties/AssemblyInfo.cs index e5a59206e..a3ee32f7c 100644 --- a/src/Microsoft.OpenApi.Hidi/Properties/AssemblyInfo.cs +++ b/src/Microsoft.OpenApi.Hidi/Properties/AssemblyInfo.cs @@ -2,3 +2,4 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] +[assembly: InternalsVisibleTo("Microsoft.OpenApi.Hidi.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100957cb48387b2a5f54f5ce39255f18f26d32a39990db27cf48737afc6bc62759ba996b8a2bfb675d4e39f3d06ecb55a178b1b4031dcb2a767e29977d88cce864a0d16bfc1b3bebb0edf9fe285f10fffc0a85f93d664fa05af07faa3aad2e545182dbf787e3fd32b56aca95df1a3c4e75dec164a3f1a4c653d971b01ffc39eb3c4")] diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index b06645c39..f9b2b41bf 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -8,6 +8,8 @@ false All CA2007 + true + ..\..\src\Microsoft.OpenApi.snk From 15b16d34a47cb28849e3f7b6f4ab40e0c712d043 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 10 Jul 2025 08:41:32 -0400 Subject: [PATCH 667/752] chore: fixes internals visible to declaration Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 5 ++++- src/Microsoft.OpenApi.Hidi/Properties/AssemblyInfo.cs | 5 ----- 2 files changed, 4 insertions(+), 6 deletions(-) delete mode 100644 src/Microsoft.OpenApi.Hidi/Properties/AssemblyInfo.cs diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 623418883..921c39e70 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -52,7 +52,10 @@ - <_Parameter1>Microsoft.OpenApi.Hidi.Tests + <_Parameter1>Microsoft.OpenApi.Hidi.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100957cb48387b2a5f54f5ce39255f18f26d32a39990db27cf48737afc6bc62759ba996b8a2bfb675d4e39f3d06ecb55a178b1b4031dcb2a767e29977d88cce864a0d16bfc1b3bebb0edf9fe285f10fffc0a85f93d664fa05af07faa3aad2e545182dbf787e3fd32b56aca95df1a3c4e75dec164a3f1a4c653d971b01ffc39eb3c4 + + + <_Parameter1>DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7 diff --git a/src/Microsoft.OpenApi.Hidi/Properties/AssemblyInfo.cs b/src/Microsoft.OpenApi.Hidi/Properties/AssemblyInfo.cs deleted file mode 100644 index a3ee32f7c..000000000 --- a/src/Microsoft.OpenApi.Hidi/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,5 +0,0 @@ - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] -[assembly: InternalsVisibleTo("Microsoft.OpenApi.Hidi.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100957cb48387b2a5f54f5ce39255f18f26d32a39990db27cf48737afc6bc62759ba996b8a2bfb675d4e39f3d06ecb55a178b1b4031dcb2a767e29977d88cce864a0d16bfc1b3bebb0edf9fe285f10fffc0a85f93d664fa05af07faa3aad2e545182dbf787e3fd32b56aca95df1a3c4e75dec164a3f1a4c653d971b01ffc39eb3c4")] From d2bccae99d8ae3466b5b7d1ee3cfd1b5b6751e94 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 10 Jul 2025 21:17:38 +0000 Subject: [PATCH 668/752] Bump Microsoft.OData.Edm and System.Text.Json Bumps Microsoft.OData.Edm from 8.2.4 to 8.3.0 Bumps System.Text.Json to 9.0.7 --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-version: 8.3.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: System.Text.Json dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: System.Text.Json dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 921c39e70..a43f5d211 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ all - + From 2c343081e7eebcc60fe3fd0a0de6c55d8fe85f5e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 15 Jul 2025 01:22:03 +0000 Subject: [PATCH 669/752] Bump System.Text.Json and xunit.runner.visualstudio Bumps System.Text.Json to 9.0.7 Bumps xunit.runner.visualstudio to 3.1.2 --- updated-dependencies: - dependency-name: System.Text.Json dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: System.Text.Json dependency-version: 9.0.7 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: xunit.runner.visualstudio dependency-version: 3.1.2 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: xunit.runner.visualstudio dependency-version: 3.1.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index f9b2b41bf..f92449438 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -17,7 +17,7 @@ - + From f3b006a346d4d95e7772329fc8d311e525fe9a66 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 15 Aug 2025 09:30:49 -0400 Subject: [PATCH 670/752] chore: updates extensions dependencies --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index a43f5d211..308dff927 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From d419cfc3259c8b784a4a9abf522d31a0ac26fa5f Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 15 Aug 2025 09:40:36 -0400 Subject: [PATCH 671/752] chore: updates STJ chore: updates xunit --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index f92449438..b5f2eac57 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -17,7 +17,7 @@ - + From 9f078b05cbad89f320594ac723468f1302757e8c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 15 Aug 2025 09:41:58 -0400 Subject: [PATCH 672/752] chore: updates yoko dependency to latest --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 308dff927..7d7b1ee74 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -39,7 +39,7 @@ - + From a799f139c3f90b3cc8a26831b979780e41abcdf7 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 15 Aug 2025 10:31:00 -0400 Subject: [PATCH 673/752] ci: fixes flaky test Signed-off-by: Vincent Biret --- .../Services/OpenApiServiceTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 05345aaf8..6342f6703 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -166,7 +166,7 @@ public Task ThrowIfOpenApiUrlIsNotProvidedWhenValidatingAsync() public Task ThrowIfURLIsNotResolvableWhenValidatingAsync() { return Assert.ThrowsAsync(() => - OpenApiService.ValidateOpenApiDocumentAsync("https://example.org/itdoesnmatter", _logger)); + OpenApiService.ValidateOpenApiDocumentAsync("https://example.org926F4F21-88E7-4DC5-BF88-6C529BB77844/itdoesnmatter", _logger)); } [Fact] From aa92cf2cb44cdce6b96fd2753021aba93a104c6a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 10 Sep 2025 12:10:39 +0000 Subject: [PATCH 674/752] Bump Microsoft.Extensions.Logging.Abstractions from 9.0.8 to 9.0.9 --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 9.0.9 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7d7b1ee74..b41102cb2 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -30,7 +30,7 @@ - + From fda1dbf165af967489722e05b5cdbe3c676a950e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 10 Sep 2025 08:16:05 -0400 Subject: [PATCH 675/752] chore: updates logging dependencies --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b41102cb2..bcb83b96c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all From c133135af8e998cb15d68fa291ce128adeaa03f3 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 10 Sep 2025 08:17:02 -0400 Subject: [PATCH 676/752] chore: updates edm dep --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index bcb83b96c..72a6485ea 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ all - + From caea8a18d3a24f1c83dc9323335510422e1f575f Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 10 Sep 2025 08:18:19 -0400 Subject: [PATCH 677/752] chore: updates xunit deps --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index b5f2eac57..20f6516a7 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -17,7 +17,7 @@ - + From dbf2769b71ee93646ce73ae7d76b5edf6a512450 Mon Sep 17 00:00:00 2001 From: Peter Bons Date: Fri, 19 Sep 2025 14:23:24 +0200 Subject: [PATCH 678/752] Merge pull request #2509 from Expecho/patch-1 docs: fix wrong version specification in hidi examples in readme.md --- src/Microsoft.OpenApi.Hidi/readme.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md index 7a7667e02..38efe66ae 100644 --- a/src/Microsoft.OpenApi.Hidi/readme.md +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -95,19 +95,19 @@ This command accepts the following parameters: 1. Filtering by OperationIds ```bash -hidi transform -d files\People.yml -f yaml -o files\People.yml -v OpenApi3_0 --op users_UpdateInsights --co +hidi transform -d files\People.yml -f yaml -o files\People.yml -v 3.0 --op users_UpdateInsights --co ``` 2. Filtering by Postman collection ```bash -hidi transform --openapi files\People.yml --format yaml --output files\People2.yml --version OpenApi3_0 --filter-by-collection Graph-Collection-0017059134807617005.postman_collection.json +hidi transform --openapi files\People.yml --format yaml --output files\People2.yml --version 3.0 --filter-by-collection Graph-Collection-0017059134807617005.postman_collection.json ``` 3. CSDL--->OpenAPI conversion and filtering ```bash -hidi transform --csdl Files/Todo.xml --output Files/Todo-subset.yml --format yaml --version OpenApi3_0 --filter-by-operationids Todos.Todo.UpdateTodo +hidi transform --csdl Files/Todo.xml --output Files/Todo-subset.yml --format yaml --version 3.0 --filter-by-operationids Todos.Todo.UpdateTodo ``` 4. CSDL Filtering by EntitySets and Singletons @@ -138,4 +138,5 @@ This command generates an OpenAI style Plugin manifest and minimal OpenAPI file hidi plugin -m exampleApiManifest.yml -o mypluginfolder ``` -> Run `hidi plugin -h` to see all the available usage options. \ No newline at end of file + +> Run `hidi plugin -h` to see all the available usage options. From 015cbf82aa64922c3dfd416ff2dc4c4b65a3b8c6 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 23 Sep 2025 21:47:39 -0400 Subject: [PATCH 679/752] feat: adds parsing infrastructure for version 3.2 Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 8787e7697..d63d559f0 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -69,7 +69,7 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog // Default to yaml and OpenApiVersion 3_1 during csdl to OpenApi conversion var openApiFormat = options.OpenApiFormat ?? (!string.IsNullOrEmpty(options.OpenApi) ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiConstants.Yaml); - var openApiVersion = options.Version != null ? TryParseOpenApiSpecVersion(options.Version) : OpenApiSpecVersion.OpenApi3_1; + var openApiVersion = options.Version != null ? TryParseOpenApiSpecVersion(options.Version) : OpenApiSpecVersion.OpenApi3_2; // If ApiManifest is provided, set the referenced OpenAPI document var apiDependency = await FindApiDependencyAsync(options.FilterOptions.FilterByApiManifest, logger, cancellationToken).ConfigureAwait(false); diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs b/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs index 222f7a8c6..b8bff3195 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiSpecVersionHelper.cs @@ -35,8 +35,12 @@ public static OpenApiSpecVersion TryParseOpenApiSpecVersion(string value) { return OpenApiSpecVersion.OpenApi3_1; } + else if (majorVersion == 3 && minorVersion == 2) + { + return OpenApiSpecVersion.OpenApi3_2; + } - return OpenApiSpecVersion.OpenApi3_1; // default + return OpenApiSpecVersion.OpenApi3_2; // default } } } From 468f21cf8e7b3c0d01f96c953476248dae5767ca Mon Sep 17 00:00:00 2001 From: kilifu Date: Tue, 23 Sep 2025 23:00:02 -0400 Subject: [PATCH 680/752] Update default OpenApiVersion to 3_2 --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index d63d559f0..d6ec132d8 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -67,7 +67,7 @@ public static async Task TransformOpenApiDocumentAsync(HidiOptions options, ILog throw new IOException($"The file {options.Output} already exists. Please input a new file path."); } - // Default to yaml and OpenApiVersion 3_1 during csdl to OpenApi conversion + // Default to yaml and OpenApiVersion 3_2 during csdl to OpenApi conversion var openApiFormat = options.OpenApiFormat ?? (!string.IsNullOrEmpty(options.OpenApi) ? GetOpenApiFormat(options.OpenApi, logger) : OpenApiConstants.Yaml); var openApiVersion = options.Version != null ? TryParseOpenApiSpecVersion(options.Version) : OpenApiSpecVersion.OpenApi3_2; From 62fe8171f186a2dc5dd049df63750ca9f9a36082 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Oct 2025 21:05:15 +0000 Subject: [PATCH 681/752] Bump Microsoft.NET.Test.Sdk from 17.14.1 to 18.0.0 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.0.0 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 20f6516a7..33656177d 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 2e2dea9d7af9014c7335bc7fbc3468af8e4014e5 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 2 Oct 2025 21:08:49 -0400 Subject: [PATCH 682/752] feat: make response request body, header and parameter content referenceable Signed-off-by: Vincent Biret --- .../Formatters/PowerShellFormatterTests.cs | 2 +- .../UtilityFiles/OpenApiDocumentMock.cs | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs index 2fa6a86d4..6b601a2f5 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Formatters/PowerShellFormatterTests.cs @@ -120,7 +120,7 @@ private static OpenApiDocument GetSampleOpenApiDocument() { Name = "ids", In = ParameterLocation.Query, - Content = new Dictionary() + Content = new Dictionary() { { "application/json", diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index da3821c56..4654b43b6 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -92,7 +92,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new Dictionary() + Content = new Dictionary() { { applicationJsonMediaType, @@ -153,7 +153,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new Dictionary() + Content = new Dictionary() { { applicationJsonMediaType, @@ -201,7 +201,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved entities", - Content = new Dictionary() + Content = new Dictionary() { { applicationJsonMediaType, @@ -247,7 +247,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved entity", - Content = new Dictionary() + Content = new Dictionary() { { applicationJsonMediaType, @@ -310,7 +310,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved navigation property", - Content = new Dictionary() + Content = new Dictionary() { { applicationJsonMediaType, @@ -357,7 +357,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new Dictionary() + Content = new Dictionary() { { applicationJsonMediaType, @@ -414,7 +414,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Retrieved navigation property", - Content = new Dictionary() + Content = new Dictionary() { { applicationJsonMediaType, @@ -545,7 +545,7 @@ public static OpenApiDocument CreateOpenApiDocument() "200", new OpenApiResponse() { Description = "Success", - Content = new Dictionary() + Content = new Dictionary() { { applicationJsonMediaType, @@ -679,8 +679,8 @@ public static OpenApiDocument CreateOpenApiDocument() document.Paths[eventsDeltaPath].Operations![HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("groups.Functions", document)}; document.Paths[refPath].Operations![HttpMethod.Get].Tags = new HashSet {new OpenApiTagReference("applications.directoryObject", document)}; ((OpenApiSchema)document.Paths[usersPath].Operations![HttpMethod.Get].Responses!["200"].Content![applicationJsonMediaType].Schema!.Properties!["value"]).Items = new OpenApiSchemaReference("microsoft.graph.user", document); - document.Paths[usersByIdPath].Operations![HttpMethod.Get].Responses!["200"].Content![applicationJsonMediaType].Schema = new OpenApiSchemaReference("microsoft.graph.user", document); - document.Paths[messagesByIdPath].Operations![HttpMethod.Get].Responses!["200"].Content![applicationJsonMediaType].Schema = new OpenApiSchemaReference("microsoft.graph.message", document); + ((OpenApiMediaType)document.Paths[usersByIdPath].Operations![HttpMethod.Get].Responses!["200"].Content![applicationJsonMediaType]).Schema = new OpenApiSchemaReference("microsoft.graph.user", document); + ((OpenApiMediaType)document.Paths[messagesByIdPath].Operations![HttpMethod.Get].Responses!["200"].Content![applicationJsonMediaType]).Schema = new OpenApiSchemaReference("microsoft.graph.message", document); ((OpenApiSchema)document.Paths[securityProfilesPath].Operations![HttpMethod.Get].Responses!["200"].Content![applicationJsonMediaType].Schema!.Properties!["value"]).Items = new OpenApiSchemaReference("microsoft.graph.networkInterface", document); ((OpenApiSchema)document.Paths[eventsDeltaPath].Operations![HttpMethod.Get].Responses!["200"].Content![applicationJsonMediaType].Schema!.Properties!["value"]).Items = new OpenApiSchemaReference("microsoft.graph.event", document); return document; From 77a67475c939915f0fd888c65da5cb0fa6721c47 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 14 Oct 2025 10:00:39 -0400 Subject: [PATCH 683/752] fix: use settings for terse output in serialization extension methods Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 8787e7697..797ec2359 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -192,16 +192,17 @@ private static async Task WriteOpenApiAsync(HidiOptions options, string openApiF using var outputStream = options.Output.Create(); using var textWriter = new StreamWriter(outputStream); - var settings = new OpenApiWriterSettings + var settings = new OpenApiJsonWriterSettings { InlineLocalReferences = options.InlineLocal, - InlineExternalReferences = options.InlineExternal + InlineExternalReferences = options.InlineExternal, + Terse = options.TerseOutput }; #pragma warning disable CA1308 IOpenApiWriter writer = openApiFormat.ToLowerInvariant() switch #pragma warning restore CA1308 { - OpenApiConstants.Json => options.TerseOutput ? new(textWriter, settings, options.TerseOutput) : new OpenApiJsonWriter(textWriter, settings, false), + OpenApiConstants.Json => new OpenApiJsonWriter(textWriter, settings), OpenApiConstants.Yaml => new OpenApiYamlWriter(textWriter, settings), _ => throw new ArgumentException("Unknown format"), }; From 18a94b520ca8f08dceb32833a4d588dce13b95e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Oct 2025 21:04:57 +0000 Subject: [PATCH 684/752] Bump Microsoft.Extensions.Logging.Abstractions from 9.0.9 to 9.0.10 --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 9.0.10 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 72a6485ea..580e41889 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -30,7 +30,7 @@ - + From 9f1428c7e4a0739d0cef14f3705c9bf061ba2fc0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:05:15 +0000 Subject: [PATCH 685/752] Bump Microsoft.Extensions.Logging and Microsoft.Extensions.Logging.Debug Bumps Microsoft.Extensions.Logging from 9.0.9 to 9.0.10 Bumps Microsoft.Extensions.Logging.Debug from 9.0.9 to 9.0.10 --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging dependency-version: 9.0.10 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 9.0.10 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging dependency-version: 9.0.10 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 9.0.10 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 580e41889..b06b7927c 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 8049b199fd0532ffaa2ed341bbca9d2a006a2b8a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Oct 2025 21:25:37 +0000 Subject: [PATCH 686/752] Bump Microsoft.Extensions.Logging.Console and System.Text.Json Bumps Microsoft.Extensions.Logging.Console from 9.0.9 to 9.0.10 Bumps System.Text.Json from 9.0.9 to 9.0.10 --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 9.0.10 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: System.Text.Json dependency-version: 9.0.10 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 9.0.10 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b06b7927c..7e61230e4 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -31,7 +31,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive From 7736a38e30f85fcd51dbd340354af85e2e8037db Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 15 Oct 2025 18:54:48 -0400 Subject: [PATCH 687/752] chore: updates xunit deps --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 33656177d..5b5b5fedf 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -17,7 +17,7 @@ - + From 493dcf66e86166e7de2d9d400296c7c514e57615 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 23 Oct 2025 21:04:05 +0000 Subject: [PATCH 688/752] Bump Microsoft.OData.Edm from 8.4.0 to 8.4.2 --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-version: 8.4.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7e61230e4..465e23082 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ all - + From 070d20242b1532b96c17fd22f3825b0d75c9e4ea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Nov 2025 21:05:10 +0000 Subject: [PATCH 689/752] Bump Microsoft.Extensions.Logging.Abstractions from 9.0.10 to 10.0.0 --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 10.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 465e23082..c7456e9f1 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -30,7 +30,7 @@ - + From 5ed891909331b38a5faff2c4c796febc45635474 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Nov 2025 21:09:08 +0000 Subject: [PATCH 690/752] Bump Microsoft.NET.Test.Sdk from 18.0.0 to 18.0.1 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.0.1 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.0.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 5b5b5fedf..b7153019d 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 81912afb07ec6c77edc2d6a39548864ec35d7035 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Nov 2025 21:06:31 +0000 Subject: [PATCH 691/752] Bump Microsoft.Extensions.Logging and Microsoft.Extensions.Logging.Debug Bumps Microsoft.Extensions.Logging from 9.0.10 to 10.0.0 Bumps Microsoft.Extensions.Logging.Debug from 9.0.10 to 10.0.0 --- updated-dependencies: - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.0 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index c7456e9f1..73b681f2b 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - + - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 5bc60609127d1390d569be8171d7fba254d6e137 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 13 Nov 2025 10:31:51 -0500 Subject: [PATCH 692/752] chore: upgrades microsoft extensions deps --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 73b681f2b..a069c77b2 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -31,7 +31,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive From 82699ce2270bb09b0909680a1bd8a2f647b77629 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 13 Nov 2025 10:35:55 -0500 Subject: [PATCH 693/752] chore: upgrades openapi deps for alignment --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 73b681f2b..81d0f03af 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -39,8 +39,8 @@ - - + + From d005710c97a401751d1c95c78710814339e63b62 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 13 Nov 2025 10:39:17 -0500 Subject: [PATCH 694/752] chore: upgrades commandline deps to stable version --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 73b681f2b..fe7e6b8f0 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -37,7 +37,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + From 844709d4af82dece3ea3260142b228fa9a3cede7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Nov 2025 21:05:24 +0000 Subject: [PATCH 695/752] Bump Microsoft.OData.Edm from 8.4.2 to 8.4.3 --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-version: 8.4.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index a7cb5111f..b6afc5950 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ all - + From 8acb040bd84f5ac94e210ca3ae088e65942051d8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 21:05:34 +0000 Subject: [PATCH 696/752] Bump the microsoftextensions group with 6 updates Bumps Microsoft.Extensions.DependencyInjection from 10.0.0 to 10.0.1 Bumps Microsoft.Extensions.Logging from 10.0.0 to 10.0.1 Bumps Microsoft.Extensions.Logging.Abstractions from 10.0.0 to 10.0.1 Bumps Microsoft.Extensions.Logging.Console from 10.0.0 to 10.0.1 Bumps Microsoft.Extensions.Logging.Debug from 10.0.0 to 10.0.1 Bumps System.Text.Json from 10.0.0 to 10.0.1 --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: System.Text.Json dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b6afc5950..458972ef0 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From ce3581f6bf1c434dfb4b3cb6444f74b7b28f2924 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 13 Jan 2026 21:25:54 +0000 Subject: [PATCH 697/752] Bump the microsoftextensions group with 6 updates Bumps Microsoft.Extensions.DependencyInjection from 10.0.1 to 10.0.2 Bumps Microsoft.Extensions.Logging from 10.0.1 to 10.0.2 Bumps Microsoft.Extensions.Logging.Abstractions from 10.0.1 to 10.0.2 Bumps Microsoft.Extensions.Logging.Console from 10.0.1 to 10.0.2 Bumps Microsoft.Extensions.Logging.Debug from 10.0.1 to 10.0.2 Bumps System.Text.Json from 10.0.1 to 10.0.2 --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 10.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 10.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: System.Text.Json dependency-version: 10.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 458972ef0..2e955f3a6 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From 0b2c8c02d2020d0d2111587e09bac8b50e6f7375 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 19 Jan 2026 13:13:05 -0500 Subject: [PATCH 698/752] feat: hidi validate command now logs warnings Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 48f1d1c3e..a494b4f2e 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -398,6 +398,7 @@ private static async Task ParseOpenApiAsync(string openApiFile, bool logger.LogTrace("{Timestamp}ms: Completed parsing.", stopwatch.ElapsedMilliseconds); LogErrors(logger, result); + LogWarnings(logger, result); stopwatch.Stop(); } @@ -652,7 +653,7 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl private static void LogErrors(ILogger logger, ReadResult result) { var context = result.Diagnostic; - if (context is not null && context.Errors.Count != 0) + if (context is { Errors.Count: > 0 }) { using (logger.BeginScope("Detected errors")) { @@ -664,6 +665,21 @@ private static void LogErrors(ILogger logger, ReadResult result) } } + private static void LogWarnings(ILogger logger, ReadResult result) + { + var context = result.Diagnostic; + if (context is { Warnings.Count: > 0 }) + { + using (logger.BeginScope("Detected warnings")) + { + foreach (var warning in context.Warnings) + { + logger.LogWarning("Detected warning during parsing: {Warning}", warning.ToString()); + } + } + } + } + internal static void WriteTreeDocumentAsMarkdown(string openapiUrl, OpenApiDocument document, StreamWriter writer) { var rootNode = OpenApiUrlTreeNode.Create(document, "main"); From aba21cef5356e45df26226967c99738d532b1468 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 19 Jan 2026 13:13:05 -0500 Subject: [PATCH 699/752] feat: hidi validate command now logs warnings Signed-off-by: Vincent Biret --- src/Microsoft.OpenApi.Hidi/OpenApiService.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs index 797ec2359..b35cc2cbb 100644 --- a/src/Microsoft.OpenApi.Hidi/OpenApiService.cs +++ b/src/Microsoft.OpenApi.Hidi/OpenApiService.cs @@ -398,6 +398,7 @@ private static async Task ParseOpenApiAsync(string openApiFile, bool logger.LogTrace("{Timestamp}ms: Completed parsing.", stopwatch.ElapsedMilliseconds); LogErrors(logger, result); + LogWarnings(logger, result); stopwatch.Stop(); } @@ -652,7 +653,7 @@ private static string GetInputPathExtension(string? openapi = null, string? csdl private static void LogErrors(ILogger logger, ReadResult result) { var context = result.Diagnostic; - if (context is not null && context.Errors.Count != 0) + if (context is { Errors.Count: > 0 }) { using (logger.BeginScope("Detected errors")) { @@ -664,6 +665,21 @@ private static void LogErrors(ILogger logger, ReadResult result) } } + private static void LogWarnings(ILogger logger, ReadResult result) + { + var context = result.Diagnostic; + if (context is { Warnings.Count: > 0 }) + { + using (logger.BeginScope("Detected warnings")) + { + foreach (var warning in context.Warnings) + { + logger.LogWarning("Detected warning during parsing: {Warning}", warning.ToString()); + } + } + } + } + internal static void WriteTreeDocumentAsMarkdown(string openapiUrl, OpenApiDocument document, StreamWriter writer) { var rootNode = OpenApiUrlTreeNode.Create(document, "main"); From 28e067b51478dc7d67bd5fbed41ee303f342d094 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 29 Jan 2026 13:26:07 -0500 Subject: [PATCH 700/752] docs: adds container information for hidi --- src/Microsoft.OpenApi.Hidi/readme.md | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md index 38efe66ae..95aba5f10 100644 --- a/src/Microsoft.OpenApi.Hidi/readme.md +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -14,7 +14,7 @@ Hidi has these key capabilities that enable you to build different scenarios off ## Installation Install [Microsoft.OpenApi.Hidi](https://www.nuget.org/packages/Microsoft.OpenApi.Hidi/1.0.0-preview4) package from NuGet by running the following command: - + ### .NET CLI(Global) ```bash @@ -23,12 +23,18 @@ dotnet tool install --global Microsoft.OpenApi.Hidi --prerelease ### .NET CLI(local) -```bash +```bash dotnet new tool-manifest #if you are setting up the OpenAPI.NET repo dotnet tool install --local Microsoft.OpenApi.Hidi --prerelease ``` - - + +### Docker + +Hidi is also available as a Docker image: + +```bash +docker pull mcr.microsoft.com/openapi/hidi +``` ## How to use Hidi From d57fb0bf116dd92d0299317437c6ef3e8789b5b8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Feb 2026 21:27:02 +0000 Subject: [PATCH 701/752] Bump the microsoftextensions group with 6 updates Bumps Microsoft.Extensions.DependencyInjection from 10.0.2 to 10.0.3 Bumps Microsoft.Extensions.Logging from 10.0.2 to 10.0.3 Bumps Microsoft.Extensions.Logging.Abstractions from 10.0.2 to 10.0.3 Bumps Microsoft.Extensions.Logging.Console from 10.0.2 to 10.0.3 Bumps Microsoft.Extensions.Logging.Debug from 10.0.2 to 10.0.3 Bumps System.Text.Json from 10.0.2 to 10.0.3 --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 10.0.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 10.0.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: System.Text.Json dependency-version: 10.0.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 2e955f3a6..475f4ce67 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From f88e5af664b43e6fbaf11b50067d8245fe13947a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Feb 2026 21:26:53 +0000 Subject: [PATCH 702/752] Bump coverlet.msbuild from 6.0.4 to 8.0.0 --- updated-dependencies: - dependency-name: coverlet.msbuild dependency-version: 8.0.0 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: coverlet.msbuild dependency-version: 8.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index b7153019d..a238b2556 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -13,7 +13,7 @@ - + From 50c3e3d08d0d60d9827e2d5dad7b8d6f9b3ba936 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Feb 2026 21:27:52 +0000 Subject: [PATCH 703/752] Bump Microsoft.NET.Test.Sdk from 18.0.1 to 18.3.0 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.3.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.3.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index a238b2556..0e9bad64c 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 822f7141db52dc05cb8b824ad174f2596e9dfc55 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Mar 2026 21:26:27 +0000 Subject: [PATCH 704/752] Bump the microsoftextensions group with 6 updates Bumps Microsoft.Extensions.DependencyInjection from 10.0.3 to 10.0.4 Bumps Microsoft.Extensions.Logging from 10.0.3 to 10.0.4 Bumps Microsoft.Extensions.Logging.Abstractions from 10.0.3 to 10.0.4 Bumps Microsoft.Extensions.Logging.Console from 10.0.3 to 10.0.4 Bumps Microsoft.Extensions.Logging.Debug from 10.0.3 to 10.0.4 Bumps System.Text.Json from 10.0.3 to 10.0.4 --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 10.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 10.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: System.Text.Json dependency-version: 10.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 475f4ce67..00ed9dcac 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From 1dd5d3fca6bcdb3f6bf9d64a91570e49e66e41f2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 12 Mar 2026 21:26:33 +0000 Subject: [PATCH 705/752] Bump the microsoftextensions group with 6 updates Bumps Microsoft.Extensions.DependencyInjection from 10.0.4 to 10.0.5 Bumps Microsoft.Extensions.Logging from 10.0.4 to 10.0.5 Bumps Microsoft.Extensions.Logging.Abstractions from 10.0.4 to 10.0.5 Bumps Microsoft.Extensions.Logging.Console from 10.0.4 to 10.0.5 Bumps Microsoft.Extensions.Logging.Debug from 10.0.4 to 10.0.5 Bumps System.Text.Json from 10.0.4 to 10.0.5 --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 10.0.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 10.0.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: System.Text.Json dependency-version: 10.0.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 00ed9dcac..7e3db37d3 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From 9895e3fc5bd2f0ff538a09580f1217827e9b4caa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Mar 2026 14:52:10 +0000 Subject: [PATCH 706/752] Bump Humanizer.Core from 2.14.1 to 3.0.10 --- updated-dependencies: - dependency-name: Humanizer.Core dependency-version: 3.0.10 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7e3db37d3..b7a86dc4f 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -28,7 +28,7 @@ - + From 4993a6eb067d748f4a70270f97f58819f4091f47 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Mar 2026 15:41:59 +0000 Subject: [PATCH 707/752] Bump the coverlet group with 2 updates Bumps coverlet.collector from 6.0.4 to 8.0.1 Bumps coverlet.msbuild from 8.0.0 to 8.0.1 --- updated-dependencies: - dependency-name: coverlet.collector dependency-version: 8.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: coverlet - dependency-name: coverlet.collector dependency-version: 8.0.1 dependency-type: direct:production update-type: version-update:semver-major dependency-group: coverlet - dependency-name: coverlet.msbuild dependency-version: 8.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: coverlet - dependency-name: coverlet.msbuild dependency-version: 8.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: coverlet ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 0e9bad64c..b2cb4de59 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -13,12 +13,12 @@ - + - + From 80effeb43a2a96deb98f42c563dd2a9889751154 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 20 Mar 2026 12:38:06 -0400 Subject: [PATCH 708/752] chore: upgrades system.commandline dependency --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 7e3db37d3..56a98870b 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -37,7 +37,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + From 760644344e1183d1772d6b0dbb389a209803705b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 20 Mar 2026 12:39:12 -0400 Subject: [PATCH 709/752] chore: upgrades yoko --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 56a98870b..3352b5a21 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -39,7 +39,7 @@ - + From e3ec4659f20fd1a48a4dc692ff4629abed0f3e33 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Mar 2026 16:53:10 +0000 Subject: [PATCH 710/752] Initial plan From 94dac6bf53517bc492a9bc31af0d7d8ffca803cb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 20 Mar 2026 17:23:37 +0000 Subject: [PATCH 711/752] fix(hidi): remove Humanizer.Inflections namespace for Humanizer 3.x compatibility Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> --- src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs index bb4bc58d9..6d2282b32 100644 --- a/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs +++ b/src/Microsoft.OpenApi.Hidi/Formatters/PowerShellFormatter.cs @@ -5,7 +5,6 @@ using System.Text; using System.Text.RegularExpressions; using Humanizer; -using Humanizer.Inflections; using Microsoft.OpenApi.Hidi.Extensions; namespace Microsoft.OpenApi.Hidi.Formatters From 57ada087ac7192d400917f3ee0aeefd4d6948f3a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 7 Apr 2026 21:26:34 +0000 Subject: [PATCH 712/752] Bump Microsoft.NET.Test.Sdk from 18.3.0 to 18.4.0 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.4.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.4.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index b2cb4de59..76afffd97 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 00da2b34075647dd826c05132dbb522e642b1458 Mon Sep 17 00:00:00 2001 From: "Gavin Barron (from Dev Box)" Date: Tue, 14 Apr 2026 09:24:54 -0700 Subject: [PATCH 713/752] fix(hidi): update Microsoft.OpenApi.OData to 3.2.1 Fixes CSDL to OpenAPI conversion issue with binding functions to multiple types in an inheritance tree. Closes #2811 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index d28fb038a..d856e9487 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -39,7 +39,7 @@ - + From c64e073b2fa45e3c0a85489375a05076069f6dbd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 15 Apr 2026 11:36:19 +0000 Subject: [PATCH 714/752] Bump the microsoftextensions group with 6 updates Bumps Microsoft.Extensions.DependencyInjection from 10.0.5 to 10.0.6 Bumps Microsoft.Extensions.Logging from 10.0.5 to 10.0.6 Bumps Microsoft.Extensions.Logging.Abstractions from 10.0.5 to 10.0.6 Bumps Microsoft.Extensions.Logging.Console from 10.0.5 to 10.0.6 Bumps Microsoft.Extensions.Logging.Debug from 10.0.5 to 10.0.6 Bumps System.Text.Json from 10.0.5 to 10.0.6 --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 10.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 10.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: System.Text.Json dependency-version: 10.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index d856e9487..d125c2ec1 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From 0f36500be5f132ab541c0ba3afde14bf40c6590b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 16 Apr 2026 09:53:27 -0400 Subject: [PATCH 715/752] ci: upgrades repository to net10 --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- .../UtilityFiles/OpenApiDocumentMock.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 76afffd97..46a20d205 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 enable enable diff --git a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs index 4654b43b6..535b43a80 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/OpenApiDocumentMock.cs @@ -6,7 +6,7 @@ namespace Microsoft.OpenApi.Tests.UtilityFiles /// /// Mock class that creates a sample OpenAPI document. /// - public static class OpenApiDocumentMock + internal static class OpenApiDocumentMock { /// /// Creates an OpenAPI document. From e08b73910395a8e452381840c6ee68fadf057a68 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 17 Apr 2026 21:27:36 +0000 Subject: [PATCH 716/752] Bump the coverlet group with 2 updates Bumps coverlet.collector from 8.0.1 to 10.0.0 Bumps coverlet.msbuild from 8.0.1 to 10.0.0 --- updated-dependencies: - dependency-name: coverlet.collector dependency-version: 10.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: coverlet - dependency-name: coverlet.collector dependency-version: 10.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: coverlet - dependency-name: coverlet.msbuild dependency-version: 10.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: coverlet - dependency-name: coverlet.msbuild dependency-version: 10.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: coverlet ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 46a20d205..2ff261d63 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -13,12 +13,12 @@ - + - + From 2d16efc1ce0796901dee5898167d19af5c72ab0a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Apr 2026 21:26:48 +0000 Subject: [PATCH 717/752] Bump the microsoftextensions group with 6 updates Bumps Microsoft.Extensions.DependencyInjection from 10.0.6 to 10.0.7 Bumps Microsoft.Extensions.Logging from 10.0.6 to 10.0.7 Bumps Microsoft.Extensions.Logging.Abstractions from 10.0.6 to 10.0.7 Bumps Microsoft.Extensions.Logging.Console from 10.0.6 to 10.0.7 Bumps Microsoft.Extensions.Logging.Debug from 10.0.6 to 10.0.7 Bumps System.Text.Json from 10.0.6 to 10.0.7 --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 10.0.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 10.0.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: System.Text.Json dependency-version: 10.0.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index d125c2ec1..eb6a089b6 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From 78eadfdbee554d90f8823a2c815a4e961a06409e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Apr 2026 21:30:11 +0000 Subject: [PATCH 718/752] Bump Microsoft.NET.Test.Sdk from 18.4.0 to 18.5.1 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.5.1 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.5.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 2ff261d63..84f3e3ddd 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From a13c4a6a4b27df609ae051d63cd7106a1feeb106 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 13 May 2026 09:31:50 +0000 Subject: [PATCH 719/752] Bump Microsoft.Extensions.DependencyInjection and 5 others Bumps Microsoft.Extensions.DependencyInjection from 10.0.7 to 10.0.8 Bumps Microsoft.Extensions.Logging from 10.0.7 to 10.0.8 Bumps Microsoft.Extensions.Logging.Abstractions from 10.0.7 to 10.0.8 Bumps Microsoft.Extensions.Logging.Console from 10.0.7 to 10.0.8 Bumps Microsoft.Extensions.Logging.Debug from 10.0.7 to 10.0.8 Bumps System.Text.Json from 10.0.7 to 10.0.8 --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 10.0.8 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.8 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.8 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 10.0.8 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.8 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.8 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.8 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.8 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: System.Text.Json dependency-version: 10.0.8 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index eb6a089b6..6642b9fb3 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From 37abbb357f58c2cba15fb5ef725440897b97834a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 May 2026 06:27:52 +0000 Subject: [PATCH 720/752] Bump the coverlet group with 2 updates Bumps coverlet.collector from 10.0.0 to 10.0.1 Bumps coverlet.msbuild from 10.0.0 to 10.0.1 --- updated-dependencies: - dependency-name: coverlet.collector dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: coverlet - dependency-name: coverlet.collector dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: coverlet - dependency-name: coverlet.msbuild dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: coverlet - dependency-name: coverlet.msbuild dependency-version: 10.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: coverlet ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 84f3e3ddd..d0766cb56 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -13,12 +13,12 @@ - + - + From 1a4bf337bbf4902f74c491ccd3ea8bbfd3ee45ec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 27 May 2026 01:29:37 +0000 Subject: [PATCH 721/752] Bump Microsoft.NET.Test.Sdk from 18.5.1 to 18.6.0 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.6.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.6.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index d0766cb56..8e30f7f56 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 838e5ad8e396d2b6c3bad70bf498dee25505a4f8 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 1 Jun 2026 10:19:16 -0400 Subject: [PATCH 722/752] test(coverage): add reader and walker edge tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../OpenApiSpecVersionHelperTests.cs | 31 +++++ .../Services/OpenApiFilterServiceTests.cs | 66 +++++++++++ .../StatsVisitorTests.cs | 110 ++++++++++++++++++ .../Utilities/SettingsUtilitiesTests.cs | 44 +++++++ 4 files changed, 251 insertions(+) create mode 100644 test/Microsoft.OpenApi.Hidi.Tests/OpenApiSpecVersionHelperTests.cs create mode 100644 test/Microsoft.OpenApi.Hidi.Tests/StatsVisitorTests.cs create mode 100644 test/Microsoft.OpenApi.Hidi.Tests/Utilities/SettingsUtilitiesTests.cs diff --git a/test/Microsoft.OpenApi.Hidi.Tests/OpenApiSpecVersionHelperTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/OpenApiSpecVersionHelperTests.cs new file mode 100644 index 000000000..da7da8e7a --- /dev/null +++ b/test/Microsoft.OpenApi.Hidi.Tests/OpenApiSpecVersionHelperTests.cs @@ -0,0 +1,31 @@ +#nullable enable +using System; +using Microsoft.OpenApi.Hidi; +using Xunit; + +namespace Microsoft.OpenApi.Hidi.Tests; + +public class OpenApiSpecVersionHelperTests +{ + [Theory] + [InlineData("2.0", OpenApiSpecVersion.OpenApi2_0)] + [InlineData("3.0", OpenApiSpecVersion.OpenApi3_0)] + [InlineData("3.1", OpenApiSpecVersion.OpenApi3_1)] + [InlineData("3.2", OpenApiSpecVersion.OpenApi3_2)] + [InlineData("4.0", OpenApiSpecVersion.OpenApi3_2)] + public void TryParseOpenApiSpecVersionReturnsExpectedVersion(string version, OpenApiSpecVersion expectedVersion) + { + var result = OpenApiSpecVersionHelper.TryParseOpenApiSpecVersion(version); + + Assert.Equal(expectedVersion, result); + } + + [Theory] + [InlineData(null)] + [InlineData("")] + [InlineData("abc")] + public void TryParseOpenApiSpecVersionThrowsForInvalidValues(string? version) + { + Assert.Throws(() => OpenApiSpecVersionHelper.TryParseOpenApiSpecVersion(version!)); + } +} diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 483deaf25..8f8aa0c8e 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -221,6 +221,72 @@ public void ThrowsInvalidOperationExceptionInCreatePredicateWhenInvalidArguments Assert.Equal("Cannot specify both operationIds and tags at the same time.", message2); } + [Fact] + public void ThrowsInvalidOperationExceptionWhenRequestUrlsAreCombinedWithOtherFilters() + { + var requestUrls = new Dictionary> + { + ["/users"] = ["GET"] + }; + + var message = Assert.Throws(() => + OpenApiFilterService.CreatePredicate("users.user.ListUser", null, requestUrls, _openApiDocumentMock)).Message; + + Assert.Equal("Cannot filter by Postman collection and either operationIds and tags at the same time.", message); + } + + [Fact] + public void ThrowsWhenPredicateDoesNotMatchAnyPath() + { + var source = new OpenApiDocument + { + Info = new() { Title = "Test", Version = "1.0" }, + Paths = new() + { + ["/test"] = new OpenApiPathItem + { + Operations = new() + { + [HttpMethod.Get] = new OpenApiOperation { OperationId = "getTest" } + } + } + } + }; + + var subset = OpenApiFilterService.CreateFilteredDocument(source, static (_, _, _) => false); + + Assert.Empty(subset.Paths); + } + + [Fact] + public void CreatePredicateMatchesAbsoluteUrlsWhenSourceHasNoServers() + { + var source = new OpenApiDocument + { + Info = new() { Title = "Test", Version = "v1" }, + Paths = new() + { + ["/users"] = new OpenApiPathItem + { + Operations = new() + { + [HttpMethod.Get] = new OpenApiOperation { OperationId = "listUsers" } + } + } + } + }; + var requestUrls = new Dictionary> + { + ["https://graph.contoso.com/users"] = ["GET"] + }; + + var predicate = OpenApiFilterService.CreatePredicate(requestUrls: requestUrls, source: source); + var subset = OpenApiFilterService.CreateFilteredDocument(source, predicate); + + Assert.Single(subset.Paths); + Assert.True(subset.Paths.ContainsKey("/users")); + } + [Fact] public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly() { diff --git a/test/Microsoft.OpenApi.Hidi.Tests/StatsVisitorTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/StatsVisitorTests.cs new file mode 100644 index 000000000..763540269 --- /dev/null +++ b/test/Microsoft.OpenApi.Hidi.Tests/StatsVisitorTests.cs @@ -0,0 +1,110 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using Xunit; + +namespace Microsoft.OpenApi.Hidi.Tests; + +public class StatsVisitorTests +{ + [Fact] + public void GetStatisticsReportReflectsVisitedElements() + { + var document = new OpenApiDocument + { + Paths = new() + { + ["/pets"] = new OpenApiPathItem + { + Operations = new() + { + [HttpMethod.Post] = new OpenApiOperation + { + Parameters = + [ + new OpenApiParameter + { + Name = "expand", + In = ParameterLocation.Query, + Schema = new OpenApiSchema { Type = JsonSchemaType.String } + } + ], + RequestBody = new OpenApiRequestBody + { + Content = new Dictionary + { + ["application/json"] = new OpenApiMediaType + { + Schema = new OpenApiSchema + { + Type = JsonSchemaType.Object, + Properties = new Dictionary + { + ["name"] = new OpenApiSchema { Type = JsonSchemaType.String } + } + } + } + } + }, + Responses = new OpenApiResponses + { + ["200"] = new OpenApiResponse + { + Headers = new Dictionary + { + ["x-rate-limit"] = new OpenApiHeader + { + Schema = new OpenApiSchema { Type = JsonSchemaType.Integer } + } + }, + Links = new Dictionary + { + ["next"] = new OpenApiLink() + } + } + }, + Callbacks = new Dictionary + { + ["onData"] = new OpenApiCallback + { + PathItems = new Dictionary + { + [RuntimeExpression.Build("$request.body#/callbackUrl")] = new OpenApiPathItem + { + Operations = new() + { + [HttpMethod.Post] = new OpenApiOperation + { + Responses = new OpenApiResponses + { + ["202"] = new OpenApiResponse { Description = "Accepted" } + } + } + } + } + } + } + } + } + } + } + } + }; + + var visitor = new StatsVisitor(); + new OpenApiWalker(visitor).Walk(document); + var report = visitor.GetStatisticsReport(); + + Assert.Equal(2, visitor.PathItemCount); + Assert.Equal(2, visitor.OperationCount); + Assert.Equal(1, visitor.ParameterCount); + Assert.Equal(1, visitor.RequestBodyCount); + Assert.Equal(2, visitor.ResponseCount); + Assert.Equal(1, visitor.LinkCount); + Assert.Equal(1, visitor.CallbackCount); + Assert.Equal(4, visitor.SchemaCount); + Assert.Contains("Path Items: 2", report, StringComparison.Ordinal); + Assert.Contains("Callbacks: 1", report, StringComparison.Ordinal); + Assert.Contains("Schemas: 4", report, StringComparison.Ordinal); + } +} diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Utilities/SettingsUtilitiesTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Utilities/SettingsUtilitiesTests.cs new file mode 100644 index 000000000..aa31367ae --- /dev/null +++ b/test/Microsoft.OpenApi.Hidi.Tests/Utilities/SettingsUtilitiesTests.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using Microsoft.Extensions.Configuration; +using Microsoft.OpenApi.Hidi.Utilities; +using Microsoft.OpenApi.OData; +using Xunit; + +namespace Microsoft.OpenApi.Hidi.Tests; + +public class SettingsUtilitiesTests +{ + [Fact] + public void GetOpenApiConvertSettingsThrowsWhenConfigurationIsNull() + { + Assert.Throws(() => SettingsUtilities.GetOpenApiConvertSettings(null!, null)); + } + + [Fact] + public void GetOpenApiConvertSettingsUsesMetadataVersionWhenSectionIsMissing() + { + var configuration = new ConfigurationBuilder().AddInMemoryCollection(new Dictionary()).Build(); + + var settings = SettingsUtilities.GetOpenApiConvertSettings(configuration, "2.1"); + + Assert.Equal("2.1", settings.SemVerVersion); + } + + [Fact] + public void GetOpenApiConvertSettingsBindsConfiguredValuesOverMetadataVersion() + { + var configuration = new ConfigurationBuilder() + .AddInMemoryCollection(new Dictionary + { + [$"{nameof(OpenApiConvertSettings)}:{nameof(OpenApiConvertSettings.SemVerVersion)}"] = "3.0", + [$"{nameof(OpenApiConvertSettings)}:{nameof(OpenApiConvertSettings.EnablePagination)}"] = bool.TrueString + }) + .Build(); + + var settings = SettingsUtilities.GetOpenApiConvertSettings(configuration, "2.1"); + + Assert.Equal("3.0", settings.SemVerVersion); + Assert.True(settings.EnablePagination); + } +} From 2c12306cfab2c12b968120d9c04788dc123a3a19 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Jun 2026 21:28:12 +0000 Subject: [PATCH 723/752] Bump the microsoftextensions group with 6 updates Bumps Microsoft.Extensions.DependencyInjection from 10.0.8 to 10.0.9 Bumps Microsoft.Extensions.Logging from 10.0.8 to 10.0.9 Bumps Microsoft.Extensions.Logging.Abstractions from 10.0.8 to 10.0.9 Bumps Microsoft.Extensions.Logging.Console from 10.0.8 to 10.0.9 Bumps Microsoft.Extensions.Logging.Debug from 10.0.8 to 10.0.9 Bumps System.Text.Json from 10.0.8 to 10.0.9 --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 10.0.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 10.0.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: System.Text.Json dependency-version: 10.0.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 6642b9fb3..4c659736d 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From 1befe6c3db3e45ddc5502416e281f2f037870a2d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Jun 2026 21:27:51 +0000 Subject: [PATCH 724/752] Bump Microsoft.NET.Test.Sdk from 18.6.0 to 18.7.0 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.7.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.7.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 8e30f7f56..5b4e651e5 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 44a3bf1fd3c454caa21801103ffe7331723d9da8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Jun 2026 21:27:12 +0000 Subject: [PATCH 725/752] Bump Microsoft.VisualStudio.Threading.Analyzers from 17.14.15 to 18.7.23 --- updated-dependencies: - dependency-name: Microsoft.VisualStudio.Threading.Analyzers dependency-version: 18.7.23 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 4c659736d..f060053b3 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -33,7 +33,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all From 8d2acb864bb51caedab848c89be2a610eb331913 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 17:22:55 +0000 Subject: [PATCH 726/752] Bump Microsoft.NET.Test.Sdk from 18.7.0 to 18.8.1 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.8.1 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.8.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 5b4e651e5..3becd1bd7 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 2da9e8c4ce6b0bf60302a5015d3a15fe23177f04 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 17:23:17 +0000 Subject: [PATCH 727/752] Bump Microsoft.OData.Edm from 8.4.3 to 8.4.4 --- updated-dependencies: - dependency-name: Microsoft.OData.Edm dependency-version: 8.4.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index f060053b3..4d8bc9fa3 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -38,7 +38,7 @@ all - + From 7c12812a17ba3821e51e732ac27fff6e415f3c03 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 21:27:31 +0000 Subject: [PATCH 728/752] Bump the microsoftextensions group with 6 updates Bumps Microsoft.Extensions.DependencyInjection from 10.0.9 to 10.0.10 Bumps Microsoft.Extensions.Logging from 10.0.9 to 10.0.10 Bumps Microsoft.Extensions.Logging.Abstractions from 10.0.9 to 10.0.10 Bumps Microsoft.Extensions.Logging.Console from 10.0.9 to 10.0.10 Bumps Microsoft.Extensions.Logging.Debug from 10.0.9 to 10.0.10 Bumps System.Text.Json from 10.0.9 to 10.0.10 --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 10.0.10 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.10 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.10 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 10.0.10 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.10 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: System.Text.Json dependency-version: 10.0.10 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.10 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.10 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.10 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions ... Signed-off-by: dependabot[bot] --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 4d8bc9fa3..b6034c5e0 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From d62e0f9a8fa7a2900d6d4e5e2422e5d0b5e5ff29 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 11 Aug 2026 09:14:46 -0400 Subject: [PATCH 729/752] chore: upgrades dependencies not picked up by dependabot --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index b6034c5e0..371fb339b 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -37,7 +37,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + From 85d61ff8a3771b62d67fadbd506e833fe55b4344 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 11 Aug 2026 13:34:40 -0400 Subject: [PATCH 730/752] tests: upgrades to xunit v3 Signed-off-by: Vincent Biret --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- .../Services/OpenApiFilterServiceTests.cs | 4 +- .../Services/OpenApiServiceTests.cs | 48 +++++++++---------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 3becd1bd7..9d98d4ab3 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -16,7 +16,7 @@ - + diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 8f8aa0c8e..2dc91151c 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -298,7 +298,7 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly( using var stream = File.OpenRead(filePath); var settings = new OpenApiReaderSettings(); settings.AddYamlReader(); - var doc = (await OpenApiDocument.LoadAsync(stream, "yaml", settings)).Document; + var doc = (await OpenApiDocument.LoadAsync(stream, "yaml", settings, TestContext.Current.CancellationToken)).Document; // validated the tags are read as references var openApiOperationTags = doc?.Paths["/items"].Operations?[HttpMethod.Get].Tags?.ToArray(); @@ -344,7 +344,7 @@ public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly( } }; subsetOpenApiDocument.SerializeAsV3(writer); - await writer.FlushAsync(); + await writer.FlushAsync(TestContext.Current.CancellationToken); var result = outputStringWriter.ToString(); Assert.NotEmpty(result); } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index 6342f6703..f4c1ef97c 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -138,9 +138,9 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagramAsync Output = new("sample.md") }; - await OpenApiService.ShowOpenApiDocumentAsync(options, _logger); + await OpenApiService.ShowOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken); - var output = await File.ReadAllTextAsync(options.Output.FullName); + var output = await File.ReadAllTextAsync(options.Output.FullName, TestContext.Current.CancellationToken); Assert.Contains("graph LR", output, StringComparison.Ordinal); } @@ -151,7 +151,7 @@ public async Task ShowCommandGeneratesMermaidHtmlFileWithMermaidDiagramAsync() { OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml") }; - var filePath = await OpenApiService.ShowOpenApiDocumentAsync(options, _logger); + var filePath = await OpenApiService.ShowOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken); Assert.True(File.Exists(filePath)); } @@ -159,28 +159,28 @@ public async Task ShowCommandGeneratesMermaidHtmlFileWithMermaidDiagramAsync() public Task ThrowIfOpenApiUrlIsNotProvidedWhenValidatingAsync() { return Assert.ThrowsAsync(() => - OpenApiService.ValidateOpenApiDocumentAsync("", _logger)); + OpenApiService.ValidateOpenApiDocumentAsync("", _logger, TestContext.Current.CancellationToken)); } [Fact] public Task ThrowIfURLIsNotResolvableWhenValidatingAsync() { return Assert.ThrowsAsync(() => - OpenApiService.ValidateOpenApiDocumentAsync("https://example.org926F4F21-88E7-4DC5-BF88-6C529BB77844/itdoesnmatter", _logger)); + OpenApiService.ValidateOpenApiDocumentAsync("https://example.org926F4F21-88E7-4DC5-BF88-6C529BB77844/itdoesnmatter", _logger, TestContext.Current.CancellationToken)); } [Fact] public Task ThrowIfFileDoesNotExistWhenValidatingAsync() { return Assert.ThrowsAsync(() => - OpenApiService.ValidateOpenApiDocumentAsync("aFileThatBetterNotExist.fake", _logger)); + OpenApiService.ValidateOpenApiDocumentAsync("aFileThatBetterNotExist.fake", _logger, TestContext.Current.CancellationToken)); } [Fact] public async Task ValidateCommandProcessesOpenApiAsync() { // create a dummy ILogger instance for testing - await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger); + await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger, TestContext.Current.CancellationToken); Assert.True(true); } @@ -188,7 +188,7 @@ public async Task ValidateCommandProcessesOpenApiAsync() [Fact] public async Task ValidFileReturnsTrueAsync() { - var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger); + var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger, TestContext.Current.CancellationToken); Assert.True(isValid); } @@ -196,7 +196,7 @@ public async Task ValidFileReturnsTrueAsync() [Fact] public async Task InvalidFileReturnsFalseAsync() { - var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "InvalidSampleOpenApi.yml"), _logger); + var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "InvalidSampleOpenApi.yml"), _logger, TestContext.Current.CancellationToken); Assert.False(isValid); } @@ -224,9 +224,9 @@ public async Task TransformCommandConvertsOpenApiAsync() InlineExternal = false, }; // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocumentAsync(options, _logger); + await OpenApiService.TransformOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken); - var output = await File.ReadAllTextAsync("sample.json"); + var output = await File.ReadAllTextAsync("sample.json", TestContext.Current.CancellationToken); Assert.NotEmpty(output); } @@ -243,9 +243,9 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAsync() InlineExternal = false, }; // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocumentAsync(options, _logger); + await OpenApiService.TransformOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken); - var output = await File.ReadAllTextAsync("output.yml"); + var output = await File.ReadAllTextAsync("output.yml", TestContext.Current.CancellationToken); Assert.NotEmpty(output); } @@ -263,9 +263,9 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchF InlineExternal = false, }; // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocumentAsync(options, _logger); + await OpenApiService.TransformOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken); - var output = await File.ReadAllTextAsync("output.yml"); + var output = await File.ReadAllTextAsync("output.yml", TestContext.Current.CancellationToken); Assert.NotEmpty(output); } @@ -280,7 +280,7 @@ public Task ThrowTransformCommandIfOpenApiAndCsdlAreEmptyAsync() InlineExternal = false, }; return Assert.ThrowsAsync(() => - OpenApiService.TransformOpenApiDocumentAsync(options, _logger)); + OpenApiService.TransformOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken)); } [Fact] @@ -299,9 +299,9 @@ public async Task TransformToPowerShellCompliantOpenApiAsync() SettingsConfig = SettingsUtilities.GetConfiguration(settingsPath) }; // create a dummy ILogger instance for testing - await OpenApiService.TransformOpenApiDocumentAsync(options, _logger); + await OpenApiService.TransformOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken); - var output = await File.ReadAllTextAsync("output.yaml"); + var output = await File.ReadAllTextAsync("output.yaml", TestContext.Current.CancellationToken); Assert.NotEmpty(output); } @@ -314,9 +314,9 @@ public async Task InvokeTransformCommandAsync() var parseResult = rootCommand.Parse(args); var handler = Assert.IsType(rootCommand.Subcommands.First(c => c.Name == "transform").Action, exactMatch: false); - await handler.InvokeAsync(parseResult); + await handler.InvokeAsync(parseResult, TestContext.Current.CancellationToken); - var output = await File.ReadAllTextAsync("sample.json"); + var output = await File.ReadAllTextAsync("sample.json", TestContext.Current.CancellationToken); Assert.NotEmpty(output); } @@ -330,9 +330,9 @@ public async Task InvokeShowCommandAsync() var parseResult = rootCommand.Parse(args); var handler = Assert.IsType(rootCommand.Subcommands.First(c => c.Name == "show").Action, exactMatch: false); - await handler.InvokeAsync(parseResult); + await handler.InvokeAsync(parseResult, TestContext.Current.CancellationToken); - var output = await File.ReadAllTextAsync("sample.md"); + var output = await File.ReadAllTextAsync("sample.md", TestContext.Current.CancellationToken); Assert.Contains("graph LR", output, StringComparison.Ordinal); } @@ -345,9 +345,9 @@ public async Task InvokePluginCommandAsync() var parseResult = rootCommand.Parse(args); var handler = Assert.IsType(rootCommand.Subcommands.First(c => c.Name == "plugin").Action, exactMatch: false); - await handler.InvokeAsync(parseResult); + await handler.InvokeAsync(parseResult, TestContext.Current.CancellationToken); - using var jsDoc = JsonDocument.Parse(await File.ReadAllTextAsync("ai-plugin.json")); + using var jsDoc = JsonDocument.Parse(await File.ReadAllTextAsync("ai-plugin.json", TestContext.Current.CancellationToken)); var openAiManifest = OpenAIPluginManifest.Load(jsDoc.RootElement); Assert.NotNull(openAiManifest); From 583e3577a5d21b04a0a741c1af234d0af90cdb58 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 11 Aug 2026 13:49:57 -0400 Subject: [PATCH 731/752] tests: use unique file names to avoid race conditions Signed-off-by: Vincent Biret --- .../Services/OpenApiServiceTests.cs | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index f4c1ef97c..be9c203a5 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -135,7 +135,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagramAsync var options = new HidiOptions { OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), - Output = new("sample.md") + Output = new($"{nameof(ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagramAsync)}.md") }; await OpenApiService.ShowOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken); @@ -217,7 +217,7 @@ public async Task TransformCommandConvertsOpenApiAsync() var options = new HidiOptions { OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), - Output = new("sample.json"), + Output = new($"{nameof(TransformCommandConvertsOpenApiAsync)}.json"), CleanOutput = true, TerseOutput = false, InlineLocal = false, @@ -226,7 +226,7 @@ public async Task TransformCommandConvertsOpenApiAsync() // create a dummy ILogger instance for testing await OpenApiService.TransformOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken); - var output = await File.ReadAllTextAsync("sample.json", TestContext.Current.CancellationToken); + var output = await File.ReadAllTextAsync(options.Output.FullName, TestContext.Current.CancellationToken); Assert.NotEmpty(output); } @@ -241,11 +241,12 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAsync() TerseOutput = false, InlineLocal = false, InlineExternal = false, + Output = new FileInfo($"{nameof(TransformCommandConvertsOpenApiWithDefaultOutputNameAsync)}.yml") }; // create a dummy ILogger instance for testing await OpenApiService.TransformOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken); - var output = await File.ReadAllTextAsync("output.yml", TestContext.Current.CancellationToken); + var output = await File.ReadAllTextAsync(options.Output.FullName, TestContext.Current.CancellationToken); Assert.NotEmpty(output); } @@ -255,6 +256,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchF var options = new HidiOptions { OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), + Output = new($"{nameof(TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchFormatAsync)}.yml"), CleanOutput = true, Version = "3.0", OpenApiFormat = OpenApiConstants.Yaml, @@ -265,7 +267,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchF // create a dummy ILogger instance for testing await OpenApiService.TransformOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken); - var output = await File.ReadAllTextAsync("output.yml", TestContext.Current.CancellationToken); + var output = await File.ReadAllTextAsync(options.Output.FullName, TestContext.Current.CancellationToken); Assert.NotEmpty(output); } @@ -290,6 +292,7 @@ public async Task TransformToPowerShellCompliantOpenApiAsync() var options = new HidiOptions { OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), + Output = new($"{nameof(TransformToPowerShellCompliantOpenApiAsync)}.yaml"), CleanOutput = true, Version = "3.0", OpenApiFormat = OpenApiConstants.Yaml, @@ -301,7 +304,7 @@ public async Task TransformToPowerShellCompliantOpenApiAsync() // create a dummy ILogger instance for testing await OpenApiService.TransformOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken); - var output = await File.ReadAllTextAsync("output.yaml", TestContext.Current.CancellationToken); + var output = await File.ReadAllTextAsync(options.Output.FullName, TestContext.Current.CancellationToken); Assert.NotEmpty(output); } @@ -310,13 +313,14 @@ public async Task InvokeTransformCommandAsync() { var rootCommand = Program.CreateRootCommand(); var openapi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); - var args = new[] { "transform", "-d", openapi, "-o", "sample.json", "--co" }; + var outputPath = $"{nameof(InvokeTransformCommandAsync)}.json"; + var args = new[] { "transform", "-d", openapi, "-o", outputPath, "--co" }; var parseResult = rootCommand.Parse(args); var handler = Assert.IsType(rootCommand.Subcommands.First(c => c.Name == "transform").Action, exactMatch: false); await handler.InvokeAsync(parseResult, TestContext.Current.CancellationToken); - var output = await File.ReadAllTextAsync("sample.json", TestContext.Current.CancellationToken); + var output = await File.ReadAllTextAsync(outputPath, TestContext.Current.CancellationToken); Assert.NotEmpty(output); } @@ -326,13 +330,14 @@ public async Task InvokeShowCommandAsync() { var rootCommand = Program.CreateRootCommand(); var openApi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); - var args = new[] { "show", "-d", openApi, "-o", "sample.md" }; + var outputPath = $"{nameof(InvokeShowCommandAsync)}.md"; + var args = new[] { "show", "-d", openApi, "-o", outputPath }; var parseResult = rootCommand.Parse(args); var handler = Assert.IsType(rootCommand.Subcommands.First(c => c.Name == "show").Action, exactMatch: false); await handler.InvokeAsync(parseResult, TestContext.Current.CancellationToken); - var output = await File.ReadAllTextAsync("sample.md", TestContext.Current.CancellationToken); + var output = await File.ReadAllTextAsync(outputPath, TestContext.Current.CancellationToken); Assert.Contains("graph LR", output, StringComparison.Ordinal); } @@ -341,13 +346,14 @@ public async Task InvokePluginCommandAsync() { var rootCommand = Program.CreateRootCommand(); var manifest = Path.Combine(".", "UtilityFiles", "exampleapimanifest.json"); - var args = new[] { "plugin", "-m", manifest, "--of", AppDomain.CurrentDomain.BaseDirectory }; + var outputPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, nameof(InvokePluginCommandAsync)); + var args = new[] { "plugin", "-m", manifest, "--of", outputPath }; var parseResult = rootCommand.Parse(args); var handler = Assert.IsType(rootCommand.Subcommands.First(c => c.Name == "plugin").Action, exactMatch: false); await handler.InvokeAsync(parseResult, TestContext.Current.CancellationToken); - using var jsDoc = JsonDocument.Parse(await File.ReadAllTextAsync("ai-plugin.json", TestContext.Current.CancellationToken)); + using var jsDoc = JsonDocument.Parse(await File.ReadAllTextAsync(Path.Combine(outputPath, "ai-plugin.json"), TestContext.Current.CancellationToken)); var openAiManifest = OpenAIPluginManifest.Load(jsDoc.RootElement); Assert.NotNull(openAiManifest); From c9553c658d2b18ab8016dd1e2369ab91d982ccb2 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 11 Aug 2026 13:55:15 -0400 Subject: [PATCH 732/752] linting: use path join instead of combine Signed-off-by: Vincent Biret --- .../Services/OpenApiServiceTests.cs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index be9c203a5..981a00558 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -134,7 +134,7 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagramAsync // create a dummy ILogger instance for testing var options = new HidiOptions { - OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), + OpenApi = Path.Join("UtilityFiles", "SampleOpenApi.yml"), Output = new($"{nameof(ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagramAsync)}.md") }; @@ -149,7 +149,7 @@ public async Task ShowCommandGeneratesMermaidHtmlFileWithMermaidDiagramAsync() { var options = new HidiOptions { - OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml") + OpenApi = Path.Join("UtilityFiles", "SampleOpenApi.yml") }; var filePath = await OpenApiService.ShowOpenApiDocumentAsync(options, _logger, TestContext.Current.CancellationToken); Assert.True(File.Exists(filePath)); @@ -180,7 +180,7 @@ public Task ThrowIfFileDoesNotExistWhenValidatingAsync() public async Task ValidateCommandProcessesOpenApiAsync() { // create a dummy ILogger instance for testing - await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger, TestContext.Current.CancellationToken); + await OpenApiService.ValidateOpenApiDocumentAsync(Path.Join("UtilityFiles", "SampleOpenApi.yml"), _logger, TestContext.Current.CancellationToken); Assert.True(true); } @@ -188,7 +188,7 @@ public async Task ValidateCommandProcessesOpenApiAsync() [Fact] public async Task ValidFileReturnsTrueAsync() { - var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger, TestContext.Current.CancellationToken); + var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Join("UtilityFiles", "SampleOpenApi.yml"), _logger, TestContext.Current.CancellationToken); Assert.True(isValid); } @@ -196,7 +196,7 @@ public async Task ValidFileReturnsTrueAsync() [Fact] public async Task InvalidFileReturnsFalseAsync() { - var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "InvalidSampleOpenApi.yml"), _logger, TestContext.Current.CancellationToken); + var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Join("UtilityFiles", "InvalidSampleOpenApi.yml"), _logger, TestContext.Current.CancellationToken); Assert.False(isValid); } @@ -206,7 +206,7 @@ public async Task CancellingValidationReturnsNullAsync() { using var cts = new CancellationTokenSource(); await cts.CancelAsync(); - var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Combine("UtilityFiles", "SampleOpenApi.yml"), _logger, cts.Token); + var isValid = await OpenApiService.ValidateOpenApiDocumentAsync(Path.Join("UtilityFiles", "SampleOpenApi.yml"), _logger, cts.Token); Assert.Null(isValid); } @@ -216,7 +216,7 @@ public async Task TransformCommandConvertsOpenApiAsync() { var options = new HidiOptions { - OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), + OpenApi = Path.Join("UtilityFiles", "SampleOpenApi.yml"), Output = new($"{nameof(TransformCommandConvertsOpenApiAsync)}.json"), CleanOutput = true, TerseOutput = false, @@ -236,7 +236,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAsync() { var options = new HidiOptions { - OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), + OpenApi = Path.Join("UtilityFiles", "SampleOpenApi.yml"), CleanOutput = true, TerseOutput = false, InlineLocal = false, @@ -255,7 +255,7 @@ public async Task TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchF { var options = new HidiOptions { - OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), + OpenApi = Path.Join("UtilityFiles", "SampleOpenApi.yml"), Output = new($"{nameof(TransformCommandConvertsOpenApiWithDefaultOutputNameAndSwitchFormatAsync)}.yml"), CleanOutput = true, Version = "3.0", @@ -288,10 +288,10 @@ public Task ThrowTransformCommandIfOpenApiAndCsdlAreEmptyAsync() [Fact] public async Task TransformToPowerShellCompliantOpenApiAsync() { - var settingsPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "examplepowershellsettings.json"); + var settingsPath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "examplepowershellsettings.json"); var options = new HidiOptions { - OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml"), + OpenApi = Path.Join("UtilityFiles", "SampleOpenApi.yml"), Output = new($"{nameof(TransformToPowerShellCompliantOpenApiAsync)}.yaml"), CleanOutput = true, Version = "3.0", @@ -312,7 +312,7 @@ public async Task TransformToPowerShellCompliantOpenApiAsync() public async Task InvokeTransformCommandAsync() { var rootCommand = Program.CreateRootCommand(); - var openapi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); + var openapi = Path.Join(".", "UtilityFiles", "SampleOpenApi.yml"); var outputPath = $"{nameof(InvokeTransformCommandAsync)}.json"; var args = new[] { "transform", "-d", openapi, "-o", outputPath, "--co" }; var parseResult = rootCommand.Parse(args); @@ -329,7 +329,7 @@ public async Task InvokeTransformCommandAsync() public async Task InvokeShowCommandAsync() { var rootCommand = Program.CreateRootCommand(); - var openApi = Path.Combine(".", "UtilityFiles", "SampleOpenApi.yml"); + var openApi = Path.Join(".", "UtilityFiles", "SampleOpenApi.yml"); var outputPath = $"{nameof(InvokeShowCommandAsync)}.md"; var args = new[] { "show", "-d", openApi, "-o", outputPath }; var parseResult = rootCommand.Parse(args); @@ -345,15 +345,15 @@ public async Task InvokeShowCommandAsync() public async Task InvokePluginCommandAsync() { var rootCommand = Program.CreateRootCommand(); - var manifest = Path.Combine(".", "UtilityFiles", "exampleapimanifest.json"); - var outputPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, nameof(InvokePluginCommandAsync)); + var manifest = Path.Join(".", "UtilityFiles", "exampleapimanifest.json"); + var outputPath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, nameof(InvokePluginCommandAsync)); var args = new[] { "plugin", "-m", manifest, "--of", outputPath }; var parseResult = rootCommand.Parse(args); var handler = Assert.IsType(rootCommand.Subcommands.First(c => c.Name == "plugin").Action, exactMatch: false); await handler.InvokeAsync(parseResult, TestContext.Current.CancellationToken); - using var jsDoc = JsonDocument.Parse(await File.ReadAllTextAsync(Path.Combine(outputPath, "ai-plugin.json"), TestContext.Current.CancellationToken)); + using var jsDoc = JsonDocument.Parse(await File.ReadAllTextAsync(Path.Join(outputPath, "ai-plugin.json"), TestContext.Current.CancellationToken)); var openAiManifest = OpenAIPluginManifest.Load(jsDoc.RootElement); Assert.NotNull(openAiManifest); From a9103c1946c766e6c95b40a0515695157e812546 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Tue, 11 Aug 2026 14:19:12 -0400 Subject: [PATCH 733/752] linting: further path combine replacement --- .../Services/OpenApiFilterServiceTests.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs index 2dc91151c..6883bab5a 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiFilterServiceTests.cs @@ -51,7 +51,7 @@ public void ReturnFilteredOpenApiDocumentBasedOnOperationIdsAndTags(string? oper public void ReturnFilteredOpenApiDocumentBasedOnPostmanCollection() { // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver2.json"); + var filePath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver2.json"); var fileInput = new FileInfo(filePath); var stream = fileInput.OpenRead(); @@ -158,7 +158,7 @@ public void CreateFilteredDocumentUsingPredicateFromRequestUrl() public void ShouldParseNestedPostmanCollection() { // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver3.json"); + var filePath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver3.json"); var fileInput = new FileInfo(filePath); var stream = fileInput.OpenRead(); @@ -175,7 +175,7 @@ public void ShouldParseNestedPostmanCollection() public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument() { // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver1.json"); + var filePath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver1.json"); var fileInput = new FileInfo(filePath); var stream = fileInput.OpenRead(); @@ -192,7 +192,7 @@ public void ThrowsExceptionWhenUrlsInCollectionAreMissingFromSourceDocument() public void ContinueProcessingWhenUrlsInCollectionAreMissingFromSourceDocument() { // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver4.json"); + var filePath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "postmanCollection_ver4.json"); var fileInput = new FileInfo(filePath); var stream = fileInput.OpenRead(); @@ -291,7 +291,7 @@ public void CreatePredicateMatchesAbsoluteUrlsWhenSourceHasNoServers() public async Task CopiesOverAllReferencedComponentsToTheSubsetDocumentCorrectly() { // Arrange - var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "docWithReusableHeadersAndExamples.yaml"); + var filePath = Path.Join(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "docWithReusableHeadersAndExamples.yaml"); var operationIds = "getItems"; // Act From 3f45f942d6b69ce9fe789e9ef8ab0fbaddca7914 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 12 Aug 2026 15:05:01 -0400 Subject: [PATCH 734/752] ci/nuget deploy cfs take 2 (#3015) * ci: upgrades to code sign 6 to fix deprecation notice Signed-off-by: Vincent Biret * ci: switches to net10 for hidi docker build Signed-off-by: Vincent Biret * ci: passes the restore config to hidi publish for CFS Signed-off-by: Vincent Biret --------- Signed-off-by: Vincent Biret --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 25f1ec589..46cb00637 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build-env WORKDIR /app COPY ./src ./hidi/src From 391d01e0623fbdbd119e2b22d765bd4dffbfba87 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2026 19:56:25 -0400 Subject: [PATCH 735/752] Bump the microsoftextensions group with 6 updates (#3029) Bumps Microsoft.Extensions.DependencyInjection from 10.0.10 to 10.0.11 Bumps Microsoft.Extensions.Logging from 10.0.10 to 10.0.11 Bumps Microsoft.Extensions.Logging.Abstractions from 10.0.10 to 10.0.11 Bumps Microsoft.Extensions.Logging.Console from 10.0.10 to 10.0.11 Bumps Microsoft.Extensions.Logging.Debug from 10.0.10 to 10.0.11 Bumps System.Text.Json from 10.0.10 to 10.0.11 --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 10.0.11 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.11 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.11 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 10.0.11 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.11 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: System.Text.Json dependency-version: 10.0.11 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.11 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.11 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.11 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 371fb339b..d578c9e69 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From 3bab83bb3c03c065b1650545d591be56b8fcdeec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Aug 2026 11:33:29 -0400 Subject: [PATCH 736/752] Bump Microsoft.NET.Test.Sdk from 18.8.1 to 18.9.0 (#3054) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.9.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.9.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 9d98d4ab3..95b457369 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From 26e21c09503a099f8f07d7f27fe38f23e6d05e50 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2026 10:03:58 -0600 Subject: [PATCH 737/752] Bump xunit.v3 from 3.2.2 to 4.0.0 (#3055) * Bump xunit.v3 from 3.2.2 to 4.0.0 --- updated-dependencies: - dependency-name: xunit.v3 dependency-version: 4.0.0 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: xunit.v3 dependency-version: 4.0.0 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * test(mtp): migrate xunit projects to MTP Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baywet <7905502+baywet@users.noreply.github.com> --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 95b457369..57543e05e 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -10,15 +10,14 @@ CA2007 true ..\..\src\Microsoft.OpenApi.snk + true - + - - - + From 6dd68ea94a69c729fd74a6a13da54d6d0493fec3 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Wed, 2 Sep 2026 15:55:35 -0400 Subject: [PATCH 738/752] chore: updates dependencies (#3064) --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index d578c9e69..5e2fd04ed 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -37,7 +37,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive all - + From dacb0d271b4c637ccbece692338509aae25d2c2a Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Fri, 4 Sep 2026 13:00:34 -0400 Subject: [PATCH 739/752] ci: migrate MTP reporting (#3068) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: fdbdcaaf-cc50-4b1b-b81f-0a43a08249b0 --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 57543e05e..2271cbb81 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -16,6 +16,8 @@ + + From 0c22e83bc66d703b2e0c0d301342be9b3fbd7374 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 16 Sep 2026 05:36:47 -0400 Subject: [PATCH 740/752] Bump the microsoftextensions group with 6 updates (#3084) Bumps Microsoft.Extensions.DependencyInjection from 10.0.11 to 10.0.12 Bumps Microsoft.Extensions.Logging from 10.0.11 to 10.0.12 Bumps Microsoft.Extensions.Logging.Abstractions from 10.0.11 to 10.0.12 Bumps Microsoft.Extensions.Logging.Console from 10.0.11 to 10.0.12 Bumps Microsoft.Extensions.Logging.Debug from 10.0.11 to 10.0.12 Bumps System.Text.Json from 10.0.11 to 10.0.12 --- updated-dependencies: - dependency-name: Microsoft.Extensions.DependencyInjection dependency-version: 10.0.12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging dependency-version: 10.0.12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Abstractions dependency-version: 10.0.12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: System.Text.Json dependency-version: 10.0.12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Console dependency-version: 10.0.12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions - dependency-name: Microsoft.Extensions.Logging.Debug dependency-version: 10.0.12 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: microsoftextensions ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index 5e2fd04ed..fab3173fd 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -29,10 +29,10 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all From f6c447b415d4ed0da4c027ed904d871781ab5f37 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2026 05:58:28 -0400 Subject: [PATCH 741/752] Bump the testing group with 1 update (#3088) Bumps Microsoft.NET.Test.Sdk from 18.9.0 to 18.10.0 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.10.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: testing - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.10.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: testing ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 2271cbb81..3e5f82aa4 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From 55a26ac9044b47c65a5fb3e3ead032270362c9cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Sep 2026 07:03:28 -0400 Subject: [PATCH 742/752] Bump the testing group with 1 update (#3090) Bumps xunit.v3 from 4.0.0 to 4.0.1 --- updated-dependencies: - dependency-name: xunit.v3 dependency-version: 4.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: testing - dependency-name: xunit.v3 dependency-version: 4.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: testing ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 3e5f82aa4..64690e433 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -19,7 +19,7 @@ - + From 248fdb3f8ddf50f1258027cb3e2275fb0b68fcd8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 22 Sep 2026 17:35:33 -0400 Subject: [PATCH 743/752] Bump the testing group with 1 update (#3092) Bumps Microsoft.NET.Test.Sdk from 18.10.0 to 18.10.1 --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.10.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: testing - dependency-name: Microsoft.NET.Test.Sdk dependency-version: 18.10.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: testing ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 64690e433..5e9e7ede9 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -15,7 +15,7 @@ - + From 21f70dd820bb42c7f7a87f7fe1d4ec3b2823e082 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 23 Sep 2026 17:46:12 -0400 Subject: [PATCH 744/752] Bump the testing group with 2 updates (#3093) Bumps Microsoft.Testing.Extensions.AzureDevOpsReport from 2.4.0 to 2.4.1 Bumps Microsoft.Testing.Extensions.GitHubActionsReport from 2.4.0 to 2.4.1 --- updated-dependencies: - dependency-name: Microsoft.Testing.Extensions.AzureDevOpsReport dependency-version: 2.4.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: testing - dependency-name: Microsoft.Testing.Extensions.AzureDevOpsReport dependency-version: 2.4.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: testing - dependency-name: Microsoft.Testing.Extensions.GitHubActionsReport dependency-version: 2.4.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: testing - dependency-name: Microsoft.Testing.Extensions.GitHubActionsReport dependency-version: 2.4.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: testing ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 5e9e7ede9..a32deb9b6 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -16,8 +16,8 @@ - - + + From 3b5d77c0ba38a437f8119ca35d744a7f8d286c76 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Oct 2026 06:57:05 -0400 Subject: [PATCH 745/752] Bump Moq from 4.20.72 to 4.21.0 (#3098) --- updated-dependencies: - dependency-name: Moq dependency-version: 4.21.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: Moq dependency-version: 4.21.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index a32deb9b6..6daa7906a 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -18,7 +18,7 @@ - + From 4b2c089259ae064251801e7d72d99f4fd6e2b96b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Oct 2026 06:49:29 -0400 Subject: [PATCH 746/752] Bump the testing group with 1 update (#3103) Bumps coverlet.MTP from 10.0.1 to 10.1.0 --- updated-dependencies: - dependency-name: coverlet.MTP dependency-version: 10.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: testing - dependency-name: coverlet.MTP dependency-version: 10.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: testing ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../Microsoft.OpenApi.Hidi.Tests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index 6daa7906a..c5adf7adc 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -14,7 +14,7 @@ - + From c3593e5bdb4ede1a173603f4e5b7f217b3566f65 Mon Sep 17 00:00:00 2001 From: "Gavin Barron (from Dev Box)" Date: Wed, 7 Oct 2026 12:14:05 -0700 Subject: [PATCH 747/752] chore(hidi): integrate main tool with OData builds and gated releases Preserve hidi 3.x behavior and shared imported history, independent versioning, public-only signing inputs, and disabled stable/preview publishing. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c631d217-9378-4cee-8c7e-761043ff3ae5 --- .azure-pipelines/ci-build.yml | 16 +- .azure-pipelines/hidi-release.yml | 290 ++++++++++++++++++ .dockerignore | 10 + .github/workflows/ci-cd.yml | 124 +++++++- .github/workflows/codeql-analysis.yml | 6 +- .github/workflows/release-please-gha.yml | 22 ++ .github/workflows/sonarcloud.yml | 26 +- .hidi-release-please-manifest.json | 3 + Dockerfile | 14 +- Microsoft.OpenApi.OData.sln | 12 + README.md | 11 + build.ps1 | 12 + global.json | 7 + hidi-release-please-config.json | 37 +++ install-tool.ps1 | 28 +- release-please-config.json | 24 +- src/Microsoft.OpenApi.Hidi/CHANGELOG.md | 8 + .../Microsoft.OpenApi.Hidi.csproj | 16 +- src/Microsoft.OpenApi.Hidi/readme.md | 84 ++++- .../Microsoft.OpenAPI.OData.Reader.csproj | 2 + .../Microsoft.OpenApi.Hidi.Tests.csproj | 9 +- .../testconfig.json | 12 + tool/Microsoft.OpenApi.Hidi.public.snk | Bin 0 -> 160 bytes tool/Microsoft.OpenApi.OData.public.snk | Bin 0 -> 160 bytes tool/hidi-local-nuget.config | 6 + 25 files changed, 747 insertions(+), 32 deletions(-) create mode 100644 .azure-pipelines/hidi-release.yml create mode 100644 .dockerignore create mode 100644 .hidi-release-please-manifest.json create mode 100644 global.json create mode 100644 hidi-release-please-config.json create mode 100644 src/Microsoft.OpenApi.Hidi/CHANGELOG.md create mode 100644 test/Microsoft.OpenApi.Hidi.Tests/testconfig.json create mode 100644 tool/Microsoft.OpenApi.Hidi.public.snk create mode 100644 tool/Microsoft.OpenApi.OData.public.snk create mode 100644 tool/hidi-local-nuget.config diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index bbd00501d..347cd58e9 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -66,6 +66,11 @@ extends: inputs: version: 8.x + - task: UseDotNet@2 + displayName: 'Use .NET 10' + inputs: + version: 10.x + # Install the nuget tool. - task: NuGetToolInstaller@1 displayName: 'Use NuGet >=6.11.0' @@ -99,9 +104,14 @@ extends: displayName: 'test' inputs: command: test - projects: '$(Build.SourcesDirectory)\Microsoft.OpenApi.OData.sln' + projects: '$(Build.SourcesDirectory)\test\Microsoft.OpenAPI.OData.Reader.Tests\Microsoft.OpenAPI.OData.Reader.Tests.csproj' arguments: '--configuration $(BuildConfiguration) --no-build' + - pwsh: | + dotnet run --project test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj -c $(BuildConfiguration) --no-build -- --minimum-expected-tests 1 + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + displayName: 'Test hidi (Microsoft.Testing.Platform)' + - task: EsrpCodeSigning@6 displayName: 'ESRP CodeSigning' inputs: @@ -242,7 +252,7 @@ extends: vmImage: ubuntu-latest steps: - pwsh: | - $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.*.nupkg -recurse | select -First 1 + $artifactName = Get-ChildItem -Path $(Pipeline.Workspace) -Filter Microsoft.OpenApi.OData.*.nupkg -recurse | select -First 1 $artifactVersion= $artifactName.Name -replace "Microsoft.OpenApi.OData.", "" -replace ".nupkg", "" #Set Variable $artifactName and $artifactVersion Write-Host "##vso[task.setvariable variable=artifactVersion; isSecret=false;]$artifactVersion" @@ -258,5 +268,5 @@ extends: tag: 'v$(artifactVersion)' title: 'v$(artifactVersion)' releaseNotesSource: inline - assets: '$(Pipeline.Workspace)\**\*.nupkg' + assets: '$(Pipeline.Workspace)\**\Microsoft.OpenApi.OData.*.nupkg' addChangeLog: false diff --git a/.azure-pipelines/hidi-release.yml b/.azure-pipelines/hidi-release.yml new file mode 100644 index 000000000..5f4879157 --- /dev/null +++ b/.azure-pipelines/hidi-release.yml @@ -0,0 +1,290 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +name: Hidi_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r) + +trigger: + branches: + include: + - main + tags: + include: + - hidi-v3.* +pr: + branches: + include: + - main + +variables: + buildConfiguration: Release + # Keep OFF until destination merges and source publishing is cut over. + hidiPublishingEnabled: 'false' + hidiPreviewPublishingEnabled: 'false' + +resources: + repositories: + - repository: 1ESPipelineTemplates + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates + parameters: + pool: + name: Azure-Pipelines-1ESPT-ExDShared + image: windows-latest + os: windows + stages: + - stage: build + jobs: + - job: hidi + templateContext: + outputs: + - output: pipelineArtifact + artifactName: Hidi + targetPath: '$(Build.ArtifactStagingDirectory)\hidi' + steps: + - task: UseDotNet@2 + displayName: Use .NET 6 for ESRP + inputs: + version: 6.x + - task: UseDotNet@2 + displayName: Use .NET 8 + inputs: + version: 8.x + - task: UseDotNet@2 + displayName: Use .NET 10 + inputs: + version: 10.x + - task: NuGetToolInstaller@1 + inputs: + versionSpec: '>=6.11.0' + checkLatest: true + - task: NuGetAuthenticate@1 + displayName: Authenticate to Azure Artifacts + - pwsh: | + @" + + + + + + + + "@ | Set-Content -Path "$(Build.SourcesDirectory)/nuget.config" -Encoding UTF8 + displayName: Create nuget.config (central feed) + - pwsh: | + $version = ([xml](Get-Content src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj)).Project.PropertyGroup.Version + if ($version -notmatch '^3\.\d+\.\d+(-[0-9A-Za-z.-]+)?$') { throw "Expected a hidi 3.x version, got $version." } + if ('$(Build.SourceBranch)' -like 'refs/tags/*' -and '$(Build.SourceBranch)' -ne "refs/tags/hidi-v$version") { + throw "Hidi tag must exactly match the hidi project version." + } + Write-Host "##vso[task.setvariable variable=HidiVersion]$version" + dotnet build src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj -c $(buildConfiguration) -p:GeneratePackageOnBuild=false + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + dotnet run --project test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj -c $(buildConfiguration) -- --minimum-expected-tests 1 + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + dotnet publish src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj -c $(buildConfiguration) -r win-x64 --self-contained true -p:PublishSingleFile=true -p:PackAsTool=false -p:GeneratePackageOnBuild=false -o artifacts\hidi\win-x64 + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + & .\artifacts\hidi\win-x64\Microsoft.OpenApi.Hidi.exe --help + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + New-Item -ItemType Directory -Force artifacts\hidi\signing | Out-Null + Copy-Item src\Microsoft.OpenApi.Hidi\bin\$(buildConfiguration)\net8.0\Microsoft.OpenApi.Hidi.dll artifacts\hidi\signing + Copy-Item artifacts\hidi\win-x64\Microsoft.OpenApi.Hidi.exe artifacts\hidi\signing + displayName: Build, test and stage hidi binaries + - task: EsrpCodeSigning@6 + displayName: Sign hidi DLL and Windows executable + inputs: + ConnectedServiceName: Federated DevX ESRP Managed Identity Connection + FolderPath: 'artifacts\hidi\signing' + Pattern: 'Microsoft.OpenApi.Hidi.*' + AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' + AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' + AuthAKVName: akv-prod-eastus + AuthCertName: ReferenceLibraryPrivateCert + AuthSignCertName: ReferencePackagePublisherCertificate + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolSign", + "parameters": [ + { "parameterName": "OpusName", "parameterValue": "Microsoft" }, + { "parameterName": "OpusInfo", "parameterValue": "http://www.microsoft.com" }, + { "parameterName": "FileDigest", "parameterValue": "/fd \"SHA256\"" }, + { "parameterName": "PageHash", "parameterValue": "/NPH" }, + { "parameterName": "TimeStamp", "parameterValue": "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256" } + ], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-230012", + "operationSetCode": "SigntoolVerify", + "parameters": [], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: '20' + MaxConcurrency: '50' + MaxRetryAttempts: '5' + PendingAnalysisWaitTimeoutMinutes: '5' + - pwsh: | + Copy-Item artifacts\hidi\signing\Microsoft.OpenApi.Hidi.dll src\Microsoft.OpenApi.Hidi\bin\$(buildConfiguration)\net8.0\Microsoft.OpenApi.Hidi.dll + Copy-Item artifacts\hidi\signing\Microsoft.OpenApi.Hidi.exe artifacts\hidi\win-x64\Microsoft.OpenApi.Hidi.exe + New-Item -ItemType Directory -Force '$(Build.ArtifactStagingDirectory)\hidi' | Out-Null + dotnet pack src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj -c $(buildConfiguration) --no-build -o '$(Build.ArtifactStagingDirectory)\hidi' + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + Compress-Archive -Path artifacts\hidi\win-x64\* -DestinationPath '$(Build.ArtifactStagingDirectory)\hidi\hidi-win-x64-$(HidiVersion).zip' + Copy-Item artifacts\hidi\win-x64\Microsoft.OpenApi.Hidi.exe '$(Build.ArtifactStagingDirectory)\hidi\Microsoft.OpenApi.Hidi.exe' + displayName: Pack signed hidi binaries + - task: EsrpCodeSigning@6 + displayName: Sign hidi NuGet package + inputs: + ConnectedServiceName: Federated DevX ESRP Managed Identity Connection + FolderPath: '$(Build.ArtifactStagingDirectory)\hidi' + Pattern: 'Microsoft.OpenApi.Hidi.$(HidiVersion).nupkg' + AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' + AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' + AuthAKVName: akv-prod-eastus + AuthCertName: ReferenceLibraryPrivateCert + AuthSignCertName: ReferencePackagePublisherCertificate + signConfigType: inlineSignParams + inlineOperation: | + [ + { + "keyCode": "CP-401405", + "operationSetCode": "NuGetSign", + "parameters": [], + "toolName": "sign", + "toolVersion": "1.0" + }, + { + "keyCode": "CP-401405", + "operationSetCode": "NuGetVerify", + "parameters": [], + "toolName": "sign", + "toolVersion": "1.0" + } + ] + SessionTimeout: '60' + MaxConcurrency: '50' + MaxRetryAttempts: '5' + PendingAnalysisWaitTimeoutMinutes: '5' + - stage: publish + dependsOn: build + condition: and(succeeded(), eq(variables.hidiPublishingEnabled, 'true'), startsWith(variables['Build.SourceBranch'], 'refs/tags/hidi-v3.')) + jobs: + - deployment: publish_hidi + templateContext: + type: releaseJob + isProduction: true + inputs: + - input: pipelineArtifact + artifactName: Hidi + targetPath: '$(Pipeline.Workspace)\hidi' + environment: nuget-org + strategy: + runOnce: + deploy: + steps: + - pwsh: | + $tag = '$(Build.SourceBranch)' -replace '^refs/tags/hidi-v', '' + if ([version]($tag -split '-')[0] -le [version]'3.10.2') { throw "Never republish the source migration baseline or an older hidi version." } + $package = "$(Pipeline.Workspace)\hidi\Microsoft.OpenApi.Hidi.$tag.nupkg" + if (-not (Test-Path $package)) { throw "Missing exact hidi package: $package" } + Write-Host "##vso[task.setvariable variable=HidiReleaseVersion]$tag" + displayName: Verify new hidi release version and exact package + - task: 1ES.PublishNuget@1 + displayName: Publish hidi NuGet tool + inputs: + packagesToPush: '$(Pipeline.Workspace)\hidi\Microsoft.OpenApi.Hidi.$(HidiReleaseVersion).nupkg' + nuGetFeedType: external + publishFeedCredentials: OpenAPI Nuget Connection + packageParentPath: '$(Pipeline.Workspace)\hidi' + - task: GitHubRelease@1 + displayName: Attach signed hidi release artifacts + inputs: + gitHubConnection: Github-MaggieKimani1 + action: edit + tagSource: userSpecifiedTag + tag: 'hidi-v$(HidiReleaseVersion)' + title: 'Hidi v$(HidiReleaseVersion)' + assets: | + $(Pipeline.Workspace)\hidi\Microsoft.OpenApi.Hidi.$(HidiReleaseVersion).nupkg + $(Pipeline.Workspace)\hidi\Microsoft.OpenApi.Hidi.exe + $(Pipeline.Workspace)\hidi\hidi-win-x64-$(HidiReleaseVersion).zip + addChangeLog: false + - deployment: publish_container + templateContext: + type: releaseJob + isProduction: true + environment: hidi-container + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - checkout: self + - pwsh: | + $version = ([xml](Get-Content src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj)).Project.PropertyGroup.Version + if ('$(Build.SourceBranch)' -ne "refs/tags/hidi-v$version") { throw "Hidi tag does not match project version." } + if ([version]($version -split '-')[0] -le [version]'3.10.2') { throw "Do not republish the migration baseline or an older hidi version." } + Write-Host "##vso[task.setvariable variable=HidiReleaseVersion]$version" + displayName: Read independent hidi version + - task: AzureCLI@2 + displayName: Publish multi-platform hidi image + inputs: + azureSubscription: ACR Images Push Service Connection + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + set -euo pipefail + az acr login --name msgraphprodregistry + docker run --privileged --rm tonistiigi/binfmt --install all + docker buildx create --use + docker buildx build --platform linux/amd64,linux/arm64/v8 \ + --tag "msgraphprodregistry.azurecr.io/public/openapi/hidi:$(HidiReleaseVersion)" \ + --tag "msgraphprodregistry.azurecr.io/public/openapi/hidi:latest" \ + --push . + - stage: preview + dependsOn: build + condition: and(succeeded(), eq(variables.hidiPublishingEnabled, 'true'), eq(variables.hidiPreviewPublishingEnabled, 'true'), eq(variables['Build.SourceBranch'], 'refs/heads/main')) + jobs: + - deployment: publish_preview_container + templateContext: + type: releaseJob + isProduction: true + environment: hidi-container + strategy: + runOnce: + deploy: + pool: + vmImage: ubuntu-latest + steps: + - checkout: self + - pwsh: | + $version = ([xml](Get-Content src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj)).Project.PropertyGroup.Version + if ($version -notmatch '^3\.\d+\.\d+$') { throw "Expected a stable hidi 3.x base version." } + $previewVersion = "$version.$([DateTime]::UtcNow.ToString('yyyyMMdd'))$(Build.BuildId)" + Write-Host "##vso[task.setvariable variable=HidiPreviewVersion]$previewVersion" + displayName: Compute independent hidi preview tag + - task: AzureCLI@2 + displayName: Publish multi-platform hidi preview image + inputs: + azureSubscription: ACR Images Push Service Connection + scriptType: bash + scriptLocation: inlineScript + inlineScript: | + set -euo pipefail + az acr login --name msgraphprodregistry + docker run --privileged --rm tonistiigi/binfmt --install all + docker buildx create --use + docker buildx build --platform linux/amd64,linux/arm64/v8 \ + --tag "msgraphprodregistry.azurecr.io/public/openapi/hidi:$(HidiPreviewVersion)" \ + --tag "msgraphprodregistry.azurecr.io/public/openapi/hidi:nightly" \ + --push . diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 000000000..b9099d2c0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,10 @@ +**/bin +**/obj +**/artifacts +.git +.vs +.idea +test +**/*.snk +!tool/Microsoft.OpenApi.Hidi.public.snk +!tool/Microsoft.OpenApi.OData.public.snk diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 2574f3a2a..05205e8ea 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -19,7 +19,9 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 with: - dotnet-version: 8.0.x + dotnet-version: | + 8.0.x + 10.0.x - name: Data gatherer id: data_gatherer @@ -74,6 +76,7 @@ jobs: -c Release # ` # -o $env:ARTIFACTS_FOLDER ` # /p:Version=$projectNewVersion + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } # Move NuGet packages to separate folder for pipeline convenience @@ -91,8 +94,65 @@ jobs: $testProjectsArray | ForEach-Object { dotnet test $PSItem ` -c Release + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } + - name: Run hidi tests (Microsoft.Testing.Platform) + shell: pwsh + run: | + dotnet run --project .\test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj -c Release -- --minimum-expected-tests 1 + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + + - name: Pack and install hidi locally + shell: pwsh + run: | + dotnet pack .\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj -c Release --no-build -o .\artifacts\hidi\nuget + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + .\install-tool.ps1 + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $workspace = (Get-Location).Path + $fixtures = Join-Path $workspace 'test' 'Microsoft.OpenApi.Hidi.Tests' 'UtilityFiles' + $outputs = Join-Path $workspace 'artifacts' 'hidi' + $hidi = Join-Path $outputs 'installed' 'hidi' + $sampleInput = Join-Path $fixtures 'SampleOpenApi.yml' + $csdlInput = Join-Path $fixtures 'Todo.xml' + $jsonOutput = Join-Path $outputs 'openapi.json' + $defaultOutput = Join-Path $outputs 'openapi-default.json' + $csdlOutput = Join-Path $outputs 'csdl.yaml' + $diagramOutput = Join-Path $outputs 'diagram.md' + & $hidi --help + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + & $hidi validate --openapi $sampleInput + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + & $hidi transform --openapi $sampleInput --format json --version 3.0 --output $jsonOutput --clean-output + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + & $hidi transform --csdl $csdlInput --format yaml --version 3.0 --output $csdlOutput --clean-output + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $document = Get-Content $jsonOutput -Raw | ConvertFrom-Json + if ($document.openapi -notlike '3.0.*' -or @($document.paths.PSObject.Properties).Count -eq 0) { + throw "Expected an OpenAPI 3.0 document with paths from SampleOpenApi." + } + & $hidi transform --openapi $sampleInput --format json --output $defaultOutput --clean-output + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $defaultDocument = Get-Content $defaultOutput -Raw | ConvertFrom-Json + if ($defaultDocument.openapi -notlike '3.2.*' -or @($defaultDocument.paths.PSObject.Properties).Count -eq 0) { + throw "Expected main's default OpenAPI 3.2 behavior with paths." + } + $csdlDocument = Get-Content $csdlOutput -Raw + if ($csdlDocument -notmatch '(?m)^openapi:\s*3\.0\.' -or $csdlDocument -notmatch '(?m)^ /Todos:\s*$' -or $csdlDocument -notmatch '(?m)^ schemas:\s*$') { + throw "Expected OpenAPI 3.0, /Todos paths and schemas in the CSDL YAML output." + } + & $hidi show --openapi $sampleInput --output $diagramOutput + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + if (-not (Select-String $diagramOutput -Pattern 'mermaid' -Quiet)) { throw "Expected a Mermaid diagram from hidi show." } + + - name: Upload hidi NuGet artifact (not a release) + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: hidi-nuget + path: artifacts/hidi/nuget + if-no-files-found: error + # - if: steps.tag_generator.outputs.new_version != '' # name: Upload NuGet packages as artifacts # id: ul_packages_artifact @@ -101,6 +161,68 @@ jobs: # name: NuGet packages # path: Artifacts/NuGet/ + hidi-windows: + name: Hidi Windows executable + runs-on: windows-latest + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 + with: + dotnet-version: | + 8.0.x + 10.0.x + - name: Publish and smoke-test Windows executable + shell: pwsh + run: | + dotnet publish .\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:PackAsTool=false -p:GeneratePackageOnBuild=false -o .\artifacts\hidi\win-x64 + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + & .\artifacts\hidi\win-x64\Microsoft.OpenApi.Hidi.exe --help + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + Compress-Archive -Path .\artifacts\hidi\win-x64\* -DestinationPath .\artifacts\hidi\hidi-win-x64.zip + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: hidi-windows-executable + path: | + artifacts/hidi/hidi-win-x64.zip + artifacts/hidi/win-x64/Microsoft.OpenApi.Hidi.exe + if-no-files-found: error + + hidi-docker: + name: Hidi Docker build + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Build and smoke-test Docker image (no push) + run: | + set -euo pipefail + docker build --tag hidi:ci . + docker run --rm hidi:ci --help + mkdir -p artifacts/hidi/docker + docker run --rm --user "$(id -u):$(id -g)" \ + --mount "type=bind,source=$PWD/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/SampleOpenApi.yml,target=/app/openapi.yml,readonly" \ + --mount "type=bind,source=$PWD/artifacts/hidi/docker,target=/app/output" \ + hidi:ci transform --openapi /app/openapi.yml --format json --output /app/output/openapi.json --clean-output + docker run --rm --user "$(id -u):$(id -g)" \ + --mount "type=bind,source=$PWD/test/Microsoft.OpenApi.Hidi.Tests/UtilityFiles/Todo.xml,target=/app/api.csdl,readonly" \ + --mount "type=bind,source=$PWD/artifacts/hidi/docker,target=/app/output" \ + hidi:ci transform --csdl /app/api.csdl --format yaml --version 3.0 --output /app/output/csdl.yaml --clean-output + - name: Verify Docker transformation outputs + shell: pwsh + run: | + $outputs = Join-Path (Get-Location).Path 'artifacts' 'hidi' 'docker' + $document = Get-Content (Join-Path $outputs 'openapi.json') -Raw | ConvertFrom-Json + if ($document.openapi -notlike '3.2.*' -or @($document.paths.PSObject.Properties).Count -eq 0) { + throw "Expected main's default OpenAPI 3.2 behavior with paths in Docker." + } + $csdlDocument = Get-Content (Join-Path $outputs 'csdl.yaml') -Raw + if ($csdlDocument -notmatch '(?m)^openapi:\s*3\.0\.' -or $csdlDocument -notmatch '(?m)^ /Todos:\s*$' -or $csdlDocument -notmatch '(?m)^ schemas:\s*$') { + throw "Expected OpenAPI 3.0, /Todos paths and schemas in the Docker CSDL YAML output." + } + cd: if: needs.ci.outputs.is_default_branch == 'true' && needs.ci.outputs.latest_version != '' name: Continuous Deployment diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4f97ad3bb..26f1e86d7 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -44,7 +44,9 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 with: - dotnet-version: 8.0.x + dotnet-version: | + 8.0.x + 10.0.x # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL @@ -62,7 +64,7 @@ jobs: # uses: github/codeql-action/autobuild@v2 - name: build - run: dotnet build src\Microsoft.OpenApi.OData.Reader\Microsoft.OpenAPI.OData.Reader.csproj -c Release + run: dotnet build src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj -c Release # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl diff --git a/.github/workflows/release-please-gha.yml b/.github/workflows/release-please-gha.yml index 31b2ea292..f503b3d48 100644 --- a/.github/workflows/release-please-gha.yml +++ b/.github/workflows/release-please-gha.yml @@ -50,3 +50,25 @@ jobs: config-file: release-please-config.json manifest-file: .release-please-manifest.json target-branch: ${{ github.ref_name }} + + release-please-hidi: + # Enable only after destination merges and source publishing is cut over. + if: ${{ false }} + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Generate GitHub App token + id: app-token + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + with: + client-id: ${{ vars.RELEASE_PLEASE_TOKEN_PROVIDER_APP_ID }} + private-key: ${{ secrets.RELEASE_PLEASE_TOKEN_PROVIDER_PEM }} + - name: Release Please (independent hidi version) + uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 + with: + token: ${{ steps.app-token.outputs.token }} + config-file: hidi-release-please-config.json + manifest-file: .hidi-release-please-manifest.json + target-branch: ${{ github.ref_name }} diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml index f39b75988..a0900ac26 100644 --- a/.github/workflows/sonarcloud.yml +++ b/.github/workflows/sonarcloud.yml @@ -43,7 +43,9 @@ jobs: - name: Setup .NET uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 with: - dotnet-version: 8.0.x + dotnet-version: | + 8.0.x + 10.0.x - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis @@ -62,8 +64,26 @@ jobs: CoverletOutputFormat: 'opencover' # https://github.com/microsoft/vstest/issues/4014#issuecomment-1307913682 shell: pwsh run: | - dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET.OData" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="test/**/coverage.net8.0.opencover.xml" + dotnet tool run dotnet-sonarscanner begin /k:"microsoft_OpenAPI.NET.OData" /o:"microsoft" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="test/**/coverage.net8.0.opencover.xml,artifacts/hidi/coverage/*opencover*.xml" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } dotnet workload restore + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } dotnet build - dotnet test Microsoft.OpenApi.OData.sln --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + dotnet test test\Microsoft.OpenAPI.OData.Reader.Tests\Microsoft.OpenAPI.OData.Reader.Tests.csproj --no-build --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=opencover + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + dotnet run --project test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj --no-build -- --minimum-expected-tests 1 --coverlet --coverlet-output-format opencover --coverlet-include "[Microsoft.OpenApi.Hidi]*" --results-directory artifacts\hidi\coverage + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $reports = @(Get-ChildItem artifacts\hidi\coverage -Filter '*opencover*.xml') + if ($reports.Count -eq 0) { throw "Hidi OpenCover report was not generated." } + $hidiModules = @($reports | ForEach-Object { + ([xml](Get-Content $_.FullName -Raw)).CoverageSession.Modules.Module + } | Where-Object { $_.ModuleName -eq 'Microsoft.OpenApi.Hidi' }) + if (-not ($hidiModules | Where-Object { + $_.SelectNodes('./Classes/Class/Methods/Method/SequencePoints/SequencePoint').Count -gt 0 -and + $_.SelectNodes('./Classes/Class/Methods/Method/SequencePoints/SequencePoint[@vc > 0]').Count -gt 0 + })) { + throw "Hidi OpenCover report contains no covered Hidi sequence points." + } dotnet tool run dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } diff --git a/.hidi-release-please-manifest.json b/.hidi-release-please-manifest.json new file mode 100644 index 000000000..0ddfa5e48 --- /dev/null +++ b/.hidi-release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "3.10.2" +} diff --git a/Dockerfile b/Dockerfile index 46cb00637..0ec43beb9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,14 +3,19 @@ WORKDIR /app COPY ./src ./hidi/src COPY ./Directory.Build.props ./hidi/Directory.Build.props +COPY ./Build.props ./hidi/Build.props +COPY ./build.root ./hidi/build.root +COPY ./global.json ./hidi/global.json +COPY ./tool/Microsoft.OpenApi.OData.public.snk ./hidi/tool/Microsoft.OpenApi.OData.public.snk +COPY ./tool/Microsoft.OpenApi.Hidi.public.snk ./hidi/tool/Microsoft.OpenApi.Hidi.public.snk COPY ./README.md ./hidi/README.md WORKDIR /app/hidi -RUN dotnet publish ./src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -c Release +RUN dotnet publish ./src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj -c Release -o /app/publish -p:GeneratePackageOnBuild=false -p:HidiPublicSignBuild=true FROM mcr.microsoft.com/dotnet/runtime:8.0-jammy-chiseled AS runtime WORKDIR /app -COPY --from=build-env /app/hidi/src/Microsoft.OpenApi.Hidi/bin/Release/net8.0 ./ +COPY --from=build-env /app/publish ./ VOLUME /app/output VOLUME /app/openapi.yml @@ -19,5 +24,6 @@ VOLUME /app/collection.json ENV HIDI_CONTAINER=true DOTNET_TieredPGO=1 DOTNET_TC_QuickJitForLoops=1 ENTRYPOINT ["dotnet", "Microsoft.OpenApi.Hidi.dll"] LABEL description="# Welcome to Hidi \ -To start transforming OpenAPI documents checkout [the getting started documentation](https://github.com/microsoft/OpenAPI.NET/tree/main/src/Microsoft.OpenApi.Hidi) \ -[Source dockerfile](https://github.com/microsoft/OpenAPI.NET/blob/main/Dockerfile)" +To start transforming OpenAPI documents checkout [the getting started documentation](https://github.com/microsoft/OpenAPI.NET.OData/tree/main/src/Microsoft.OpenApi.Hidi) \ +[Source dockerfile](https://github.com/microsoft/OpenAPI.NET.OData/blob/main/Dockerfile)" +LABEL org.opencontainers.image.source="https://github.com/microsoft/OpenAPI.NET.OData" diff --git a/Microsoft.OpenApi.OData.sln b/Microsoft.OpenApi.OData.sln index 085f0a157..348ae6a94 100644 --- a/Microsoft.OpenApi.OData.sln +++ b/Microsoft.OpenApi.OData.sln @@ -16,6 +16,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OpenApi.Hidi", "src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj", "{E80E81B7-C4FD-4061-875A-F7F7EC635722}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OpenApi.Hidi.Tests", "test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj", "{521CDCFF-1E62-4396-9266-7CAA99205969}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -38,6 +42,14 @@ Global {79B190E8-EDB0-4C03-8FD8-EB48E4807CFB}.Debug|Any CPU.Build.0 = Debug|Any CPU {79B190E8-EDB0-4C03-8FD8-EB48E4807CFB}.Release|Any CPU.ActiveCfg = Release|Any CPU {79B190E8-EDB0-4C03-8FD8-EB48E4807CFB}.Release|Any CPU.Build.0 = Release|Any CPU + {E80E81B7-C4FD-4061-875A-F7F7EC635722}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E80E81B7-C4FD-4061-875A-F7F7EC635722}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E80E81B7-C4FD-4061-875A-F7F7EC635722}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E80E81B7-C4FD-4061-875A-F7F7EC635722}.Release|Any CPU.Build.0 = Release|Any CPU + {521CDCFF-1E62-4396-9266-7CAA99205969}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {521CDCFF-1E62-4396-9266-7CAA99205969}.Debug|Any CPU.Build.0 = Debug|Any CPU + {521CDCFF-1E62-4396-9266-7CAA99205969}.Release|Any CPU.ActiveCfg = Release|Any CPU + {521CDCFF-1E62-4396-9266-7CAA99205969}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/README.md b/README.md index b02123072..e3b392206 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,17 @@ The `GetEdmModel()` method can load a model in 3 ways: The OpenAPI.OData.reader nuget package is at: [https://www.nuget.org/packages/Microsoft.OpenApi.OData/](https://www.nuget.org/packages/Microsoft.OpenApi.OData) +## Hidi command line tool + +[Hidi](src/Microsoft.OpenApi.Hidi/readme.md) validates, transforms and slices +OpenAPI documents, converts OData CSDL, and generates API diagrams. +The NuGet package remains `Microsoft.OpenApi.Hidi` and the command remains `hidi`. +Hidi 3.x is maintained on `main`; Hidi 2.x is maintained on `support/v2`. +Both tracks use independent versions and require the .NET 8 runtime. +Building this repository, including the Hidi tests, requires the .NET 10 SDK. +Destination Hidi release publishing is disabled during the migration; the +source repository remains intact until the destination PRs are completed. + --- # Contributing diff --git a/build.ps1 b/build.ps1 index 1becaff9b..6186dd8fc 100644 --- a/build.ps1 +++ b/build.ps1 @@ -105,6 +105,8 @@ ForEach ($ver in $SNVersions) # Other variables $ProductProj = $ENLISTMENT_ROOT + "\src\Microsoft.OpenAPI.OData.Reader\Microsoft.OpenApi.OData.Reader.csproj" $TESTProj = $ENLISTMENT_ROOT + "\test\Microsoft.OpenAPI.OData.Reader.Tests\Microsoft.OpenApi.OData.Reader.Tests.csproj" +$HidiProj = $ENLISTMENT_ROOT + "\src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj" +$HidiTESTProj = $ENLISTMENT_ROOT + "\test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj" $TESTDIR = $ENLISTMENT_ROOT + "\bin\$Configuration\Test\net472" $PRODUCTDIR = $ENLISTMENT_ROOT + "\bin\$Configuration\net472" @@ -193,6 +195,12 @@ Function BuildProcess Write-Host "Build Test ..." & dotnet.exe build $TESTProj -c $Configuration + + Write-Host "Build Hidi ..." + & dotnet.exe build $HidiProj -c $Configuration + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + & dotnet.exe build $HidiTESTProj -c $Configuration + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } Write-Host "Build Done" -ForegroundColor $Success $script:BUILD_END_TIME = Get-Date @@ -205,6 +213,10 @@ Function TestProcess $script:TEST_START_TIME = Get-Date & dotnet test $TESTProj -c $Configuration + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + + & dotnet run --project $HidiTESTProj -c $Configuration --no-build -- --minimum-expected-tests 1 + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } Write-Host "Test Done" -ForegroundColor $Success $script:TEST_END_TIME = Get-Date diff --git a/global.json b/global.json new file mode 100644 index 000000000..d46d21e50 --- /dev/null +++ b/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "10.0.100", + "rollForward": "latestFeature", + "allowPrerelease": false + } +} diff --git a/hidi-release-please-config.json b/hidi-release-please-config.json new file mode 100644 index 000000000..457dc5244 --- /dev/null +++ b/hidi-release-please-config.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "bootstrap-sha": "5574ccc6d8d129d7a49729619fac3e3e36d334fd", + "release-type": "simple", + "include-component-in-tag": true, + "include-v-in-tag": true, + "exclude-paths": [ + ".azure-pipelines", + ".github", + ".idea", + ".vs", + ".vscode", + "src/Microsoft.OpenApi.OData.Reader", + "src/OoasGui", + "src/OoasUtil", + "test/Microsoft.OpenAPI.OData.Reader.Tests", + "docs", + "CHANGELOG.md", + "Directory.Build.props", + "release-please-config.json", + ".release-please-manifest.json" + ], + "packages": { + ".": { + "package-name": "Microsoft.OpenApi.Hidi", + "component": "hidi", + "changelog-path": "src/Microsoft.OpenApi.Hidi/CHANGELOG.md", + "extra-files": [ + { + "type": "xml", + "path": "src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj", + "xpath": "//Project/PropertyGroup/Version" + } + ] + } + } +} diff --git a/install-tool.ps1 b/install-tool.ps1 index 0b4615c67..4d1a74c07 100644 --- a/install-tool.ps1 +++ b/install-tool.ps1 @@ -1,7 +1,25 @@ -$latest = Get-ChildItem .\artifacts\Microsoft.OpenApi.Hidi* | select-object -Last 1 -$version = $latest.Name.Split(".")[3..5] | join-string -Separator "." +$ErrorActionPreference = 'Stop' -if (Test-Path -Path ./artifacts/hidi.exe) { - dotnet tool uninstall --tool-path artifacts Microsoft.OpenApi.Hidi +$projectPath = Join-Path $PSScriptRoot 'src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj' +$version = ([xml](Get-Content $projectPath)).Project.PropertyGroup.Version +$packageDirectory = Join-Path $PSScriptRoot 'artifacts\hidi\nuget' +$packagePath = Join-Path $packageDirectory "Microsoft.OpenApi.Hidi.$version.nupkg" +$toolDirectory = Join-Path $PSScriptRoot 'artifacts\hidi\installed' +$configPath = Join-Path $PSScriptRoot 'tool\hidi-local-nuget.config' + +if (-not (Test-Path $packagePath)) { + throw "Missing $packagePath. Pack the hidi project in Release configuration before installing." +} +if ((Test-Path (Join-Path $toolDirectory 'hidi.exe')) -or (Test-Path (Join-Path $toolDirectory 'hidi'))) { + dotnet tool uninstall --tool-path $toolDirectory Microsoft.OpenApi.Hidi + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } } -dotnet tool install --tool-path artifacts --add-source .\artifacts\ --version $version Microsoft.OpenApi.Hidi \ No newline at end of file +dotnet tool install --tool-path $toolDirectory --configfile $configPath --add-source $packageDirectory --no-cache --version $version Microsoft.OpenApi.Hidi +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + +$installedDlls = @(Get-ChildItem $toolDirectory -Force -Recurse -Filter Microsoft.OpenApi.Hidi.dll) +if ($installedDlls.Count -ne 1) { throw 'Expected exactly one installed hidi DLL.' } +$builtDll = Join-Path $PSScriptRoot 'src\Microsoft.OpenApi.Hidi\bin\Release\net8.0\Microsoft.OpenApi.Hidi.dll' +if ((Get-FileHash $installedDlls[0].FullName).Hash -ne (Get-FileHash $builtDll).Hash) { + throw 'Installed hidi does not match the locally built package.' +} \ No newline at end of file diff --git a/release-please-config.json b/release-please-config.json index 0e431d4d9..82ec61065 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -5,7 +5,29 @@ ".github", ".idea", ".vs", - ".vscode" + ".vscode", + "src/Microsoft.OpenApi.Hidi", + "src/Microsoft.OpenApi.Tool", + "src/Microsoft.Hidi", + "Microsoft.OpenApi.Hidi.Tests", + "test/Microsoft.OpenApi.Hidi.Tests", + "test/Microsoft.OpenApi.Tests/Services/OpenApiCSDLConversionTests.cs", + "test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs", + "test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs", + "test/Microsoft.OpenApi.Tests/UtilityFiles/OpenApiDocumentMock.cs", + "test/Microsoft.OpenApi.Tests/UtilityFiles/Todo.xml", + "test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver1.json", + "test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver2.json", + "test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver3.json", + "test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver4.json", + "tool/Microsoft.OpenApi.Hidi.public.snk", + "tool/Microsoft.OpenApi.OData.public.snk", + "tool/hidi-local-nuget.config", + "Dockerfile", + ".dockerignore", + "install-tool.ps1", + "hidi-release-please-config.json", + ".hidi-release-please-manifest.json" ], "release-type": "simple", "bump-minor-pre-major": true, diff --git a/src/Microsoft.OpenApi.Hidi/CHANGELOG.md b/src/Microsoft.OpenApi.Hidi/CHANGELOG.md new file mode 100644 index 000000000..8857fc2f7 --- /dev/null +++ b/src/Microsoft.OpenApi.Hidi/CHANGELOG.md @@ -0,0 +1,8 @@ +# Hidi changelog + +## 3.10.2 + +This is the source migration baseline from OpenAPI.NET. It is already published +and must not be republished from this repository. Hidi 3.x is maintained on +`main`, independently of the OData library and the Hidi 2.x `support/v2` track. +Destination publishing remains disabled until source cutover. diff --git a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj index fab3173fd..573dbeaf9 100644 --- a/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj +++ b/src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj @@ -8,7 +8,9 @@ true enable hidi - ./../../artifacts + Microsoft.OpenApi.Hidi + 3.10.2 + $(MSBuildThisFileDirectory)..\..\artifacts\hidi\nuget OpenAPI.NET CLI tool for slicing OpenAPI documents true @@ -16,7 +18,11 @@ $(NoWarn);NU5048;NU5104;CA1848; readme.md All - ..\Microsoft.OpenApi.snk + true + true + ..\..\tool\Microsoft.OpenApi.Hidi.public.snk + Microsoft OpenApi Hidi CLI + https://github.com/microsoft/OpenAPI.NET.OData @@ -39,14 +45,14 @@ - + + - - + diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md index 95aba5f10..54f0121c2 100644 --- a/src/Microsoft.OpenApi.Hidi/readme.md +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -13,21 +13,63 @@ Hidi has these key capabilities that enable you to build different scenarios off ## Installation -Install [Microsoft.OpenApi.Hidi](https://www.nuget.org/packages/Microsoft.OpenApi.Hidi/1.0.0-preview4) package from NuGet by running the following command: +Install [Microsoft.OpenApi.Hidi](https://www.nuget.org/packages/Microsoft.OpenApi.Hidi) +from NuGet. Hidi 3.x is maintained on this repository's `main` branch and requires +.NET 8. Hidi 2.x is maintained separately on `support/v2`. ### .NET CLI(Global) ```bash -dotnet tool install --global Microsoft.OpenApi.Hidi --prerelease +dotnet tool install --global Microsoft.OpenApi.Hidi --version 3.10.2 ``` ### .NET CLI(local) ```bash -dotnet new tool-manifest #if you are setting up the OpenAPI.NET repo -dotnet tool install --local Microsoft.OpenApi.Hidi --prerelease +dotnet new tool-manifest # if the repository does not have a tool manifest +dotnet tool install --local Microsoft.OpenApi.Hidi --version 3.10.2 ``` +### Build and install from this repository + +Run these commands from the repository root with the .NET 10 SDK and .NET 8 runtime installed: + +```powershell +dotnet pack src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj -c Release -o artifacts\hidi\nuget +.\install-tool.ps1 +artifacts\hidi\installed\hidi --help +``` + +Hidi uses published `Microsoft.OpenApi` and `Microsoft.OpenApi.YamlReader` 3.10.2 +packages, and builds the OData converter from this repository. No sibling source +checkout is required. Its version is independent of the OData library version. +The local NuGet configuration excludes remote feeds so this smoke test installs +the newly built artifact, not the already-published package with the same version. + +### Tests and coverage + +Hidi tests use Microsoft.Testing.Platform; the existing OData tests continue to +use VSTest. Run Hidi tests and collect coverage independently: + +```powershell +dotnet run --project test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj -c Release -- --minimum-expected-tests 1 +dotnet run --project test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj -c Release --no-build -- --minimum-expected-tests 1 --coverlet --results-directory artifacts\hidi\coverage +``` + +The Hidi-only `testconfig.json` explicitly includes the Hidi assembly and excludes +test/generated code. This authoritative configuration prevents Coverlet's +dynamic namespace exclusions from excluding `Microsoft.OpenApi.Hidi` itself. +The Sonar workflow requires an OpenCover report with covered Hidi sequence points. + +### Windows executable + +```powershell +dotnet publish src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:PackAsTool=false -p:GeneratePackageOnBuild=false -o artifacts\hidi\win-x64 +artifacts\hidi\win-x64\Microsoft.OpenApi.Hidi.exe --help +``` + +CI produces a Windows executable artifact without publishing a production release. + ### Docker Hidi is also available as a Docker image: @@ -35,6 +77,38 @@ Hidi is also available as a Docker image: ```bash docker pull mcr.microsoft.com/openapi/hidi ``` + +Build the destination image locally without pushing it: + +```powershell +docker build --tag hidi:local . +docker run --rm hidi:local --help +``` + +Mount input files and a writable output directory when transforming documents: + +```powershell +docker run --rm --mount "type=bind,source=$PWD\test\Microsoft.OpenApi.Hidi.Tests\UtilityFiles\SampleOpenApi.yml,target=/app/openapi.yml,readonly" --mount "type=bind,source=$PWD\artifacts\hidi,target=/app/output" hidi:local transform --openapi /app/openapi.yml --output /app/output/result.json --format json +``` + +Local/CI builds use the public-only Hidi strong-name identity. Official release +artifacts are signed in Azure Pipelines. Docker builds opt into +`HidiPublicSignBuild=true` for the local OData project, using its own public-only +key without changing normal OData signing. Private `.snk` resources are excluded +from the Docker context and must not be copied into new Hidi resources. + +The migration baseline 3.10.2 is already published. Destination Hidi NuGet, +GitHub release, stable Docker and preview Docker publishing are disabled until +source cutover. The first destination stable release must advance the Hidi +version; OData releases use separate artifacts and tags. + +The gated official pipeline retains the consumer image +`mcr.microsoft.com/openapi/hidi`, backed by +`msgraphprodregistry.azurecr.io/public/openapi/hidi`. Stable images use `latest` +and the independent Hidi version. Main previews use `nightly` and +`VERSION.YYYYMMDDRUNNUM`, for `linux/amd64` and `linux/arm64/v8`. +No image is pushed during this migration. Privileged cross-platform emulation +setup belongs only in the authorized CI pipeline, not a shared local environment. ## How to use Hidi @@ -84,7 +158,7 @@ This command accepts the following parameters: • --csdl-filter (--csf) - a filter parameter that a user can use to select a subset of a large CSDL file. They do so by providing a comma delimited list of EntitySet and Singleton names that appear in the EntityContainer. • --output (-o) - Output directory path for the transformed document. • --clean-output (--co) - an optional param that allows a user to overwrite an existing file. - • --version (-v) - OpenAPI specification version. + • --version (-v) - OpenAPI specification version (2.0, 3.0, 3.1 or 3.2; defaults to 3.2). • --metadata-version (--mv) - the metadata version to use. • --format (-f) - File format • --terse-output (--to) - Produce terse json output diff --git a/src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj b/src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj index 67a40c160..a0679c795 100644 --- a/src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj +++ b/src/Microsoft.OpenApi.OData.Reader/Microsoft.OpenAPI.OData.Reader.csproj @@ -12,6 +12,8 @@ This package contains the codes you need to convert OData CSDL to Open API Document of Model. Microsoft.OpenApi.OData.Reader ..\..\tool\Microsoft.OpenApi.OData.snk + true + ..\..\tool\Microsoft.OpenApi.OData.public.snk ..\..\bin\Debug\ ..\..\bin\Release\ false diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj index c5adf7adc..098f5f0bd 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj +++ b/test/Microsoft.OpenApi.Hidi.Tests/Microsoft.OpenApi.Hidi.Tests.csproj @@ -7,9 +7,11 @@ false All + true CA2007 true - ..\..\src\Microsoft.OpenApi.snk + true + ..\..\tool\Microsoft.OpenApi.Hidi.public.snk true @@ -24,11 +26,12 @@ - - + + PreserveNewest + Always diff --git a/test/Microsoft.OpenApi.Hidi.Tests/testconfig.json b/test/Microsoft.OpenApi.Hidi.Tests/testconfig.json new file mode 100644 index 000000000..2240bfdd8 --- /dev/null +++ b/test/Microsoft.OpenApi.Hidi.Tests/testconfig.json @@ -0,0 +1,12 @@ +{ + "platformOptions": { + "Coverlet": { + "include": "[Microsoft.OpenApi.Hidi]*", + "exclude": "[*.Tests]*", + "excludeByAttribute": "GeneratedCodeAttribute,CompilerGeneratedAttribute,ExcludeFromCodeCoverage,ExcludeFromCodeCoverageAttribute", + "format": "opencover", + "includeTestAssembly": false, + "excludeAssembliesWithoutSources": "MissingAll" + } + } +} diff --git a/tool/Microsoft.OpenApi.Hidi.public.snk b/tool/Microsoft.OpenApi.Hidi.public.snk new file mode 100644 index 0000000000000000000000000000000000000000..1d23f1f9f4a2947ed903b353bf5037bfa6f73834 GIT binary patch literal 160 zcmV;R0AK$ABme*efB*oL000060ssI2Bme+XQ$aBR1ONa50097%e6)jyvZeJ;T;q~e z@sB3cDmj@AvV8Q1H?PLLVs)FTmbjw7wsq9wpFIZbwOSX88$dDKvZrU_nRnQX&W1`2 z7Qex>zPk?JpW=n_5C6cZUz65k`US5C`lG7S(<@f2sa^4-#OGb?7D_)F OOl3Wn8v*~rp0mVL5=b=w literal 0 HcmV?d00001 diff --git a/tool/Microsoft.OpenApi.OData.public.snk b/tool/Microsoft.OpenApi.OData.public.snk new file mode 100644 index 0000000000000000000000000000000000000000..50dcb4034c87977be8d96e630d5636e02f9e345d GIT binary patch literal 160 zcmV;R0AK$ABme*efB*oL000060ssI2Bme+XQ$aBR1ONa50096MoRY_JjMQ=*UOp4) zTeT?+<>wdkyqsa>y{{ph|FSZ)fB&z*u+X+gUBRYjK!ZkZ=uY4UJ#*DzoM{oU!%>Vb zfYYJ*(H + + + + + From 2251d36be04d45ecfba2b54c60a76e1dee6487f1 Mon Sep 17 00:00:00 2001 From: "Gavin Barron (from Dev Box)" Date: Wed, 7 Oct 2026 12:38:38 -0700 Subject: [PATCH 748/752] chore(hidi): align solution builds and release tracking Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c631d217-9378-4cee-8c7e-761043ff3ae5 --- .github/workflows/codeql-analysis.yml | 2 +- release-please-config.json | 10 +--------- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 26f1e86d7..ac02bed91 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -64,7 +64,7 @@ jobs: # uses: github/codeql-action/autobuild@v2 - name: build - run: dotnet build src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj -c Release + run: dotnet build Microsoft.OpenApi.OData.sln -c Release # ℹ️ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl diff --git a/release-please-config.json b/release-please-config.json index 82ec61065..75e417d68 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -11,15 +11,7 @@ "src/Microsoft.Hidi", "Microsoft.OpenApi.Hidi.Tests", "test/Microsoft.OpenApi.Hidi.Tests", - "test/Microsoft.OpenApi.Tests/Services/OpenApiCSDLConversionTests.cs", - "test/Microsoft.OpenApi.Tests/Services/OpenApiServiceTests.cs", - "test/Microsoft.OpenApi.Tests/Services/OpenApiFilterServiceTests.cs", - "test/Microsoft.OpenApi.Tests/UtilityFiles/OpenApiDocumentMock.cs", - "test/Microsoft.OpenApi.Tests/UtilityFiles/Todo.xml", - "test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver1.json", - "test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver2.json", - "test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver3.json", - "test/Microsoft.OpenApi.Tests/UtilityFiles/postmanCollection_ver4.json", + "test/Microsoft.OpenApi.Tests", "tool/Microsoft.OpenApi.Hidi.public.snk", "tool/Microsoft.OpenApi.OData.public.snk", "tool/hidi-local-nuget.config", From bfcaa505f8141f0f7f916ea04890106d1c9cc1be Mon Sep 17 00:00:00 2001 From: "Gavin Barron (from Dev Box)" Date: Wed, 7 Oct 2026 12:52:52 -0700 Subject: [PATCH 749/752] test(hidi): cover extension and document-filter branches Assert real string/extension edge cases and public transform filtering behavior without changing production code or coverage exclusions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c631d217-9378-4cee-8c7e-761043ff3ae5 --- .../Extensions/ExtensionTests.cs | 95 ++++++++++++ .../Services/TransformFilterTests.cs | 142 ++++++++++++++++++ 2 files changed, 237 insertions(+) create mode 100644 test/Microsoft.OpenApi.Hidi.Tests/Extensions/ExtensionTests.cs create mode 100644 test/Microsoft.OpenApi.Hidi.Tests/Services/TransformFilterTests.cs diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Extensions/ExtensionTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Extensions/ExtensionTests.cs new file mode 100644 index 000000000..2f9d38e91 --- /dev/null +++ b/test/Microsoft.OpenApi.Hidi.Tests/Extensions/ExtensionTests.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System.Text.Json.Nodes; +using Microsoft.OpenApi.Hidi.Extensions; +using Moq; +using Xunit; + +namespace Microsoft.OpenApi.Hidi.Tests +{ + public class ExtensionTests + { + [Theory] + [InlineData(null, null, true)] + [InlineData("", " ", true)] + [InlineData("\t", "value", false)] + [InlineData("Hidi", "HIDI", true)] + [InlineData("Hidi", "different", false)] + [InlineData("Hidi", null, false)] + public void CompareStringsUsingDefaultCaseInsensitiveComparison(string? target, string? searchValue, bool expected) + { + Assert.Equal(expected, target.IsEquals(searchValue)); + } + + [Fact] + public void RespectExplicitCaseSensitiveComparison() + { + Assert.False("Hidi".IsEquals("HIDI", StringComparison.Ordinal)); + Assert.True("Hidi".IsEquals("Hidi", StringComparison.Ordinal)); + } + + [Theory] + [InlineData(null)] + [InlineData("")] + [InlineData(" \t")] + public void SplitEmptyStringsIntoEmptyLists(string? target) + { + Assert.Empty(target!.SplitByChar(',')); + } + + [Fact] + public void SplitWithoutEmptyEntriesWhilePreservingWhitespaceAndDuplicates() + { + Assert.Equal(["first", " second", "first"], "first,, second,first,".SplitByChar(',')); + } + + [Fact] + public void ReadStringExtensionValue() + { + var extensions = new Dictionary + { + ["x-value"] = new JsonNodeExtension("value") + }; + + Assert.Equal("value", extensions.GetExtension("x-value")); + } + + [Fact] + public void ReturnEmptyStringForMissingExtension() + { + var extensions = new Dictionary + { + ["x-value"] = new JsonNodeExtension("value") + }; + + Assert.Equal(string.Empty, extensions.GetExtension("x-missing")); + } + + [Fact] + public void ReturnEmptyStringForNonJsonExtension() + { + var extensions = new Dictionary + { + ["x-value"] = Mock.Of() + }; + + Assert.Equal(string.Empty, extensions.GetExtension("x-value")); + } + + [Theory] + [InlineData("{}")] + [InlineData("[]")] + [InlineData("42")] + [InlineData("true")] + public void ReturnEmptyStringForNonStringJsonExtension(string json) + { + var extensions = new Dictionary + { + ["x-value"] = new JsonNodeExtension(JsonNode.Parse(json)!) + }; + + Assert.Equal(string.Empty, extensions.GetExtension("x-value")); + } + } +} diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Services/TransformFilterTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/TransformFilterTests.cs new file mode 100644 index 000000000..cc239b4ce --- /dev/null +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/TransformFilterTests.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System.Text.Json; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.OpenApi.Hidi.Options; +using Xunit; + +namespace Microsoft.OpenApi.Hidi.Tests +{ + public sealed class TransformFilterTests : IDisposable + { + private readonly string _directory = Path.Join(Path.GetTempPath(), $"hidi-transform-filters-{Guid.NewGuid():N}"); + private readonly string _inputPath; + private readonly string _outputPath; + private readonly string _collectionPath; + + public TransformFilterTests() + { + Directory.CreateDirectory(_directory); + _inputPath = Path.Join(_directory, "input.yaml"); + _outputPath = Path.Join(_directory, "output.json"); + _collectionPath = Path.Join(_directory, "collection.json"); + File.WriteAllText(_inputPath, """ + openapi: 3.0.0 + info: + title: Filter test + version: 1.0.0 + servers: + - url: https://example.org + tags: + - name: users + - name: groups + paths: + /users: + get: + operationId: listUsers + tags: [users] + responses: + '200': + description: OK + post: + operationId: createUser + tags: [users] + responses: + '201': + description: Created + /groups: + get: + operationId: listGroups + tags: [groups] + responses: + '200': + description: OK + """); + } + + [Theory] + [InlineData("listUsers", null, false)] + [InlineData(null, "users", true)] + public async Task TransformFiltersPathsAndOperationsAsync(string? operationIds, string? tags, bool includePost) + { + var options = CreateOptions(); + options.FilterOptions.FilterByOperationIds = operationIds; + options.FilterOptions.FilterByTags = tags; + + await OpenApiService.TransformOpenApiDocumentAsync(options, NullLogger.Instance, TestContext.Current.CancellationToken); + + using var document = JsonDocument.Parse(await File.ReadAllTextAsync(_outputPath, TestContext.Current.CancellationToken)); + var path = Assert.Single(document.RootElement.GetProperty("paths").EnumerateObject()); + Assert.Equal("/users", path.Name); + Assert.Equal("listUsers", path.Value.GetProperty("get").GetProperty("operationId").GetString()); + Assert.Equal(includePost, path.Value.TryGetProperty("post", out _)); + Assert.Equal(includePost ? 2 : 1, path.Value.EnumerateObject().Count()); + if (includePost) + { + Assert.Equal("createUser", path.Value.GetProperty("post").GetProperty("operationId").GetString()); + } + } + + [Fact] + public async Task RejectCombiningOperationIdsAndTagsAsync() + { + var options = CreateOptions(); + options.FilterOptions.FilterByOperationIds = "listUsers"; + options.FilterOptions.FilterByTags = "users"; + + var exception = await Assert.ThrowsAsync(() => + OpenApiService.TransformOpenApiDocumentAsync(options, NullLogger.Instance, TestContext.Current.CancellationToken)); + + Assert.Contains("Cannot filter by operationIds and tags at the same time.", exception.Message, StringComparison.Ordinal); + Assert.False(File.Exists(_outputPath)); + } + + [Fact] + public async Task TransformSelectsOnlyPostmanCollectionOperationsAsync() + { + await File.WriteAllTextAsync(_collectionPath, """ + { + "item": [ + { + "request": { + "method": "GET", + "url": { "raw": "https://example.org/groups" } + } + } + ] + } + """, TestContext.Current.CancellationToken); + var options = CreateOptions(); + options.FilterOptions.FilterByCollection = _collectionPath; + + await OpenApiService.TransformOpenApiDocumentAsync(options, NullLogger.Instance, TestContext.Current.CancellationToken); + + using var document = JsonDocument.Parse(await File.ReadAllTextAsync(_outputPath, TestContext.Current.CancellationToken)); + var path = Assert.Single(document.RootElement.GetProperty("paths").EnumerateObject()); + Assert.Equal("/groups", path.Name); + var operation = Assert.Single(path.Value.EnumerateObject()); + Assert.Equal("get", operation.Name); + Assert.Equal("listGroups", operation.Value.GetProperty("operationId").GetString()); + } + + private HidiOptions CreateOptions() + { + return new HidiOptions + { + OpenApi = _inputPath, + Output = new FileInfo(_outputPath), + OpenApiFormat = OpenApiConstants.Json, + Version = "3.0" + }; + } + + public void Dispose() + { + File.Delete(_outputPath); + File.Delete(_collectionPath); + File.Delete(_inputPath); + Directory.Delete(_directory); + } + } +} From 82cae10897c3ab7e268e9bdc20a3cc75b93271bd Mon Sep 17 00:00:00 2001 From: "Gavin Barron (from Dev Box)" Date: Fri, 9 Oct 2026 07:40:14 -0700 Subject: [PATCH 750/752] fix(hidi): hand off Docker context through pipeline artifacts Replace forbidden release-job checkout with a build-produced context containing only required source and public signing inputs. Keep stable and preview publishing disabled. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c631d217-9378-4cee-8c7e-761043ff3ae5 --- .azure-pipelines/hidi-release.yml | 60 +++++++++++++++++++++++++++- src/Microsoft.OpenApi.Hidi/readme.md | 6 +++ 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/hidi-release.yml b/.azure-pipelines/hidi-release.yml index 5f4879157..816b3e0e1 100644 --- a/.azure-pipelines/hidi-release.yml +++ b/.azure-pipelines/hidi-release.yml @@ -44,6 +44,9 @@ extends: - output: pipelineArtifact artifactName: Hidi targetPath: '$(Build.ArtifactStagingDirectory)\hidi' + - output: pipelineArtifact + artifactName: HidiDockerContext + targetPath: '$(Build.ArtifactStagingDirectory)\hidi-docker-context' steps: - task: UseDotNet@2 displayName: Use .NET 6 for ESRP @@ -74,6 +77,49 @@ extends: "@ | Set-Content -Path "$(Build.SourcesDirectory)/nuget.config" -Encoding UTF8 displayName: Create nuget.config (central feed) + - pwsh: | + $ErrorActionPreference = 'Stop' + $sourceRoot = '$(Build.SourcesDirectory)' + $context = Join-Path '$(Build.ArtifactStagingDirectory)' 'hidi-docker-context' + New-Item -ItemType Directory -Path $context | Out-Null + $rootFiles = @('Dockerfile', '.dockerignore', 'Directory.Build.props', 'Build.props', 'build.root', 'global.json', 'README.md', 'src/Build.props') + foreach ($relativePath in $rootFiles) { + $destination = Join-Path $context $relativePath + New-Item -ItemType Directory -Force (Split-Path $destination -Parent) | Out-Null + Copy-Item -LiteralPath (Join-Path $sourceRoot $relativePath) -Destination $destination + } + foreach ($sourceDirectory in @('src/Microsoft.OpenApi.Hidi', 'src/Microsoft.OpenApi.OData.Reader')) { + $directory = Join-Path $sourceRoot $sourceDirectory + foreach ($file in Get-ChildItem -LiteralPath $directory -File -Recurse -Force) { + $relativePath = [IO.Path]::GetRelativePath($sourceRoot, $file.FullName) + if ($relativePath -match '(^|[\\/])(bin|obj|\.git)([\\/]|$)' -or $file.Extension -in @('.snk', '.pfx', '.p12', '.pem', '.key')) { continue } + if ($file.Attributes -band [IO.FileAttributes]::ReparsePoint) { throw "Unexpected linked Docker context file: $relativePath" } + $destination = Join-Path $context $relativePath + New-Item -ItemType Directory -Force (Split-Path $destination -Parent) | Out-Null + Copy-Item -LiteralPath $file.FullName -Destination $destination + } + } + foreach ($keyName in @('Microsoft.OpenApi.Hidi.public.snk', 'Microsoft.OpenApi.OData.public.snk')) { + $keyPath = Join-Path $sourceRoot 'tool' $keyName + $key = [IO.File]::ReadAllBytes($keyPath) + if ($key.Length -ne 160 -or $key[12] -ne 6 -or [Text.Encoding]::ASCII.GetString($key, 20, 4) -ne 'RSA1') { + throw "Expected the public-only strong-name identity: $keyName" + } + New-Item -ItemType Directory -Force (Join-Path $context 'tool') | Out-Null + Copy-Item -LiteralPath $keyPath -Destination (Join-Path $context 'tool' $keyName) + } + $keys = @(Get-ChildItem -LiteralPath $context -File -Recurse -Force -Filter '*.snk') + if ($keys.Count -ne 2) { throw "Expected exactly two public-only signing keys in the Docker context." } + foreach ($file in Get-ChildItem -LiteralPath $context -File -Recurse -Force) { + $relativePath = [IO.Path]::GetRelativePath($context, $file.FullName) + if ($relativePath -match '(^|[\\/])(bin|obj|\.git)([\\/]|$)' -or $file.Extension -in @('.pfx', '.p12', '.pem', '.key')) { + throw "Forbidden Docker context file: $relativePath" + } + if ($file.Extension -eq '.snk' -and $relativePath -notmatch '^tool[\\/]Microsoft\.OpenApi\.(Hidi|OData)\.public\.snk$') { + throw "Unexpected Docker signing key: $relativePath" + } + } + displayName: Stage public-only hidi Docker context - pwsh: | $version = ([xml](Get-Content src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj)).Project.PropertyGroup.Version if ($version -notmatch '^3\.\d+\.\d+(-[0-9A-Za-z.-]+)?$') { throw "Expected a hidi 3.x version, got $version." } @@ -222,6 +268,10 @@ extends: templateContext: type: releaseJob isProduction: true + inputs: + - input: pipelineArtifact + artifactName: HidiDockerContext + targetPath: '$(Pipeline.Workspace)/hidi-docker-context' environment: hidi-container strategy: runOnce: @@ -229,19 +279,20 @@ extends: pool: vmImage: ubuntu-latest steps: - - checkout: self - pwsh: | $version = ([xml](Get-Content src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj)).Project.PropertyGroup.Version if ('$(Build.SourceBranch)' -ne "refs/tags/hidi-v$version") { throw "Hidi tag does not match project version." } if ([version]($version -split '-')[0] -le [version]'3.10.2') { throw "Do not republish the migration baseline or an older hidi version." } Write-Host "##vso[task.setvariable variable=HidiReleaseVersion]$version" displayName: Read independent hidi version + workingDirectory: '$(Pipeline.Workspace)/hidi-docker-context' - task: AzureCLI@2 displayName: Publish multi-platform hidi image inputs: azureSubscription: ACR Images Push Service Connection scriptType: bash scriptLocation: inlineScript + workingDirectory: '$(Pipeline.Workspace)/hidi-docker-context' inlineScript: | set -euo pipefail az acr login --name msgraphprodregistry @@ -259,6 +310,10 @@ extends: templateContext: type: releaseJob isProduction: true + inputs: + - input: pipelineArtifact + artifactName: HidiDockerContext + targetPath: '$(Pipeline.Workspace)/hidi-docker-context' environment: hidi-container strategy: runOnce: @@ -266,19 +321,20 @@ extends: pool: vmImage: ubuntu-latest steps: - - checkout: self - pwsh: | $version = ([xml](Get-Content src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj)).Project.PropertyGroup.Version if ($version -notmatch '^3\.\d+\.\d+$') { throw "Expected a stable hidi 3.x base version." } $previewVersion = "$version.$([DateTime]::UtcNow.ToString('yyyyMMdd'))$(Build.BuildId)" Write-Host "##vso[task.setvariable variable=HidiPreviewVersion]$previewVersion" displayName: Compute independent hidi preview tag + workingDirectory: '$(Pipeline.Workspace)/hidi-docker-context' - task: AzureCLI@2 displayName: Publish multi-platform hidi preview image inputs: azureSubscription: ACR Images Push Service Connection scriptType: bash scriptLocation: inlineScript + workingDirectory: '$(Pipeline.Workspace)/hidi-docker-context' inlineScript: | set -euo pipefail az acr login --name msgraphprodregistry diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md index 54f0121c2..aa7772df0 100644 --- a/src/Microsoft.OpenApi.Hidi/readme.md +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -97,6 +97,12 @@ artifacts are signed in Azure Pipelines. Docker builds opt into key without changing normal OData signing. Private `.snk` resources are excluded from the Docker context and must not be copied into new Hidi resources. +The official build stages a separate `HidiDockerContext` artifact containing only +the Docker build inputs, Hidi/OData source projects and their two public keys, +without `bin`, `obj`, Git metadata or private signing resources. Stable and preview +container release jobs consume that same build artifact without checking out the +repository, as required by the 1ES release-job policy. + The migration baseline 3.10.2 is already published. Destination Hidi NuGet, GitHub release, stable Docker and preview Docker publishing are disabled until source cutover. The first destination stable release must advance the Hidi From e9ac0b6da5fb1e3ac97d25b7498b01e4c6811c16 Mon Sep 17 00:00:00 2001 From: "Gavin Barron (from Dev Box)" Date: Fri, 9 Oct 2026 07:42:58 -0700 Subject: [PATCH 751/752] fix(hidi): reuse the protected container release environment Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c631d217-9378-4cee-8c7e-761043ff3ae5 --- .azure-pipelines/hidi-release.yml | 4 ++-- src/Microsoft.OpenApi.Hidi/readme.md | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.azure-pipelines/hidi-release.yml b/.azure-pipelines/hidi-release.yml index 816b3e0e1..afc412571 100644 --- a/.azure-pipelines/hidi-release.yml +++ b/.azure-pipelines/hidi-release.yml @@ -272,7 +272,7 @@ extends: - input: pipelineArtifact artifactName: HidiDockerContext targetPath: '$(Pipeline.Workspace)/hidi-docker-context' - environment: hidi-container + environment: docker-images-deploy strategy: runOnce: deploy: @@ -314,7 +314,7 @@ extends: - input: pipelineArtifact artifactName: HidiDockerContext targetPath: '$(Pipeline.Workspace)/hidi-docker-context' - environment: hidi-container + environment: docker-images-deploy strategy: runOnce: deploy: diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md index aa7772df0..8da20507f 100644 --- a/src/Microsoft.OpenApi.Hidi/readme.md +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -102,6 +102,9 @@ the Docker build inputs, Hidi/OData source projects and their two public keys, without `bin`, `obj`, Git metadata or private signing resources. Stable and preview container release jobs consume that same build artifact without checking out the repository, as required by the 1ES release-job policy. +Container jobs retain the source publisher's existing `docker-images-deploy` +environment and its approvals/checks. The destination pipeline must be authorized +for that protected environment before official publishing can be enabled. The migration baseline 3.10.2 is already published. Destination Hidi NuGet, GitHub release, stable Docker and preview Docker publishing are disabled until From a263805e83daa587791a6899db083d50045ae88e Mon Sep 17 00:00:00 2001 From: "Gavin Barron (from Dev Box)" Date: Fri, 9 Oct 2026 07:58:42 -0700 Subject: [PATCH 752/752] fix(hidi): port v2 review updates to main migration Carry remaining command and utility regression coverage, scoped OData signing, mixed-runner rationale, and artifact exclusions to main. Preserve main 3.x dependencies, OpenAPI 3.2 behavior, shared imported commits and disabled publishing. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: c631d217-9378-4cee-8c7e-761043ff3ae5 --- .azure-pipelines/ci-build.yml | 6 +- .azure-pipelines/hidi-release.yml | 4 +- src/Microsoft.OpenApi.Hidi/readme.md | 5 +- .../CommandHandlerRegressionTests.cs | 81 +++++++++++++++++++ .../Extensions/ExtensionTests.cs | 1 + .../OpenApiSpecVersionHelperTests.cs | 16 ++-- .../StatsVisitorTests.cs | 16 +++- .../Utilities/SettingsUtilitiesTests.cs | 22 +++-- 8 files changed, 130 insertions(+), 21 deletions(-) create mode 100644 test/Microsoft.OpenApi.Hidi.Tests/CommandHandlerRegressionTests.cs diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 347cd58e9..9521826fe 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -99,7 +99,8 @@ extends: projects: '$(Build.SourcesDirectory)\Microsoft.OpenApi.OData.sln' arguments: '--configuration $(BuildConfiguration) --no-incremental' - # Run the Unit test + # Both suites are in the solution, but SDK10 cannot run MTP via VSTest. + # Keep OData on VSTest and invoke the hidi MTP executable separately (#885). - task: DotNetCoreCLI@2 displayName: 'test' inputs: @@ -116,7 +117,8 @@ extends: displayName: 'ESRP CodeSigning' inputs: ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' - FolderPath: 'src' + FolderPath: 'bin\$(BuildConfiguration)' + Pattern: 'Microsoft.OpenApi.OData.Reader.dll' AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' AppRegistrationTenantId: 'cdc5aeea-15c5-4db6-b079-fcadd2505dc2' AuthAKVName: 'akv-prod-eastus' diff --git a/.azure-pipelines/hidi-release.yml b/.azure-pipelines/hidi-release.yml index afc412571..0d16e78c6 100644 --- a/.azure-pipelines/hidi-release.yml +++ b/.azure-pipelines/hidi-release.yml @@ -92,7 +92,7 @@ extends: $directory = Join-Path $sourceRoot $sourceDirectory foreach ($file in Get-ChildItem -LiteralPath $directory -File -Recurse -Force) { $relativePath = [IO.Path]::GetRelativePath($sourceRoot, $file.FullName) - if ($relativePath -match '(^|[\\/])(bin|obj|\.git)([\\/]|$)' -or $file.Extension -in @('.snk', '.pfx', '.p12', '.pem', '.key')) { continue } + if ($relativePath -match '(^|[\\/])(bin|obj|\.git|artifacts)([\\/]|$)' -or $file.Extension -in @('.snk', '.pfx', '.p12', '.pem', '.key')) { continue } if ($file.Attributes -band [IO.FileAttributes]::ReparsePoint) { throw "Unexpected linked Docker context file: $relativePath" } $destination = Join-Path $context $relativePath New-Item -ItemType Directory -Force (Split-Path $destination -Parent) | Out-Null @@ -112,7 +112,7 @@ extends: if ($keys.Count -ne 2) { throw "Expected exactly two public-only signing keys in the Docker context." } foreach ($file in Get-ChildItem -LiteralPath $context -File -Recurse -Force) { $relativePath = [IO.Path]::GetRelativePath($context, $file.FullName) - if ($relativePath -match '(^|[\\/])(bin|obj|\.git)([\\/]|$)' -or $file.Extension -in @('.pfx', '.p12', '.pem', '.key')) { + if ($relativePath -match '(^|[\\/])(bin|obj|\.git|artifacts)([\\/]|$)' -or $file.Extension -in @('.pfx', '.p12', '.pem', '.key')) { throw "Forbidden Docker context file: $relativePath" } if ($file.Extension -eq '.snk' -and $relativePath -notmatch '^tool[\\/]Microsoft\.OpenApi\.(Hidi|OData)\.public\.snk$') { diff --git a/src/Microsoft.OpenApi.Hidi/readme.md b/src/Microsoft.OpenApi.Hidi/readme.md index 8da20507f..da02c05ef 100644 --- a/src/Microsoft.OpenApi.Hidi/readme.md +++ b/src/Microsoft.OpenApi.Hidi/readme.md @@ -60,6 +60,9 @@ The Hidi-only `testconfig.json` explicitly includes the Hidi assembly and exclud test/generated code. This authoritative configuration prevents Coverlet's dynamic namespace exclusions from excluding `Microsoft.OpenApi.Hidi` itself. The Sonar workflow requires an OpenCover report with covered Hidi sequence points. +Repository-wide MTP migration is tracked separately in +[#885](https://github.com/microsoft/OpenAPI.NET.OData/issues/885); this migration +does not change the existing OData test platform. ### Windows executable @@ -99,7 +102,7 @@ from the Docker context and must not be copied into new Hidi resources. The official build stages a separate `HidiDockerContext` artifact containing only the Docker build inputs, Hidi/OData source projects and their two public keys, -without `bin`, `obj`, Git metadata or private signing resources. Stable and preview +without `bin`, `obj`, `artifacts`, Git metadata or private signing resources. Stable and preview container release jobs consume that same build artifact without checking out the repository, as required by the 1ES release-job policy. Container jobs retain the source publisher's existing `docker-images-deploy` diff --git a/test/Microsoft.OpenApi.Hidi.Tests/CommandHandlerRegressionTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/CommandHandlerRegressionTests.cs new file mode 100644 index 000000000..917ba6fb2 --- /dev/null +++ b/test/Microsoft.OpenApi.Hidi.Tests/CommandHandlerRegressionTests.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT license. + +using System.CommandLine; +using System.CommandLine.Invocation; +using Xunit; + +namespace Microsoft.OpenApi.Hidi.Tests +{ + public sealed class CommandHandlerRegressionTests + { + [Theory] + [InlineData("SampleOpenApi.yml", 0)] + [InlineData("InvalidSampleOpenApi.yml", -1)] + public async Task ValidateCommandReturnsDocumentValidationResult(string fixture, int expected) + { + var root = Program.CreateRootCommand(); + var command = root.Subcommands.Single(c => c.Name == "validate"); + var input = Path.Combine(AppContext.BaseDirectory, "UtilityFiles", fixture); + var result = root.Parse(new[] { "validate", "--openapi", input }); + Assert.Empty(result.Errors); + var action = Assert.IsType(command.Action, exactMatch: false); + + Assert.Equal(expected, await action.InvokeAsync(result, TestContext.Current.CancellationToken)); + } + + [Fact] + public async Task ValidateCommandReturnsCancellationWithoutReportingInvalidDocument() + { + var root = Program.CreateRootCommand(); + var command = root.Subcommands.Single(c => c.Name == "validate"); + var input = Path.Combine(AppContext.BaseDirectory, "UtilityFiles", "SampleOpenApi.yml"); + var result = root.Parse(new[] { "validate", "--openapi", input }); + Assert.Empty(result.Errors); + var action = Assert.IsType(command.Action, exactMatch: false); + using var cancellation = new CancellationTokenSource(); + await cancellation.CancelAsync(); + + Assert.Equal(0, await action.InvokeAsync(result, cancellation.Token)); + } + + [Theory] + [InlineData("validate")] + [InlineData("transform")] + [InlineData("show")] + [InlineData("plugin")] + public async Task CommandReportsMissingInputFiles(string name) + { + var root = Program.CreateRootCommand(); + var command = root.Subcommands.Single(c => c.Name == name); + var missing = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid():N}.yml"); + var option = name == "plugin" ? "--manifest" : "--openapi"; + var result = root.Parse(new[] { name, option, missing }); + Assert.Empty(result.Errors); + var action = Assert.IsType(command.Action, exactMatch: false); + +#if DEBUG + var error = await Assert.ThrowsAsync(() => action.InvokeAsync(result, TestContext.Current.CancellationToken)); + Assert.Contains("Could not", error.Message, StringComparison.Ordinal); +#else + Assert.Equal(1, await action.InvokeAsync(result, TestContext.Current.CancellationToken)); +#endif + } + + [Fact] + public async Task ValidateCommandRequiresAnOpenApiFile() + { + var root = Program.CreateRootCommand(); + var command = root.Subcommands.Single(c => c.Name == "validate"); + var result = root.Parse(["validate"]); + var action = Assert.IsType(command.Action, exactMatch: false); + +#if DEBUG + var error = await Assert.ThrowsAsync(() => action.InvokeAsync(result, TestContext.Current.CancellationToken)); + Assert.Equal("OpenApi file is required", error.Message); +#else + Assert.Equal(1, await action.InvokeAsync(result, TestContext.Current.CancellationToken)); +#endif + } + } +} diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Extensions/ExtensionTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Extensions/ExtensionTests.cs index 2f9d38e91..44f86af47 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Extensions/ExtensionTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Extensions/ExtensionTests.cs @@ -14,6 +14,7 @@ public class ExtensionTests [InlineData(null, null, true)] [InlineData("", " ", true)] [InlineData("\t", "value", false)] + [InlineData(null, "value", false)] [InlineData("Hidi", "HIDI", true)] [InlineData("Hidi", "different", false)] [InlineData("Hidi", null, false)] diff --git a/test/Microsoft.OpenApi.Hidi.Tests/OpenApiSpecVersionHelperTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/OpenApiSpecVersionHelperTests.cs index da7da8e7a..1f0879feb 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/OpenApiSpecVersionHelperTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/OpenApiSpecVersionHelperTests.cs @@ -9,8 +9,10 @@ public class OpenApiSpecVersionHelperTests { [Theory] [InlineData("2.0", OpenApiSpecVersion.OpenApi2_0)] + [InlineData("2.1", OpenApiSpecVersion.OpenApi2_0)] [InlineData("3.0", OpenApiSpecVersion.OpenApi3_0)] [InlineData("3.1", OpenApiSpecVersion.OpenApi3_1)] + [InlineData("3.1.1", OpenApiSpecVersion.OpenApi3_1)] [InlineData("3.2", OpenApiSpecVersion.OpenApi3_2)] [InlineData("4.0", OpenApiSpecVersion.OpenApi3_2)] public void TryParseOpenApiSpecVersionReturnsExpectedVersion(string version, OpenApiSpecVersion expectedVersion) @@ -21,11 +23,15 @@ public void TryParseOpenApiSpecVersionReturnsExpectedVersion(string version, Ope } [Theory] - [InlineData(null)] - [InlineData("")] - [InlineData("abc")] - public void TryParseOpenApiSpecVersionThrowsForInvalidValues(string? version) + [InlineData(null, "Please provide a version")] + [InlineData("", "Please provide a version")] + [InlineData("abc", "Invalid version format")] + [InlineData("invalid.0", "Invalid version format")] + [InlineData("3.invalid", "Invalid version format")] + public void TryParseOpenApiSpecVersionThrowsForInvalidValues(string? version, string expectedMessage) { - Assert.Throws(() => OpenApiSpecVersionHelper.TryParseOpenApiSpecVersion(version!)); + var error = Assert.Throws(() => OpenApiSpecVersionHelper.TryParseOpenApiSpecVersion(version!)); + + Assert.Contains(expectedMessage, error.Message, StringComparison.Ordinal); } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/StatsVisitorTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/StatsVisitorTests.cs index 763540269..18afdb193 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/StatsVisitorTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/StatsVisitorTests.cs @@ -103,8 +103,18 @@ public void GetStatisticsReportReflectsVisitedElements() Assert.Equal(1, visitor.LinkCount); Assert.Equal(1, visitor.CallbackCount); Assert.Equal(4, visitor.SchemaCount); - Assert.Contains("Path Items: 2", report, StringComparison.Ordinal); - Assert.Contains("Callbacks: 1", report, StringComparison.Ordinal); - Assert.Contains("Schemas: 4", report, StringComparison.Ordinal); + visitor.Visit(new Dictionary { ["x-rate-limit"] = new OpenApiHeader() }); + Assert.Equal(1, visitor.HeaderCount); + var expected = string.Join(Environment.NewLine, + [ + "Path Items: 2", "Operations: 2", "Parameters: 1", "Request Bodies: 1", + "Responses: 2", "Links: 1", "Callbacks: 1", "Schemas: 4", "" + ]); + Assert.Equal(expected, report); + + visitor.Visit((IOpenApiParameter)new OpenApiParameter()); + + Assert.Equal(2, visitor.ParameterCount); + Assert.Contains("Parameters: 2", visitor.GetStatisticsReport(), StringComparison.Ordinal); } } diff --git a/test/Microsoft.OpenApi.Hidi.Tests/Utilities/SettingsUtilitiesTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Utilities/SettingsUtilitiesTests.cs index aa31367ae..5e5eb21a2 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Utilities/SettingsUtilitiesTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Utilities/SettingsUtilitiesTests.cs @@ -15,30 +15,36 @@ public void GetOpenApiConvertSettingsThrowsWhenConfigurationIsNull() Assert.Throws(() => SettingsUtilities.GetOpenApiConvertSettings(null!, null)); } - [Fact] - public void GetOpenApiConvertSettingsUsesMetadataVersionWhenSectionIsMissing() + [Theory] + [InlineData(null)] + [InlineData("")] + [InlineData("2.1")] + public void GetOpenApiConvertSettingsUsesMetadataVersionWhenSectionIsMissing(string? metadataVersion) { var configuration = new ConfigurationBuilder().AddInMemoryCollection(new Dictionary()).Build(); - var settings = SettingsUtilities.GetOpenApiConvertSettings(configuration, "2.1"); + var settings = SettingsUtilities.GetOpenApiConvertSettings(configuration, metadataVersion); - Assert.Equal("2.1", settings.SemVerVersion); + var expected = string.IsNullOrEmpty(metadataVersion) ? new OpenApiConvertSettings().SemVerVersion : metadataVersion; + Assert.Equal(expected, settings.SemVerVersion); } - [Fact] - public void GetOpenApiConvertSettingsBindsConfiguredValuesOverMetadataVersion() + [Theory] + [InlineData(true)] + [InlineData(false)] + public void GetOpenApiConvertSettingsBindsConfiguredValuesOverMetadataVersion(bool enablePagination) { var configuration = new ConfigurationBuilder() .AddInMemoryCollection(new Dictionary { [$"{nameof(OpenApiConvertSettings)}:{nameof(OpenApiConvertSettings.SemVerVersion)}"] = "3.0", - [$"{nameof(OpenApiConvertSettings)}:{nameof(OpenApiConvertSettings.EnablePagination)}"] = bool.TrueString + [$"{nameof(OpenApiConvertSettings)}:{nameof(OpenApiConvertSettings.EnablePagination)}"] = enablePagination.ToString() }) .Build(); var settings = SettingsUtilities.GetOpenApiConvertSettings(configuration, "2.1"); Assert.Equal("3.0", settings.SemVerVersion); - Assert.True(settings.EnablePagination); + Assert.Equal(enablePagination, settings.EnablePagination); } }