diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 8a2e7ef18..77e92b36a 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -79,6 +79,7 @@ extends: arguments: '--configuration $(BuildConfiguration) --no-build' - task: EsrpCodeSigning@5 + displayName: 'ESRP CodeSigning binaries' inputs: ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' @@ -87,8 +88,6 @@ extends: AuthCertName: 'ReferenceLibraryPrivateCert' AuthSignCertName: 'ReferencePackagePublisherCertificate' FolderPath: '$(Build.SourcesDirectory)\src' - Pattern: '*.dll' - UseMinimatch: true signConfigType: 'inlineSignParams' inlineOperation: | [ @@ -146,6 +145,7 @@ extends: displayName: 'pack Hidi' - task: EsrpCodeSigning@5 + displayName: 'ESRP CodeSigning Nuget Packages' inputs: ConnectedServiceName: 'Federated DevX ESRP Managed Identity Connection' AppRegistrationClientId: '65035b7f-7357-4f29-bf25-c5ee5c3949f8' diff --git a/Microsoft.OpenApi.sln b/Microsoft.OpenApi.sln index 67f3f0e17..a39756a42 100644 --- a/Microsoft.OpenApi.sln +++ b/Microsoft.OpenApi.sln @@ -24,8 +24,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E546B92F-20A EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{6357D7FD-2DE4-4900-ADB9-ABC37052040A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.SmokeTests", "test\Microsoft.OpenApi.SmokeTests\Microsoft.OpenApi.SmokeTests.csproj", "{AD79B61D-88CF-497C-9ED5-41AE3867C5AC}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.OpenApi.Hidi", "src\Microsoft.OpenApi.Hidi\Microsoft.OpenApi.Hidi.csproj", "{254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.OpenApi.Hidi.Tests", "test\Microsoft.OpenApi.Hidi.Tests\Microsoft.OpenApi.Hidi.Tests.csproj", "{D8F799DD-04AC-4A13-B344-45A5B944450A}" @@ -58,10 +56,6 @@ Global {1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237}.Debug|Any CPU.Build.0 = Debug|Any CPU {1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237}.Release|Any CPU.ActiveCfg = Release|Any CPU {1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237}.Release|Any CPU.Build.0 = Release|Any CPU - {AD79B61D-88CF-497C-9ED5-41AE3867C5AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AD79B61D-88CF-497C-9ED5-41AE3867C5AC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AD79B61D-88CF-497C-9ED5-41AE3867C5AC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AD79B61D-88CF-497C-9ED5-41AE3867C5AC}.Release|Any CPU.Build.0 = Release|Any CPU {254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}.Debug|Any CPU.Build.0 = Debug|Any CPU {254841B5-7DAC-4D1D-A9C5-44FE5CE467BE}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -84,7 +78,6 @@ Global {79933258-0126-4382-8755-D50820ECC483} = {E546B92F-20A8-49C3-8323-4B25BB78F3E1} {AD83F991-DBF3-4251-8613-9CC54C826964} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A} {1ED3C2C1-E1E7-4925-B4E6-2D969C3F5237} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A} - {AD79B61D-88CF-497C-9ED5-41AE3867C5AC} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A} {254841B5-7DAC-4D1D-A9C5-44FE5CE467BE} = {E546B92F-20A8-49C3-8323-4B25BB78F3E1} {D8F799DD-04AC-4A13-B344-45A5B944450A} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A} {1D2E0C6E-B103-4CB6-912E-D56FA1501296} = {6357D7FD-2DE4-4900-ADB9-ABC37052040A} 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..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 @@ -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(" /// /// + [Obsolete("Use the Async overload")] + [EditorBrowsable(EditorBrowsableState.Never)] Stream Load(Uri uri); } } diff --git a/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj b/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj index b75e7009c..0a517bbce 100644 --- a/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj +++ b/src/Microsoft.OpenApi.Readers/Microsoft.OpenApi.Readers.csproj @@ -3,7 +3,7 @@ netstandard2.0 latest true - 1.6.18 + 1.6.19 OpenAPI.NET Readers for JSON and YAML documents true @@ -18,6 +18,7 @@ + diff --git a/src/Microsoft.OpenApi.Readers/OpenApiYamlDocumentReader.cs b/src/Microsoft.OpenApi.Readers/OpenApiYamlDocumentReader.cs index 1e1973d37..af9ebcad1 100644 --- a/src/Microsoft.OpenApi.Readers/OpenApiYamlDocumentReader.cs +++ b/src/Microsoft.OpenApi.Readers/OpenApiYamlDocumentReader.cs @@ -102,7 +102,7 @@ public async Task ReadAsync(YamlDocument input, CancellationToken ca if (_settings.LoadExternalRefs) { - var diagnosticExternalRefs = await LoadExternalRefs(document, cancellationToken); + var diagnosticExternalRefs = await LoadExternalRefsAsync(document, cancellationToken); // Merge diagnostics of external reference if (diagnosticExternalRefs != null) { @@ -139,7 +139,7 @@ public async Task ReadAsync(YamlDocument input, CancellationToken ca }; } - private Task LoadExternalRefs(OpenApiDocument document, CancellationToken cancellationToken = default) + private Task LoadExternalRefsAsync(OpenApiDocument document, CancellationToken cancellationToken = default) { // Create workspace for all documents to live in. var openApiWorkSpace = new OpenApiWorkspace(); diff --git a/src/Microsoft.OpenApi.Readers/Services/DefaultStreamLoader.cs b/src/Microsoft.OpenApi.Readers/Services/DefaultStreamLoader.cs index 5ef282156..3c7fd8d8a 100644 --- a/src/Microsoft.OpenApi.Readers/Services/DefaultStreamLoader.cs +++ b/src/Microsoft.OpenApi.Readers/Services/DefaultStreamLoader.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. using System; +using System.ComponentModel; using System.IO; using System.Net.Http; using System.Threading.Tasks; @@ -22,19 +23,13 @@ public DefaultStreamLoader(Uri baseUrl) this.baseUrl = baseUrl; } + [Obsolete] + [EditorBrowsable(EditorBrowsableState.Never)] public Stream Load(Uri uri) { - var absoluteUri = new Uri(baseUrl, uri); - switch (uri.Scheme) - { - case "file": - return File.OpenRead(absoluteUri.AbsolutePath); - case "http": - case "https": - return _httpClient.GetStreamAsync(absoluteUri).GetAwaiter().GetResult(); - default: - throw new ArgumentException("Unsupported scheme"); - } +#pragma warning disable VSTHRD002 // Avoid problematic synchronous waits + return LoadAsync(uri).GetAwaiter().GetResult(); +#pragma warning restore VSTHRD002 // Avoid problematic synchronous waits } public async Task LoadAsync(Uri uri) diff --git a/src/Microsoft.OpenApi.Workbench/MainModel.cs b/src/Microsoft.OpenApi.Workbench/MainModel.cs index 52a34df81..7068a61e8 100644 --- a/src/Microsoft.OpenApi.Workbench/MainModel.cs +++ b/src/Microsoft.OpenApi.Workbench/MainModel.cs @@ -201,7 +201,7 @@ protected void OnPropertyChanged(string propertyName) /// The core method of the class. /// Runs the parsing and serializing. /// - internal async Task ParseDocument() + internal async Task ParseDocumentAsync() { Stream stream = null; try @@ -291,7 +291,7 @@ internal async Task ParseDocument() if (stream != null) { stream.Close(); - stream.Dispose(); + await stream.DisposeAsync(); } } diff --git a/src/Microsoft.OpenApi.Workbench/MainWindow.xaml.cs b/src/Microsoft.OpenApi.Workbench/MainWindow.xaml.cs index 5f3c3ec38..f9f1773c7 100644 --- a/src/Microsoft.OpenApi.Workbench/MainWindow.xaml.cs +++ b/src/Microsoft.OpenApi.Workbench/MainWindow.xaml.cs @@ -19,11 +19,13 @@ public MainWindow() DataContext = _mainModel; } +#pragma warning disable VSTHRD100 // Avoid async void methods private async void Button_Click(object sender, RoutedEventArgs e) +#pragma warning restore VSTHRD100 // Avoid async void methods { try { - await _mainModel.ParseDocument(); + await _mainModel.ParseDocumentAsync(); } catch (Exception ex) { _mainModel.Errors = ex.Message; diff --git a/src/Microsoft.OpenApi.Workbench/Microsoft.OpenApi.Workbench.csproj b/src/Microsoft.OpenApi.Workbench/Microsoft.OpenApi.Workbench.csproj index 301066766..4379c7595 100644 --- a/src/Microsoft.OpenApi.Workbench/Microsoft.OpenApi.Workbench.csproj +++ b/src/Microsoft.OpenApi.Workbench/Microsoft.OpenApi.Workbench.csproj @@ -8,6 +8,7 @@ true + diff --git a/src/Microsoft.OpenApi/Extensions/EnumExtensions.cs b/src/Microsoft.OpenApi/Extensions/EnumExtensions.cs index 1eadaa5f4..bc4e86783 100644 --- a/src/Microsoft.OpenApi/Extensions/EnumExtensions.cs +++ b/src/Microsoft.OpenApi/Extensions/EnumExtensions.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. using System; +using System.Collections.Concurrent; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; @@ -14,6 +15,9 @@ namespace Microsoft.OpenApi.Extensions /// public static class EnumExtensions { + // Cache to store display names of enum values + private static readonly ConcurrentDictionary DisplayNameCache = new(); + /// /// Gets an attribute on an enum field value. /// @@ -26,7 +30,13 @@ public static class EnumExtensions public static T GetAttributeOfType(this Enum enumValue) where T : Attribute { var type = enumValue.GetType(); + // Use GetField to get the field info for the enum value var memInfo = type.GetField(enumValue.ToString(), BindingFlags.Public | BindingFlags.Static); + + if (memInfo == null) + return null; + + // Retrieve the custom attributes of type T var attributes = memInfo.GetCustomAttributes(false); return attributes.FirstOrDefault(); } @@ -36,13 +46,20 @@ public static T GetAttributeOfType(this Enum enumValue) where T : Attribute /// /// The enum value. /// - /// Use if exists. + /// Use if it exists. /// Otherwise, use the standard string representation. /// public static string GetDisplayName(this Enum enumValue) { - var attribute = enumValue.GetAttributeOfType(); - return attribute == null ? enumValue.ToString() : attribute.Name; + // Retrieve the display name from the cache if it exists + return DisplayNameCache.GetOrAdd(enumValue, e => + { + // Get the DisplayAttribute + var attribute = e.GetAttributeOfType(); + + // Return the DisplayAttribute name if it exists, otherwise return the enum's string representation + return attribute == null ? e.ToString() : attribute.Name; + }); } } } diff --git a/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj b/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj index 2a674f542..d889cc760 100644 --- a/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj +++ b/src/Microsoft.OpenApi/Microsoft.OpenApi.csproj @@ -3,7 +3,7 @@ netstandard2.0 Latest true - 1.6.18 + 1.6.19 .NET models with JSON and YAML writers for OpenAPI specification true @@ -35,4 +35,8 @@ + + + + diff --git a/src/Microsoft.OpenApi/Services/CopyReferences.cs b/src/Microsoft.OpenApi/Services/CopyReferences.cs index 757471466..73bb667b6 100644 --- a/src/Microsoft.OpenApi/Services/CopyReferences.cs +++ b/src/Microsoft.OpenApi/Services/CopyReferences.cs @@ -26,8 +26,8 @@ public override void Visit(IOpenApiReferenceable referenceable) switch (referenceable) { case OpenApiSchema schema: - EnsureComponentsExists(); - EnsureSchemasExists(); + EnsureComponentsExist(); + EnsureSchemasExist(); if (!Components.Schemas.ContainsKey(schema.Reference.Id)) { Components.Schemas.Add(schema.Reference.Id, schema); @@ -35,8 +35,8 @@ public override void Visit(IOpenApiReferenceable referenceable) break; case OpenApiParameter parameter: - EnsureComponentsExists(); - EnsureParametersExists(); + EnsureComponentsExist(); + EnsureParametersExist(); if (!Components.Parameters.ContainsKey(parameter.Reference.Id)) { Components.Parameters.Add(parameter.Reference.Id, parameter); @@ -44,8 +44,8 @@ public override void Visit(IOpenApiReferenceable referenceable) break; case OpenApiResponse response: - EnsureComponentsExists(); - EnsureResponsesExists(); + EnsureComponentsExist(); + EnsureResponsesExist(); if (!Components.Responses.ContainsKey(response.Reference.Id)) { Components.Responses.Add(response.Reference.Id, response); @@ -53,18 +53,64 @@ public override void Visit(IOpenApiReferenceable referenceable) break; case OpenApiRequestBody requestBody: - EnsureComponentsExists(); - EnsureResponsesExists(); - EnsurRequestBodiesExists(); + EnsureComponentsExist(); + EnsureResponsesExist(); + EnsureRequestBodiesExist(); if (!Components.RequestBodies.ContainsKey(requestBody.Reference.Id)) { Components.RequestBodies.Add(requestBody.Reference.Id, requestBody); } break; + case OpenApiExample example: + EnsureComponentsExist(); + EnsureExamplesExist(); + if (!Components.Examples.ContainsKey(example.Reference.Id)) + { + Components.Examples.Add(example.Reference.Id, example); + } + break; + + case OpenApiHeader header: + EnsureComponentsExist(); + EnsureHeadersExist(); + if (!Components.Headers.ContainsKey(header.Reference.Id)) + { + Components.Headers.Add(header.Reference.Id, header); + } + break; + + case OpenApiCallback callback: + EnsureComponentsExist(); + EnsureCallbacksExist(); + if (!Components.Callbacks.ContainsKey(callback.Reference.Id)) + { + Components.Callbacks.Add(callback.Reference.Id, callback); + } + break; + + case OpenApiLink link: + EnsureComponentsExist(); + EnsureLinksExist(); + if (!Components.Links.ContainsKey(link.Reference.Id)) + { + Components.Links.Add(link.Reference.Id, link); + } + break; + + case OpenApiSecurityScheme securityScheme: + EnsureComponentsExist(); + EnsureSecuritySchemesExist(); + if (!Components.SecuritySchemes.ContainsKey(securityScheme.Reference.Id)) + { + Components.SecuritySchemes.Add(securityScheme.Reference.Id, securityScheme); + } + break; + default: break; } + base.Visit(referenceable); } @@ -77,8 +123,8 @@ public override void Visit(OpenApiSchema schema) // This is needed to handle schemas used in Responses in components if (schema.Reference != null) { - EnsureComponentsExists(); - EnsureSchemasExists(); + EnsureComponentsExist(); + EnsureSchemasExist(); if (!Components.Schemas.ContainsKey(schema.Reference.Id)) { Components.Schemas.Add(schema.Reference.Id, schema); @@ -87,41 +133,54 @@ public override void Visit(OpenApiSchema schema) base.Visit(schema); } - private void EnsureComponentsExists() + private void EnsureComponentsExist() { - if (_target.Components == null) - { - _target.Components = new(); - } + _target.Components ??= new(); } - private void EnsureSchemasExists() + private void EnsureSchemasExist() { - if (_target.Components.Schemas == null) - { - _target.Components.Schemas = new Dictionary(); - } + _target.Components.Schemas ??= new Dictionary(); } - private void EnsureParametersExists() + private void EnsureParametersExist() { - if (_target.Components.Parameters == null) - { - _target.Components.Parameters = new Dictionary(); - } + _target.Components.Parameters ??= new Dictionary(); } - private void EnsureResponsesExists() + private void EnsureResponsesExist() { - if (_target.Components.Responses == null) - { - _target.Components.Responses = new Dictionary(); - } + _target.Components.Responses ??= new Dictionary(); } - private void EnsurRequestBodiesExists() + private void EnsureRequestBodiesExist() { _target.Components.RequestBodies ??= new Dictionary(); } + + private void EnsureExamplesExist() + { + _target.Components.Examples ??= new Dictionary(); + } + + private void EnsureHeadersExist() + { + _target.Components.Headers ??= new Dictionary(); + } + + private void EnsureCallbacksExist() + { + _target.Components.Callbacks ??= new Dictionary(); + } + + private void EnsureLinksExist() + { + _target.Components.Links ??= new Dictionary(); + } + + private void EnsureSecuritySchemesExist() + { + _target.Components.SecuritySchemes ??= new Dictionary(); + } } } diff --git a/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs b/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs index 92051949b..fcc2af0b2 100644 --- a/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs +++ b/src/Microsoft.OpenApi/Services/OpenApiFilterService.cs @@ -278,6 +278,42 @@ private static bool AddReferences(OpenApiComponents newComponents, OpenApiCompon moreStuff = true; target.RequestBodies.Add(item); } + + foreach (var item in newComponents.Headers + .Where(item => !target.Headers.ContainsKey(item.Key))) + { + moreStuff = true; + target.Headers.Add(item); + } + + foreach (var item in newComponents.Links + .Where(item => !target.Links.ContainsKey(item.Key))) + { + moreStuff = true; + target.Links.Add(item); + } + + foreach (var item in newComponents.Callbacks + .Where(item => !target.Callbacks.ContainsKey(item.Key))) + { + moreStuff = true; + target.Callbacks.Add(item); + } + + foreach (var item in newComponents.Examples + .Where(item => !target.Examples.ContainsKey(item.Key))) + { + moreStuff = true; + target.Examples.Add(item); + } + + foreach (var item in newComponents.SecuritySchemes + .Where(item => !target.SecuritySchemes.ContainsKey(item.Key))) + { + moreStuff = true; + target.SecuritySchemes.Add(item); + } + return moreStuff; } 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/Services/OpenApiServiceTests.cs b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs index e092a1c43..a7ab42c03 100644 --- a/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs +++ b/test/Microsoft.OpenApi.Hidi.Tests/Services/OpenApiServiceTests.cs @@ -27,14 +27,14 @@ public OpenApiServiceTests() } [Fact] - public async Task ReturnConvertedCSDLFile() + 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.ConvertCsdlToOpenApi(csdlStream); + var openApiDoc = await OpenApiService.ConvertCsdlToOpenApiAsync(csdlStream); var expectedPathCount = 5; // Assert @@ -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 ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocumentAsync(string? operationIds, string? tags, int expectedPathCount) { // Arrange var filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "UtilityFiles", "Todo.xml"); @@ -55,7 +55,7 @@ public async Task ReturnFilteredOpenApiDocBasedOnOperationIdsAndInputCsdlDocumen var csdlStream = fileInput.OpenRead(); // Act - var openApiDoc = await OpenApiService.ConvertCsdlToOpenApi(csdlStream); + var openApiDoc = await OpenApiService.ConvertCsdlToOpenApiAsync(csdlStream); var predicate = OpenApiFilterService.CreatePredicate(operationIds, tags); var subsetOpenApiDocument = OpenApiFilterService.CreateFilteredDocument(openApiDoc, predicate); @@ -170,7 +170,7 @@ public void ShowCommandGeneratesMermaidDiagramAsHtml() } [Fact] - public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() + public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagramAsync() { // create a dummy ILogger instance for testing var options = new HidiOptions @@ -179,25 +179,25 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileWithMermaidDiagram() Output = new("sample.md") }; - await OpenApiService.ShowOpenApiDocument(options, _logger); + await OpenApiService.ShowOpenApiDocumentAsync(options, _logger); var output = await File.ReadAllTextAsync(options.Output.FullName); Assert.Contains("graph LR", output, StringComparison.Ordinal); } [Fact] - public async Task ShowCommandGeneratesMermaidHtmlFileWithMermaidDiagram() + public async Task ShowCommandGeneratesMermaidHtmlFileWithMermaidDiagramAsync() { var options = new HidiOptions { OpenApi = Path.Combine("UtilityFiles", "SampleOpenApi.yml") }; - var filePath = await OpenApiService.ShowOpenApiDocument(options, _logger); + var filePath = await OpenApiService.ShowOpenApiDocumentAsync(options, _logger); Assert.True(File.Exists(filePath)); } [Fact] - public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiagram() + public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiagramAsync() { var options = new HidiOptions { @@ -207,70 +207,70 @@ public async Task ShowCommandGeneratesMermaidMarkdownFileFromCsdlWithMermaidDiag }; // create a dummy ILogger instance for testing - await OpenApiService.ShowOpenApiDocument(options, _logger); + await OpenApiService.ShowOpenApiDocumentAsync(options, _logger); var output = await File.ReadAllTextAsync(options.Output.FullName); Assert.Contains("graph LR", output, StringComparison.Ordinal); } [Fact] - public Task ThrowIfOpenApiUrlIsNotProvidedWhenValidating() + public Task ThrowIfOpenApiUrlIsNotProvidedWhenValidatingAsync() { return Assert.ThrowsAsync(() => - 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,31 +375,31 @@ 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); } [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); 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" + diff --git a/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiDiagnosticTests.cs b/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiDiagnosticTests.cs index 7f7c34b26..0977dbcd9 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiDiagnosticTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiDiagnosticTests.cs @@ -37,7 +37,7 @@ public void DetectedSpecificationVersionShouldBeV3_0() } [Fact] - public async Task DiagnosticReportMergedForExternalReference() + public async Task DiagnosticReportMergedForExternalReferenceAsync() { // Create a reader that will resolve all references var reader = new OpenApiStreamReader(new() diff --git a/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiStreamReaderTests.cs b/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiStreamReaderTests.cs index 7bb0fe922..1b2faa137 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiStreamReaderTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/OpenApiReaderTests/OpenApiStreamReaderTests.cs @@ -32,7 +32,7 @@ public void StreamShouldNotCloseIfLeaveStreamOpenSettingEqualsTrue() } [Fact] - public async Task StreamShouldNotBeDisposedIfLeaveStreamOpenSettingIsTrue() + public async Task StreamShouldNotBeDisposedIfLeaveStreamOpenSettingIsTrueAsync() { var memoryStream = new MemoryStream(); using var fileStream = Resources.GetStream(Path.Combine(SampleFolderPath, "petStore.yaml")); @@ -48,7 +48,7 @@ public async Task StreamShouldNotBeDisposedIfLeaveStreamOpenSettingIsTrue() } [Fact] - public async Task StreamShouldReadWhenInitialized() + public async Task StreamShouldReadWhenInitializedAsync() { var httpClient = new HttpClient { diff --git a/test/Microsoft.OpenApi.Readers.Tests/OpenApiWorkspaceTests/OpenApiWorkspaceStreamTests.cs b/test/Microsoft.OpenApi.Readers.Tests/OpenApiWorkspaceTests/OpenApiWorkspaceStreamTests.cs index e601e5dad..d72594620 100644 --- a/test/Microsoft.OpenApi.Readers.Tests/OpenApiWorkspaceTests/OpenApiWorkspaceStreamTests.cs +++ b/test/Microsoft.OpenApi.Readers.Tests/OpenApiWorkspaceTests/OpenApiWorkspaceStreamTests.cs @@ -10,12 +10,10 @@ namespace Microsoft.OpenApi.Readers.Tests.OpenApiWorkspaceTests { public class OpenApiWorkspaceStreamTests { - private const string SampleFolderPath = "V3Tests/Samples/OpenApiWorkspace/"; - // Use OpenApiWorkspace to load a document and a referenced document [Fact] - public async Task LoadingDocumentWithResolveAllReferencesShouldLoadDocumentIntoWorkspace() + public async Task LoadingDocumentWithResolveAllReferencesShouldLoadDocumentIntoWorkspaceAsync() { // Create a reader that will resolve all references var reader = new OpenApiStreamReader(new() @@ -35,8 +33,8 @@ public async Task LoadingDocumentWithResolveAllReferencesShouldLoadDocumentIntoW paths: {} """; var wr = new StreamWriter(stream); - wr.Write(doc); - wr.Flush(); + await wr.WriteAsync(doc); + await wr.FlushAsync(); stream.Position = 0; var result = await reader.ReadAsync(stream); @@ -45,7 +43,7 @@ public async Task LoadingDocumentWithResolveAllReferencesShouldLoadDocumentIntoW } [Fact] - public async Task LoadDocumentWithExternalReferenceShouldLoadBothDocumentsIntoWorkspace() + public async Task LoadDocumentWithExternalReferenceShouldLoadBothDocumentsIntoWorkspaceAsync() { // Create a reader that will resolve all references var reader = new OpenApiStreamReader(new() @@ -95,7 +93,7 @@ public Stream Load(Uri uri) public Task LoadAsync(Uri uri) { - return null; + return Task.FromResult(null); } } diff --git a/test/Microsoft.OpenApi.SmokeTests/ApiGurus.cs b/test/Microsoft.OpenApi.SmokeTests/ApiGurus.cs deleted file mode 100644 index b2cd1143b..000000000 --- a/test/Microsoft.OpenApi.SmokeTests/ApiGurus.cs +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT license. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Net; -using System.Net.Http; -using System.Threading.Tasks; -using Microsoft.OpenApi.Readers; -using Newtonsoft.Json.Linq; -using Xunit; -using Xunit.Abstractions; - -namespace Microsoft.OpenApi.SmokeTests -{ - [Collection("DefaultSettings")] - public class ApisGuruTests - { - private static HttpClient _httpClient; - private readonly ITestOutputHelper _output; - - public ApisGuruTests(ITestOutputHelper output) - { - _output = output; - } - - static ApisGuruTests() - { - ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; - _httpClient = new(new HttpClientHandler - { - AutomaticDecompression = DecompressionMethods.GZip - }); - _httpClient.DefaultRequestHeaders.AcceptEncoding.Add(new("gzip")); - _httpClient.DefaultRequestHeaders.UserAgent.Add(new("OpenApi.Net.Tests", "1.0")); - } - - public static IEnumerable GetSchemas() - { - var listJsonStr = _httpClient - .GetStringAsync("https://api.apis.guru/v2/list.json") - .GetAwaiter().GetResult(); - - var json = JObject.Parse(listJsonStr); - foreach (var item in json.Properties()) - { - if (GetProp(item.Value, "versions") is not JObject versions) - continue; - foreach (var prop in versions.Properties()) - { - var urlToJson = GetProp(prop.Value, "swaggerUrl")?.ToObject(); - if (urlToJson != null) - yield return new object[] { urlToJson }; - - var utlToYaml = GetProp(prop.Value, "swaggerYamlUrl")?.ToObject(); - if (utlToYaml != null) - yield return new object[] { utlToYaml }; - } - } - - JToken GetProp(JToken obj, string prop) - { - if (obj is not JObject jObj) - return null; - if (!jObj.TryGetValue(prop, out var jToken)) - return null; - return jToken; - } - } - - // Disable as some APIs are currently invalid - //[Theory(DisplayName = "APIs.guru")] - //[MemberData(nameof(GetSchemas))] - public async Task EnsureThatICouldParse(string url) - { - var response = await _httpClient.GetAsync(url); - if (!response.IsSuccessStatusCode) - { - _output.WriteLine($"Couldn't load {url}"); - return; - } - - await response.Content.LoadIntoBufferAsync(); - var stream = await response.Content.ReadAsStreamAsync(); - - var stopwatch = new Stopwatch(); - stopwatch.Start(); - - var reader = new OpenApiStreamReader(); - var openApiDocument = reader.Read(stream, out var diagnostic); - - if (diagnostic.Errors.Count > 0) - { - _output.WriteLine($"Errors parsing {url}"); - _output.WriteLine(String.Join('\n', diagnostic.Errors)); - // Assert.True(false); // Uncomment to identify descriptions with errors. - } - - Assert.NotNull(openApiDocument); - stopwatch.Stop(); - _output.WriteLine($"Parsing {url} took {stopwatch.ElapsedMilliseconds} ms."); - } - } -} diff --git a/test/Microsoft.OpenApi.SmokeTests/GraphTests.cs b/test/Microsoft.OpenApi.SmokeTests/GraphTests.cs deleted file mode 100644 index 9bd1069a2..000000000 --- a/test/Microsoft.OpenApi.SmokeTests/GraphTests.cs +++ /dev/null @@ -1,63 +0,0 @@ -using Microsoft.OpenApi.Models; -using Microsoft.OpenApi.Readers; -using Microsoft.OpenApi.Services; -using System; -using System.Net; -using System.Net.Http; -using Xunit; -using Xunit.Abstractions; - -namespace Microsoft.OpenApi.SmokeTests -{ - public class GraphTests - { - OpenApiDocument _graphOpenApi; - HttpClient _httpClient; - private readonly ITestOutputHelper _output; - const string graphOpenApiUrl = "https://github.com/microsoftgraph/microsoft-graph-openapi/blob/master/v1.0.json?raw=true"; - - public GraphTests(ITestOutputHelper output) - { - _output = output; - ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; - _httpClient = new(new HttpClientHandler - { AutomaticDecompression = DecompressionMethods.GZip - }); - _httpClient.DefaultRequestHeaders.AcceptEncoding.Add(new("gzip")); - _httpClient.DefaultRequestHeaders.UserAgent.Add(new("OpenApi.Net.Tests", "1.0")); - - var response = _httpClient.GetAsync(graphOpenApiUrl) - .GetAwaiter().GetResult(); - - if (!response.IsSuccessStatusCode) - { - _output.WriteLine($"Couldn't load graph openapi"); - return; - } - - var stream = response.Content.ReadAsStreamAsync().GetAwaiter().GetResult(); ; - - var reader = new OpenApiStreamReader(); - _graphOpenApi = reader.Read(stream, out var diagnostic); - - if (diagnostic.Errors.Count > 0) - { - _output.WriteLine($"Errors parsing"); - _output.WriteLine(String.Join('\n', diagnostic.Errors)); - // Assert.True(false); // Uncomment to identify descriptions with errors. - } - } - - //[Fact(Skip="Run manually")] - public void LoadOpen() - { - var operations = new[] { "foo","bar" }; - var workspace = new OpenApiWorkspace(); - workspace.AddDocument(graphOpenApiUrl, _graphOpenApi); - var subset = new OpenApiDocument(); - workspace.AddDocument("subset", subset); - - Assert.NotNull(_graphOpenApi); - } - } -} diff --git a/test/Microsoft.OpenApi.SmokeTests/Microsoft.OpenApi.SmokeTests.csproj b/test/Microsoft.OpenApi.SmokeTests/Microsoft.OpenApi.SmokeTests.csproj deleted file mode 100644 index 4c93a8354..000000000 --- a/test/Microsoft.OpenApi.SmokeTests/Microsoft.OpenApi.SmokeTests.csproj +++ /dev/null @@ -1,28 +0,0 @@ - - - - net8.0 - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/test/Microsoft.OpenApi.SmokeTests/WorkspaceTests.cs b/test/Microsoft.OpenApi.SmokeTests/WorkspaceTests.cs deleted file mode 100644 index 0d0056fe3..000000000 --- a/test/Microsoft.OpenApi.SmokeTests/WorkspaceTests.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace Microsoft.OpenApi.SmokeTests -{ - public class WorkspaceTests - { - } -} diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeAdvancedCallbackAsV3JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeAdvancedCallbackAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 98% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeAdvancedCallbackAsV3JsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeAdvancedCallbackAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index 8017028d1..36135796e 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeAdvancedCallbackAsV3JsonWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeAdvancedCallbackAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "$request.body#/url": { "post": { "requestBody": { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeAdvancedCallbackAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeAdvancedCallbackAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..586f0ed17 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeAdvancedCallbackAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"$request.body#/url":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Success"}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeAdvancedCallbackAsV3JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeAdvancedCallbackAsV3JsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index 690cc5e9d..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeAdvancedCallbackAsV3JsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"$request.body#/url":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Success"}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWithoutReferenceWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt similarity index 98% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWithoutReferenceWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index 8017028d1..36135796e 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWithoutReferenceWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "$request.body#/url": { "post": { "requestBody": { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..586f0ed17 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"$request.body#/url":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Success"}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWithoutReferenceWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWithoutReferenceWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index 690cc5e9d..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWithoutReferenceWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"$request.body#/url":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Success"}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 90% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index 8c9f1f140..81907fcb2 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,3 +1,3 @@ -{ +{ "$ref": "#/components/callbacks/simpleHook" } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..5d2495706 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"$ref":"#/components/callbacks/simpleHook"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index 20e44f987..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.SerializeReferencedCallbackAsV3JsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"$ref":"#/components/callbacks/simpleHook"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.cs index ad26b8288..9dd80c3da 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiCallbackTests.cs @@ -99,7 +99,7 @@ public class OpenApiCallbackTests [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeAdvancedCallbackAsV3JsonWorks(bool produceTerseOutput) + public async Task SerializeAdvancedCallbackAsV3JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -116,7 +116,7 @@ public async Task SerializeAdvancedCallbackAsV3JsonWorks(bool produceTerseOutput [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeReferencedCallbackAsV3JsonWorks(bool produceTerseOutput) + public async Task SerializeReferencedCallbackAsV3JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -133,7 +133,7 @@ public async Task SerializeReferencedCallbackAsV3JsonWorks(bool produceTerseOutp [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeReferencedCallbackAsV3JsonWithoutReferenceWorks(bool produceTerseOutput) + public async Task SerializeReferencedCallbackAsV3JsonWithoutReferenceWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV2JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 99% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV2JsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt index a2e4fbd4c..bd0084a2b 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV2JsonWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "swagger": "2.0", "info": { "title": "Swagger Petstore (Simple)", diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..b82c2f263 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"swagger":"2.0","info":{"title":"Swagger Petstore (Simple)","description":"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification","termsOfService":"http://helloreverb.com/terms/","contact":{"name":"Swagger API team","url":"http://swagger.io","email":"foo@example.com"},"license":{"name":"MIT","url":"http://opensource.org/licenses/MIT"},"version":"1.0.0"},"host":"petstore.swagger.io","basePath":"/api","schemes":["http"],"paths":{"/pets":{"get":{"description":"Returns all pets from the system that the user has access to","operationId":"findPets","produces":["application/json","application/xml","text/html"],"parameters":[{"in":"query","name":"tags","description":"tags to filter by","type":"array","items":{"type":"string"},"collectionFormat":"multi"},{"in":"query","name":"limit","description":"maximum number of results to return","type":"integer","format":"int32"}],"responses":{"200":{"description":"pet response","schema":{"type":"array","items":{"required":["id","name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}}}},"4XX":{"description":"unexpected client error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}},"5XX":{"description":"unexpected server error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}}}},"post":{"description":"Creates a new pet in the store. Duplicates are allowed","operationId":"addPet","consumes":["application/json"],"produces":["application/json","text/html"],"parameters":[{"in":"body","name":"body","description":"Pet to add to the store","required":true,"schema":{"required":["name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}}}],"responses":{"200":{"description":"pet response","schema":{"required":["id","name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}}},"4XX":{"description":"unexpected client error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}},"5XX":{"description":"unexpected server error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}}}}},"/pets/{id}":{"get":{"description":"Returns a user based on a single ID, if the user does not have access to the pet","operationId":"findPetById","produces":["application/json","application/xml","text/html"],"parameters":[{"in":"path","name":"id","description":"ID of pet to fetch","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"pet response","schema":{"required":["id","name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}}},"4XX":{"description":"unexpected client error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}},"5XX":{"description":"unexpected server error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}}}},"delete":{"description":"deletes a single pet based on the ID supplied","operationId":"deletePet","produces":["text/html"],"parameters":[{"in":"path","name":"id","description":"ID of pet to delete","required":true,"type":"integer","format":"int64"}],"responses":{"204":{"description":"pet deleted"},"4XX":{"description":"unexpected client error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}},"5XX":{"description":"unexpected server error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}}}}}},"definitions":{"pet":{"required":["id","name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}},"newPet":{"required":["name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}},"errorModel":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV2JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV2JsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index 081bcda08..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV2JsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"swagger":"2.0","info":{"title":"Swagger Petstore (Simple)","description":"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification","termsOfService":"http://helloreverb.com/terms/","contact":{"name":"Swagger API team","url":"http://swagger.io","email":"foo@example.com"},"license":{"name":"MIT","url":"http://opensource.org/licenses/MIT"},"version":"1.0.0"},"host":"petstore.swagger.io","basePath":"/api","schemes":["http"],"paths":{"/pets":{"get":{"description":"Returns all pets from the system that the user has access to","operationId":"findPets","produces":["application/json","application/xml","text/html"],"parameters":[{"in":"query","name":"tags","description":"tags to filter by","type":"array","items":{"type":"string"},"collectionFormat":"multi"},{"in":"query","name":"limit","description":"maximum number of results to return","type":"integer","format":"int32"}],"responses":{"200":{"description":"pet response","schema":{"type":"array","items":{"required":["id","name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}}}},"4XX":{"description":"unexpected client error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}},"5XX":{"description":"unexpected server error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}}}},"post":{"description":"Creates a new pet in the store. Duplicates are allowed","operationId":"addPet","consumes":["application/json"],"produces":["application/json","text/html"],"parameters":[{"in":"body","name":"body","description":"Pet to add to the store","required":true,"schema":{"required":["name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}}}],"responses":{"200":{"description":"pet response","schema":{"required":["id","name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}}},"4XX":{"description":"unexpected client error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}},"5XX":{"description":"unexpected server error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}}}}},"/pets/{id}":{"get":{"description":"Returns a user based on a single ID, if the user does not have access to the pet","operationId":"findPetById","produces":["application/json","application/xml","text/html"],"parameters":[{"in":"path","name":"id","description":"ID of pet to fetch","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"pet response","schema":{"required":["id","name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}}},"4XX":{"description":"unexpected client error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}},"5XX":{"description":"unexpected server error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}}}},"delete":{"description":"deletes a single pet based on the ID supplied","operationId":"deletePet","produces":["text/html"],"parameters":[{"in":"path","name":"id","description":"ID of pet to delete","required":true,"type":"integer","format":"int64"}],"responses":{"204":{"description":"pet deleted"},"4XX":{"description":"unexpected client error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}},"5XX":{"description":"unexpected server error","schema":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}}}}}},"definitions":{"pet":{"required":["id","name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}},"newPet":{"required":["name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}},"errorModel":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV3JsonWorks2_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 100% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV3JsonWorks2_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV3JsonWorks2_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt similarity index 100% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV3JsonWorks2_produceTerseOutput=True.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV3JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV3JsonWorks_produceTerseOutput=False.verified.txt deleted file mode 100644 index a94db37b7..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV3JsonWorks_produceTerseOutput=False.verified.txt +++ /dev/null @@ -1,495 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "Swagger Petstore (Simple)", - "description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification", - "termsOfService": "http://helloreverb.com/terms/", - "contact": { - "name": "Swagger API team", - "url": "http://swagger.io", - "email": "foo@example.com" - }, - "license": { - "name": "MIT", - "url": "http://opensource.org/licenses/MIT" - }, - "version": "1.0.0" - }, - "servers": [ - { - "url": "http://petstore.swagger.io/api" - } - ], - "paths": { - "/pets": { - "get": { - "description": "Returns all pets from the system that the user has access to", - "operationId": "findPets", - "parameters": [ - { - "name": "tags", - "in": "query", - "description": "tags to filter by", - "schema": { - "type": "array", - "items": { - "type": "string" - } - } - }, - { - "name": "limit", - "in": "query", - "description": "maximum number of results to return", - "schema": { - "type": "integer", - "format": "int32" - } - } - ], - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "required": [ - "id", - "name" - ], - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - } - } - }, - "application/xml": { - "schema": { - "type": "array", - "items": { - "required": [ - "id", - "name" - ], - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - } - } - } - } - }, - "4XX": { - "description": "unexpected client error", - "content": { - "text/html": { - "schema": { - "required": [ - "code", - "message" - ], - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } - }, - "5XX": { - "description": "unexpected server error", - "content": { - "text/html": { - "schema": { - "required": [ - "code", - "message" - ], - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } - } - } - }, - "post": { - "description": "Creates a new pet in the store. Duplicates are allowed", - "operationId": "addPet", - "requestBody": { - "description": "Pet to add to the store", - "content": { - "application/json": { - "schema": { - "required": [ - "name" - ], - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "required": [ - "id", - "name" - ], - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - } - } - } - }, - "4XX": { - "description": "unexpected client error", - "content": { - "text/html": { - "schema": { - "required": [ - "code", - "message" - ], - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } - }, - "5XX": { - "description": "unexpected server error", - "content": { - "text/html": { - "schema": { - "required": [ - "code", - "message" - ], - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } - } - } - } - }, - "/pets/{id}": { - "get": { - "description": "Returns a user based on a single ID, if the user does not have access to the pet", - "operationId": "findPetById", - "parameters": [ - { - "name": "id", - "in": "path", - "description": "ID of pet to fetch", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "200": { - "description": "pet response", - "content": { - "application/json": { - "schema": { - "required": [ - "id", - "name" - ], - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - } - }, - "application/xml": { - "schema": { - "required": [ - "id", - "name" - ], - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - } - } - } - }, - "4XX": { - "description": "unexpected client error", - "content": { - "text/html": { - "schema": { - "required": [ - "code", - "message" - ], - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } - }, - "5XX": { - "description": "unexpected server error", - "content": { - "text/html": { - "schema": { - "required": [ - "code", - "message" - ], - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } - } - } - }, - "delete": { - "description": "deletes a single pet based on the ID supplied", - "operationId": "deletePet", - "parameters": [ - { - "name": "id", - "in": "path", - "description": "ID of pet to delete", - "required": true, - "schema": { - "type": "integer", - "format": "int64" - } - } - ], - "responses": { - "204": { - "description": "pet deleted" - }, - "4XX": { - "description": "unexpected client error", - "content": { - "text/html": { - "schema": { - "required": [ - "code", - "message" - ], - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } - }, - "5XX": { - "description": "unexpected server error", - "content": { - "text/html": { - "schema": { - "required": [ - "code", - "message" - ], - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } - } - } - } - } - }, - "components": { - "schemas": { - "pet": { - "required": [ - "id", - "name" - ], - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - }, - "newPet": { - "required": [ - "name" - ], - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "tag": { - "type": "string" - } - } - }, - "errorModel": { - "required": [ - "code", - "message" - ], - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - } - } - } - } - } -} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV3JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV3JsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index 72106e400..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentAsV3JsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"openapi":"3.0.1","info":{"title":"Swagger Petstore (Simple)","description":"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification","termsOfService":"http://helloreverb.com/terms/","contact":{"name":"Swagger API team","url":"http://swagger.io","email":"foo@example.com"},"license":{"name":"MIT","url":"http://opensource.org/licenses/MIT"},"version":"1.0.0"},"servers":[{"url":"http://petstore.swagger.io/api"}],"paths":{"/pets":{"get":{"description":"Returns all pets from the system that the user has access to","operationId":"findPets","parameters":[{"name":"tags","in":"query","description":"tags to filter by","schema":{"type":"array","items":{"type":"string"}}},{"name":"limit","in":"query","description":"maximum number of results to return","schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"pet response","content":{"application/json":{"schema":{"type":"array","items":{"required":["id","name"],"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}}}},"application/xml":{"schema":{"type":"array","items":{"required":["id","name"],"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}}}}}},"4XX":{"description":"unexpected client error","content":{"text/html":{"schema":{"required":["code","message"],"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}}},"5XX":{"description":"unexpected server error","content":{"text/html":{"schema":{"required":["code","message"],"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}}}}},"post":{"description":"Creates a new pet in the store. Duplicates are allowed","operationId":"addPet","requestBody":{"description":"Pet to add to the store","content":{"application/json":{"schema":{"required":["name"],"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}}}},"required":true},"responses":{"200":{"description":"pet response","content":{"application/json":{"schema":{"required":["id","name"],"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}}}}},"4XX":{"description":"unexpected client error","content":{"text/html":{"schema":{"required":["code","message"],"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}}},"5XX":{"description":"unexpected server error","content":{"text/html":{"schema":{"required":["code","message"],"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}}}}}},"/pets/{id}":{"get":{"description":"Returns a user based on a single ID, if the user does not have access to the pet","operationId":"findPetById","parameters":[{"name":"id","in":"path","description":"ID of pet to fetch","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"pet response","content":{"application/json":{"schema":{"required":["id","name"],"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}}},"application/xml":{"schema":{"required":["id","name"],"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}}}}},"4XX":{"description":"unexpected client error","content":{"text/html":{"schema":{"required":["code","message"],"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}}},"5XX":{"description":"unexpected server error","content":{"text/html":{"schema":{"required":["code","message"],"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}}}}},"delete":{"description":"deletes a single pet based on the ID supplied","operationId":"deletePet","parameters":[{"name":"id","in":"path","description":"ID of pet to delete","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"204":{"description":"pet deleted"},"4XX":{"description":"unexpected client error","content":{"text/html":{"schema":{"required":["code","message"],"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}}},"5XX":{"description":"unexpected server error","content":{"text/html":{"schema":{"required":["code","message"],"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}}}}}}},"components":{"schemas":{"pet":{"required":["id","name"],"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}},"newPet":{"required":["name"],"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}},"errorModel":{"required":["code","message"],"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV2JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 99% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV2JsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt index 443881617..d66a8f4c2 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV2JsonWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "swagger": "2.0", "info": { "title": "Swagger Petstore (Simple)", diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..38ff58647 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"swagger":"2.0","info":{"title":"Swagger Petstore (Simple)","description":"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification","termsOfService":"http://helloreverb.com/terms/","contact":{"name":"Swagger API team","url":"http://swagger.io","email":"foo@example.com"},"license":{"name":"MIT","url":"http://opensource.org/licenses/MIT"},"version":"1.0.0"},"host":"petstore.swagger.io","basePath":"/api","schemes":["http"],"paths":{"/pets":{"get":{"description":"Returns all pets from the system that the user has access to","operationId":"findPets","produces":["application/json","application/xml","text/html"],"parameters":[{"in":"query","name":"tags","description":"tags to filter by","type":"array","items":{"type":"string"},"collectionFormat":"multi"},{"in":"query","name":"limit","description":"maximum number of results to return","type":"integer","format":"int32"}],"responses":{"200":{"description":"pet response","schema":{"type":"array","items":{"$ref":"#/definitions/pet"}}},"4XX":{"description":"unexpected client error","schema":{"$ref":"#/definitions/errorModel"}},"5XX":{"description":"unexpected server error","schema":{"$ref":"#/definitions/errorModel"}}}},"post":{"description":"Creates a new pet in the store. Duplicates are allowed","operationId":"addPet","consumes":["application/json"],"produces":["application/json","text/html"],"parameters":[{"in":"body","name":"body","description":"Pet to add to the store","required":true,"schema":{"$ref":"#/definitions/newPet"}}],"responses":{"200":{"description":"pet response","schema":{"$ref":"#/definitions/pet"}},"4XX":{"description":"unexpected client error","schema":{"$ref":"#/definitions/errorModel"}},"5XX":{"description":"unexpected server error","schema":{"$ref":"#/definitions/errorModel"}}}}},"/pets/{id}":{"get":{"description":"Returns a user based on a single ID, if the user does not have access to the pet","operationId":"findPetById","produces":["application/json","application/xml","text/html"],"parameters":[{"in":"path","name":"id","description":"ID of pet to fetch","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"pet response","schema":{"$ref":"#/definitions/pet"}},"4XX":{"description":"unexpected client error","schema":{"$ref":"#/definitions/errorModel"}},"5XX":{"description":"unexpected server error","schema":{"$ref":"#/definitions/errorModel"}}}},"delete":{"description":"deletes a single pet based on the ID supplied","operationId":"deletePet","produces":["text/html"],"parameters":[{"in":"path","name":"id","description":"ID of pet to delete","required":true,"type":"integer","format":"int64"}],"responses":{"204":{"description":"pet deleted"},"4XX":{"description":"unexpected client error","schema":{"$ref":"#/definitions/errorModel"}},"5XX":{"description":"unexpected server error","schema":{"$ref":"#/definitions/errorModel"}}}}}},"definitions":{"pet":{"required":["id","name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}},"newPet":{"required":["name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}},"errorModel":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV2JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV2JsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index 3818a4799..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV2JsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"swagger":"2.0","info":{"title":"Swagger Petstore (Simple)","description":"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification","termsOfService":"http://helloreverb.com/terms/","contact":{"name":"Swagger API team","url":"http://swagger.io","email":"foo@example.com"},"license":{"name":"MIT","url":"http://opensource.org/licenses/MIT"},"version":"1.0.0"},"host":"petstore.swagger.io","basePath":"/api","schemes":["http"],"paths":{"/pets":{"get":{"description":"Returns all pets from the system that the user has access to","operationId":"findPets","produces":["application/json","application/xml","text/html"],"parameters":[{"in":"query","name":"tags","description":"tags to filter by","type":"array","items":{"type":"string"},"collectionFormat":"multi"},{"in":"query","name":"limit","description":"maximum number of results to return","type":"integer","format":"int32"}],"responses":{"200":{"description":"pet response","schema":{"type":"array","items":{"$ref":"#/definitions/pet"}}},"4XX":{"description":"unexpected client error","schema":{"$ref":"#/definitions/errorModel"}},"5XX":{"description":"unexpected server error","schema":{"$ref":"#/definitions/errorModel"}}}},"post":{"description":"Creates a new pet in the store. Duplicates are allowed","operationId":"addPet","consumes":["application/json"],"produces":["application/json","text/html"],"parameters":[{"in":"body","name":"body","description":"Pet to add to the store","required":true,"schema":{"$ref":"#/definitions/newPet"}}],"responses":{"200":{"description":"pet response","schema":{"$ref":"#/definitions/pet"}},"4XX":{"description":"unexpected client error","schema":{"$ref":"#/definitions/errorModel"}},"5XX":{"description":"unexpected server error","schema":{"$ref":"#/definitions/errorModel"}}}}},"/pets/{id}":{"get":{"description":"Returns a user based on a single ID, if the user does not have access to the pet","operationId":"findPetById","produces":["application/json","application/xml","text/html"],"parameters":[{"in":"path","name":"id","description":"ID of pet to fetch","required":true,"type":"integer","format":"int64"}],"responses":{"200":{"description":"pet response","schema":{"$ref":"#/definitions/pet"}},"4XX":{"description":"unexpected client error","schema":{"$ref":"#/definitions/errorModel"}},"5XX":{"description":"unexpected server error","schema":{"$ref":"#/definitions/errorModel"}}}},"delete":{"description":"deletes a single pet based on the ID supplied","operationId":"deletePet","produces":["text/html"],"parameters":[{"in":"path","name":"id","description":"ID of pet to delete","required":true,"type":"integer","format":"int64"}],"responses":{"204":{"description":"pet deleted"},"4XX":{"description":"unexpected client error","schema":{"$ref":"#/definitions/errorModel"}},"5XX":{"description":"unexpected server error","schema":{"$ref":"#/definitions/errorModel"}}}}}},"definitions":{"pet":{"required":["id","name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}},"newPet":{"required":["name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}},"errorModel":{"required":["code","message"],"type":"object","properties":{"code":{"format":"int32","type":"integer"},"message":{"type":"string"}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV3JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 99% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV3JsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index f1da0b354..eb23d0c24 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV3JsonWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "openapi": "3.0.1", "info": { "title": "Swagger Petstore (Simple)", @@ -30,6 +30,7 @@ "name": "tags", "in": "query", "description": "tags to filter by", + "style": "form", "schema": { "type": "array", "items": { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..01840772e --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"openapi":"3.0.1","info":{"title":"Swagger Petstore (Simple)","description":"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification","termsOfService":"http://helloreverb.com/terms/","contact":{"name":"Swagger API team","url":"http://swagger.io","email":"foo@example.com"},"license":{"name":"MIT","url":"http://opensource.org/licenses/MIT"},"version":"1.0.0"},"servers":[{"url":"http://petstore.swagger.io/api"}],"paths":{"/pets":{"get":{"description":"Returns all pets from the system that the user has access to","operationId":"findPets","parameters":[{"name":"tags","in":"query","description":"tags to filter by","style":"form","schema":{"type":"array","items":{"type":"string"}}},{"name":"limit","in":"query","description":"maximum number of results to return","schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"pet response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/pet"}}},"application/xml":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/pet"}}}}},"4XX":{"description":"unexpected client error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}},"5XX":{"description":"unexpected server error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}}}},"post":{"description":"Creates a new pet in the store. Duplicates are allowed","operationId":"addPet","requestBody":{"description":"Pet to add to the store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/newPet"}}},"required":true},"responses":{"200":{"description":"pet response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/pet"}}}},"4XX":{"description":"unexpected client error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}},"5XX":{"description":"unexpected server error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}}}}},"/pets/{id}":{"get":{"description":"Returns a user based on a single ID, if the user does not have access to the pet","operationId":"findPetById","parameters":[{"name":"id","in":"path","description":"ID of pet to fetch","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"pet response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/pet"}},"application/xml":{"schema":{"$ref":"#/components/schemas/pet"}}}},"4XX":{"description":"unexpected client error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}},"5XX":{"description":"unexpected server error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}}}},"delete":{"description":"deletes a single pet based on the ID supplied","operationId":"deletePet","parameters":[{"name":"id","in":"path","description":"ID of pet to delete","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"204":{"description":"pet deleted"},"4XX":{"description":"unexpected client error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}},"5XX":{"description":"unexpected server error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}}}}}},"components":{"schemas":{"pet":{"required":["id","name"],"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}},"newPet":{"required":["name"],"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}},"errorModel":{"required":["code","message"],"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV3JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV3JsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index be8dcc627..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithReferenceAsV3JsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"openapi":"3.0.1","info":{"title":"Swagger Petstore (Simple)","description":"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification","termsOfService":"http://helloreverb.com/terms/","contact":{"name":"Swagger API team","url":"http://swagger.io","email":"foo@example.com"},"license":{"name":"MIT","url":"http://opensource.org/licenses/MIT"},"version":"1.0.0"},"servers":[{"url":"http://petstore.swagger.io/api"}],"paths":{"/pets":{"get":{"description":"Returns all pets from the system that the user has access to","operationId":"findPets","parameters":[{"name":"tags","in":"query","description":"tags to filter by","schema":{"type":"array","items":{"type":"string"}}},{"name":"limit","in":"query","description":"maximum number of results to return","schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"pet response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/pet"}}},"application/xml":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/pet"}}}}},"4XX":{"description":"unexpected client error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}},"5XX":{"description":"unexpected server error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}}}},"post":{"description":"Creates a new pet in the store. Duplicates are allowed","operationId":"addPet","requestBody":{"description":"Pet to add to the store","content":{"application/json":{"schema":{"$ref":"#/components/schemas/newPet"}}},"required":true},"responses":{"200":{"description":"pet response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/pet"}}}},"4XX":{"description":"unexpected client error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}},"5XX":{"description":"unexpected server error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}}}}},"/pets/{id}":{"get":{"description":"Returns a user based on a single ID, if the user does not have access to the pet","operationId":"findPetById","parameters":[{"name":"id","in":"path","description":"ID of pet to fetch","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"pet response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/pet"}},"application/xml":{"schema":{"$ref":"#/components/schemas/pet"}}}},"4XX":{"description":"unexpected client error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}},"5XX":{"description":"unexpected server error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}}}},"delete":{"description":"deletes a single pet based on the ID supplied","operationId":"deletePet","parameters":[{"name":"id","in":"path","description":"ID of pet to delete","required":true,"schema":{"type":"integer","format":"int64"}}],"responses":{"204":{"description":"pet deleted"},"4XX":{"description":"unexpected client error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}},"5XX":{"description":"unexpected server error","content":{"text/html":{"schema":{"$ref":"#/components/schemas/errorModel"}}}}}}}},"components":{"schemas":{"pet":{"required":["id","name"],"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}},"newPet":{"required":["name"],"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}},"errorModel":{"required":["code","message"],"type":"object","properties":{"code":{"type":"integer","format":"int32"},"message":{"type":"string"}}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithServerVariableAsV2JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithServerVariableAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 100% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithServerVariableAsV2JsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithServerVariableAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithServerVariableAsV2JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithServerVariableAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt similarity index 100% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithServerVariableAsV2JsonWorks_produceTerseOutput=True.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeAdvancedDocumentWithServerVariableAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV2JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 99% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV2JsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt index 671c21ec5..e2a2dbbab 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV2JsonWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "swagger": "2.0", "info": { "title": "Swagger Petstore (Simple)", diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..49072fda2 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"swagger":"2.0","info":{"title":"Swagger Petstore (Simple)","description":"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification","version":"1.0.0"},"host":"petstore.swagger.io","basePath":"/api","schemes":["http"],"paths":{"/add/{operand1}/{operand2}":{"get":{"operationId":"addByOperand1AndByOperand2","produces":["application/json"],"parameters":[{"in":"path","name":"operand1","description":"The first operand","required":true,"type":"integer","my-extension":4},{"in":"path","name":"operand2","description":"The second operand","required":true,"type":"integer","my-extension":4}],"responses":{"200":{"description":"pet response","schema":{"type":"array","items":{"required":["id","name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}}}}}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV2JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV2JsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index 7dd31e201..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV2JsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"swagger":"2.0","info":{"title":"Swagger Petstore (Simple)","description":"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification","version":"1.0.0"},"host":"petstore.swagger.io","basePath":"/api","schemes":["http"],"paths":{"/add/{operand1}/{operand2}":{"get":{"operationId":"addByOperand1AndByOperand2","produces":["application/json"],"parameters":[{"in":"path","name":"operand1","description":"The first operand","required":true,"type":"integer","my-extension":4},{"in":"path","name":"operand2","description":"The second operand","required":true,"type":"integer","my-extension":4}],"responses":{"200":{"description":"pet response","schema":{"type":"array","items":{"required":["id","name"],"type":"object","properties":{"id":{"format":"int64","type":"integer"},"name":{"type":"string"},"tag":{"type":"string"}}}}}}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV3JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 99% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV3JsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index c2e9f5312..26442924a 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV3JsonWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "openapi": "3.0.1", "info": { "title": "Swagger Petstore (Simple)", diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..c5d124594 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"openapi":"3.0.1","info":{"title":"Swagger Petstore (Simple)","description":"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification","version":"1.0.0"},"servers":[{"url":"http://petstore.swagger.io/api"}],"paths":{"/add/{operand1}/{operand2}":{"get":{"operationId":"addByOperand1AndByOperand2","parameters":[{"name":"operand1","in":"path","description":"The first operand","required":true,"schema":{"type":"integer","my-extension":4},"my-extension":4},{"name":"operand2","in":"path","description":"The second operand","required":true,"schema":{"type":"integer","my-extension":4},"my-extension":4}],"responses":{"200":{"description":"pet response","content":{"application/json":{"schema":{"type":"array","items":{"required":["id","name"],"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}}}}}}}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV3JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV3JsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index da61a8817..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.SerializeDuplicateExtensionsAsV3JsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"openapi":"3.0.1","info":{"title":"Swagger Petstore (Simple)","description":"A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification","version":"1.0.0"},"servers":[{"url":"http://petstore.swagger.io/api"}],"paths":{"/add/{operand1}/{operand2}":{"get":{"operationId":"addByOperand1AndByOperand2","parameters":[{"name":"operand1","in":"path","description":"The first operand","required":true,"schema":{"type":"integer","my-extension":4},"my-extension":4},{"name":"operand2","in":"path","description":"The second operand","required":true,"schema":{"type":"integer","my-extension":4},"my-extension":4}],"responses":{"200":{"description":"pet response","content":{"application/json":{"schema":{"type":"array","items":{"required":["id","name"],"type":"object","properties":{"id":{"type":"integer","format":"int64"},"name":{"type":"string"},"tag":{"type":"string"}}}}}}}}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs index c9807f5a2..aa9433dfe 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiDocumentTests.cs @@ -1289,7 +1289,7 @@ public class OpenApiDocumentTests [Theory] [InlineData(false)] [InlineData(true)] - public async Task SerializeAdvancedDocumentAsV3JsonWorks(bool produceTerseOutput) + public async Task SerializeAdvancedDocumentAsV3JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -1306,7 +1306,7 @@ public async Task SerializeAdvancedDocumentAsV3JsonWorks(bool produceTerseOutput [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeAdvancedDocumentWithReferenceAsV3JsonWorks(bool produceTerseOutput) + public async Task SerializeAdvancedDocumentWithReferenceAsV3JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -1323,7 +1323,7 @@ public async Task SerializeAdvancedDocumentWithReferenceAsV3JsonWorks(bool produ [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeAdvancedDocumentWithServerVariableAsV2JsonWorks(bool produceTerseOutput) + public async Task SerializeAdvancedDocumentWithServerVariableAsV2JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -1340,7 +1340,7 @@ public async Task SerializeAdvancedDocumentWithServerVariableAsV2JsonWorks(bool [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeAdvancedDocumentAsV2JsonWorks(bool produceTerseOutput) + public async Task SerializeAdvancedDocumentAsV2JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -1357,7 +1357,7 @@ public async Task SerializeAdvancedDocumentAsV2JsonWorks(bool produceTerseOutput [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeDuplicateExtensionsAsV3JsonWorks(bool produceTerseOutput) + public async Task SerializeDuplicateExtensionsAsV3JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -1374,7 +1374,7 @@ public async Task SerializeDuplicateExtensionsAsV3JsonWorks(bool produceTerseOut [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeDuplicateExtensionsAsV2JsonWorks(bool produceTerseOutput) + public async Task SerializeDuplicateExtensionsAsV2JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -1391,7 +1391,7 @@ public async Task SerializeDuplicateExtensionsAsV2JsonWorks(bool produceTerseOut [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeAdvancedDocumentWithReferenceAsV2JsonWorks(bool produceTerseOutput) + public async Task SerializeAdvancedDocumentWithReferenceAsV2JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeAdvancedExampleAsV3JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeAdvancedExampleAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 99% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeAdvancedExampleAsV3JsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeAdvancedExampleAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index 44d48dd73..755152dc0 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeAdvancedExampleAsV3JsonWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeAdvancedExampleAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "value": { "versions": [ { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeAdvancedExampleAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeAdvancedExampleAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..2fd0836a4 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeAdvancedExampleAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"value":{"versions":[{"status":"Status1","id":"v1","links":[{"href":"http://example.com/1","rel":"sampleRel1","bytes":"AQID","binary":"Ñ😻😑♮Í☛oƞ♑😲☇éNjžŁ♻😟¥a´Ī♃ƠąøƩ"}]},{"status":"Status2","id":"v2","links":[{"href":"http://example.com/2","rel":"sampleRel2"}]}]}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeAdvancedExampleAsV3JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeAdvancedExampleAsV3JsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index c42b2a5ac..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeAdvancedExampleAsV3JsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"value":{"versions":[{"status":"Status1","id":"v1","links":[{"href":"http://example.com/1","rel":"sampleRel1","bytes":"AQID","binary":"Ñ😻😑♮Í☛oƞ♑😲☇éNjžŁ♻😟¥a´Ī♃ƠąøƩ"}]},{"status":"Status2","id":"v2","links":[{"href":"http://example.com/2","rel":"sampleRel2"}]}]}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWithoutReferenceWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt similarity index 98% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWithoutReferenceWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index bbe6f7e93..ba74d9125 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWithoutReferenceWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "value": { "versions": [ { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..bbc944fee --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"value":{"versions":[{"status":"Status1","id":"v1","links":[{"href":"http://example.com/1","rel":"sampleRel1"}]},{"status":"Status2","id":"v2","links":[{"href":"http://example.com/2","rel":"sampleRel2"}]}],"aDate":"2022-12-12"}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWithoutReferenceWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWithoutReferenceWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index e84267af4..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWithoutReferenceWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"value":{"versions":[{"status":"Status1","id":"v1","links":[{"href":"http://example.com/1","rel":"sampleRel1"}]},{"status":"Status2","id":"v2","links":[{"href":"http://example.com/2","rel":"sampleRel2"}]}],"aDate":"2022-12-12"}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 89% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index 74aae72ef..852a9bc0b 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,3 +1,3 @@ -{ +{ "$ref": "#/components/examples/example1" } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..41c47dfbc --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"$ref":"#/components/examples/example1"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index 12898c9c5..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.SerializeReferencedExampleAsV3JsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"$ref":"#/components/examples/example1"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.cs index a847016d0..8341ac4e9 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiExampleTests.cs @@ -102,7 +102,7 @@ public class OpenApiExampleTests [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeAdvancedExampleAsV3JsonWorks(bool produceTerseOutput) + public async Task SerializeAdvancedExampleAsV3JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -119,7 +119,7 @@ public async Task SerializeAdvancedExampleAsV3JsonWorks(bool produceTerseOutput) [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeReferencedExampleAsV3JsonWorks(bool produceTerseOutput) + public async Task SerializeReferencedExampleAsV3JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -136,7 +136,7 @@ public async Task SerializeReferencedExampleAsV3JsonWorks(bool produceTerseOutpu [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeReferencedExampleAsV3JsonWithoutReferenceWorks(bool produceTerseOutput) + public async Task SerializeReferencedExampleAsV3JsonWithoutReferenceWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWithoutReferenceWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 93% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWithoutReferenceWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt index 5b0eb86be..112b8c37f 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWithoutReferenceWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "description": "sampleHeader", "type": "integer", "format": "int32" diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..63c989200 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"description":"sampleHeader","type":"integer","format":"int32"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV2JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV2JsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index 8feb99289..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV2JsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"description":"sampleHeader","type":"integer","format":"int32"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV3JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 95% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV3JsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index 8234610e0..6356b0527 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV3JsonWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "description": "sampleHeader", "schema": { "type": "integer", diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..7d0a160ce --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"description":"sampleHeader","schema":{"type":"integer","format":"int32"}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV3JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV3JsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index 37ebf2515..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV3JsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"description":"sampleHeader","schema":{"type":"integer","format":"int32"}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV2JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt similarity index 93% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV2JsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index 5b0eb86be..112b8c37f 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeAdvancedHeaderAsV2JsonWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "description": "sampleHeader", "type": "integer", "format": "int32" diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..63c989200 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"description":"sampleHeader","type":"integer","format":"int32"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWithoutReferenceWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWithoutReferenceWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index 8feb99289..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWithoutReferenceWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"description":"sampleHeader","type":"integer","format":"int32"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 86% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt index 9791d3c4a..3c5b532f0 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,3 +1,3 @@ -{ +{ "$ref": "#/headers/example1" } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..4e1ff3605 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"$ref":"#/headers/example1"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index 58060ead9..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV2JsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"$ref":"#/headers/example1"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWithoutReferenceWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt similarity index 95% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWithoutReferenceWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index 8234610e0..6356b0527 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWithoutReferenceWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "description": "sampleHeader", "schema": { "type": "integer", diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..7d0a160ce --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"description":"sampleHeader","schema":{"type":"integer","format":"int32"}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWithoutReferenceWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWithoutReferenceWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index 37ebf2515..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWithoutReferenceWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"description":"sampleHeader","schema":{"type":"integer","format":"int32"}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 89% rename from test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index 18045b9d2..5b44f6427 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,3 +1,3 @@ -{ +{ "$ref": "#/components/headers/example1" } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..fc4d9c306 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"$ref":"#/components/headers/example1"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index 8c4124b8d..000000000 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.SerializeReferencedHeaderAsV3JsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"$ref":"#/components/headers/example1"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.cs b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.cs index 85316cf3b..f8ebfa95a 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.cs +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiHeaderTests.cs @@ -42,7 +42,7 @@ public class OpenApiHeaderTests [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeAdvancedHeaderAsV3JsonWorks(bool produceTerseOutput) + public async Task SerializeAdvancedHeaderAsV3JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -59,7 +59,7 @@ public async Task SerializeAdvancedHeaderAsV3JsonWorks(bool produceTerseOutput) [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeReferencedHeaderAsV3JsonWorks(bool produceTerseOutput) + public async Task SerializeReferencedHeaderAsV3JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -76,7 +76,7 @@ public async Task SerializeReferencedHeaderAsV3JsonWorks(bool produceTerseOutput [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeReferencedHeaderAsV3JsonWithoutReferenceWorks(bool produceTerseOutput) + public async Task SerializeReferencedHeaderAsV3JsonWithoutReferenceWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -94,7 +94,7 @@ public async Task SerializeReferencedHeaderAsV3JsonWithoutReferenceWorks(bool pr [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeAdvancedHeaderAsV2JsonWorks(bool produceTerseOutput) + public async Task SerializeAdvancedHeaderAsV2JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -111,7 +111,7 @@ public async Task SerializeAdvancedHeaderAsV2JsonWorks(bool produceTerseOutput) [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeReferencedHeaderAsV2JsonWorks(bool produceTerseOutput) + public async Task SerializeReferencedHeaderAsV2JsonWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); @@ -128,7 +128,7 @@ public async Task SerializeReferencedHeaderAsV2JsonWorks(bool produceTerseOutput [Theory] [InlineData(true)] [InlineData(false)] - public async Task SerializeReferencedHeaderAsV2JsonWithoutReferenceWorks(bool produceTerseOutput) + public async Task SerializeReferencedHeaderAsV2JsonWithoutReferenceWorksAsync(bool produceTerseOutput) { // Arrange var outputStringWriter = new StringWriter(CultureInfo.InvariantCulture); diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeAdvancedLinkAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeAdvancedLinkAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index 2629e0b1c..6beea68d7 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeAdvancedLinkAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeAdvancedLinkAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "operationId": "operationId1", "parameters": { "parameter1": "$request.path.id" diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeAdvancedLinkAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeAdvancedLinkAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt index c9c1701b5..d517845f1 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeAdvancedLinkAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeAdvancedLinkAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"operationId":"operationId1","parameters":{"parameter1":"$request.path.id"},"requestBody":{"property1":true},"description":"description1","server":{"description":"serverDescription1"}} \ No newline at end of file +{"operationId":"operationId1","parameters":{"parameter1":"$request.path.id"},"requestBody":{"property1":true},"description":"description1","server":{"description":"serverDescription1"}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index 2629e0b1c..6beea68d7 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "operationId": "operationId1", "parameters": { "parameter1": "$request.path.id" diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt index c9c1701b5..d517845f1 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"operationId":"operationId1","parameters":{"parameter1":"$request.path.id"},"requestBody":{"property1":true},"description":"description1","server":{"description":"serverDescription1"}} \ No newline at end of file +{"operationId":"operationId1","parameters":{"parameter1":"$request.path.id"},"requestBody":{"property1":true},"description":"description1","server":{"description":"serverDescription1"}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index 26fe6229d..8e0fba2e8 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,3 +1,3 @@ -{ +{ "$ref": "#/components/links/example1" } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt index 2200957a3..eb4e2d9a7 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiLinkTests.SerializeReferencedLinkAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"$ref":"#/components/links/example1"} \ No newline at end of file +{"$ref":"#/components/links/example1"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeFalseWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeFalseWorksAsync_produceTerseOutput=False.verified.txt index 1c8e22a01..5d3060ec5 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeFalseWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeFalseWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "name": "name1", "in": "query", "description": "description1", diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeFalseWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeFalseWorksAsync_produceTerseOutput=True.verified.txt index 73c77d79f..a4b87db10 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeFalseWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeFalseWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"name":"name1","in":"query","description":"description1","style":"form","explode":false,"schema":{"type":"array","items":{"enum":["value1","value2"]}}} \ No newline at end of file +{"name":"name1","in":"query","description":"description1","style":"form","explode":false,"schema":{"type":"array","items":{"enum":["value1","value2"]}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeTrueWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeTrueWorksAsync_produceTerseOutput=False.verified.txt index 651da1cce..36a9c0168 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeTrueWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeTrueWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "name": "name1", "in": "query", "description": "description1", diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeTrueWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeTrueWorksAsync_produceTerseOutput=True.verified.txt index 579671130..206902b7b 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeTrueWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithFormStyleAndExplodeTrueWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"name":"name1","in":"query","description":"description1","style":"form","schema":{"type":"array","items":{"enum":["value1","value2"]}}} \ No newline at end of file +{"name":"name1","in":"query","description":"description1","style":"form","schema":{"type":"array","items":{"enum":["value1","value2"]}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaReferenceAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaReferenceAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt index 744f8451c..82c260ad3 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaReferenceAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaReferenceAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "in": "header", "name": "name1", "description": "description1", diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaReferenceAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaReferenceAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt index 26b158865..d96c5ec61 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaReferenceAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaReferenceAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"in":"header","name":"name1","description":"description1","required":true,"type":"string","x-examples":{"test":{"summary":"summary3","description":"description3"}}} \ No newline at end of file +{"in":"header","name":"name1","description":"description1","required":true,"type":"string","x-examples":{"test":{"summary":"summary3","description":"description3"}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaTypeObjectAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaTypeObjectAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt index 744f8451c..82c260ad3 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaTypeObjectAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaTypeObjectAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "in": "header", "name": "name1", "description": "description1", diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaTypeObjectAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaTypeObjectAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt index 26b158865..d96c5ec61 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaTypeObjectAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeParameterWithSchemaTypeObjectAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"in":"header","name":"name1","description":"description1","required":true,"type":"string","x-examples":{"test":{"summary":"summary3","description":"description3"}}} \ No newline at end of file +{"in":"header","name":"name1","description":"description1","required":true,"type":"string","x-examples":{"test":{"summary":"summary3","description":"description3"}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index 4127038e5..2be79d6af 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "in": "path", "name": "name1" } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt index 8677f0fad..228537b57 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"in":"path","name":"name1"} \ No newline at end of file +{"in":"path","name":"name1"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt index a9154d617..e4e3b52c5 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,3 +1,3 @@ -{ +{ "$ref": "#/parameters/example1" } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt index 712d7ee78..2c9c105db 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"$ref":"#/parameters/example1"} \ No newline at end of file +{"$ref":"#/parameters/example1"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index 5275532e8..b810c2bc0 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "name": "name1", "in": "path" } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt index ec654beb0..9b65c4a88 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"name":"name1","in":"path"} \ No newline at end of file +{"name":"name1","in":"path"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index 654239535..43aade4c4 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,3 +1,3 @@ -{ +{ "$ref": "#/components/parameters/example1" } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt index 3d61cb3f8..dc6cfd29f 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiParameterTests.SerializeReferencedParameterAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"$ref":"#/components/parameters/example1"} \ No newline at end of file +{"$ref":"#/components/parameters/example1"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeAdvancedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeAdvancedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index ccc8d3725..0f8d7659c 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeAdvancedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeAdvancedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "description": "description", "content": { "application/json": { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeAdvancedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeAdvancedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt index 31161c2f5..767ce7937 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeAdvancedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeAdvancedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"description":"description","content":{"application/json":{"schema":{"type":"string"}}},"required":true} \ No newline at end of file +{"description":"description","content":{"application/json":{"schema":{"type":"string"}}},"required":true} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index ccc8d3725..0f8d7659c 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "description": "description", "content": { "application/json": { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt index 31161c2f5..767ce7937 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"description":"description","content":{"application/json":{"schema":{"type":"string"}}},"required":true} \ No newline at end of file +{"description":"description","content":{"application/json":{"schema":{"type":"string"}}},"required":true} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index ca9bb966e..aaf06f563 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,3 +1,3 @@ -{ +{ "$ref": "#/components/requestBodies/example1" } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt index 443812023..557936985 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiRequestBodyTests.SerializeReferencedRequestBodyAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"$ref":"#/components/requestBodies/example1"} \ No newline at end of file +{"$ref":"#/components/requestBodies/example1"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index af5ce3ea5..2bc39b459 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "description": "A complex object array response", "schema": { "type": "array", diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt index f9a3f9d5f..4917a08a6 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"description":"A complex object array response","schema":{"type":"array","items":{"$ref":"#/definitions/customType"}},"headers":{"X-Rate-Limit-Limit":{"description":"The number of allowed requests in the current period","type":"integer"},"X-Rate-Limit-Reset":{"description":"The number of seconds left in the current period","type":"integer"}}} \ No newline at end of file +{"description":"A complex object array response","schema":{"type":"array","items":{"$ref":"#/definitions/customType"}},"headers":{"X-Rate-Limit-Limit":{"description":"The number of allowed requests in the current period","type":"integer"},"X-Rate-Limit-Reset":{"description":"The number of seconds left in the current period","type":"integer"}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt index ea5aa0d40..c349731bf 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,3 +1,3 @@ -{ +{ "$ref": "#/responses/example1" } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt index b2058cfd8..20e1f9783 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"$ref":"#/responses/example1"} \ No newline at end of file +{"$ref":"#/responses/example1"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index 55bad289b..864f3daee 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "description": "A complex object array response", "headers": { "X-Rate-Limit-Limit": { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt index 612fbe919..08b78d5bd 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"description":"A complex object array response","headers":{"X-Rate-Limit-Limit":{"description":"The number of allowed requests in the current period","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The number of seconds left in the current period","schema":{"type":"integer"}}},"content":{"text/plain":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/customType"}}}}} \ No newline at end of file +{"description":"A complex object array response","headers":{"X-Rate-Limit-Limit":{"description":"The number of allowed requests in the current period","schema":{"type":"integer"}},"X-Rate-Limit-Reset":{"description":"The number of seconds left in the current period","schema":{"type":"integer"}}},"content":{"text/plain":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/customType"}}}}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index 115ec60a6..2b7824755 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,3 +1,3 @@ -{ +{ "$ref": "#/components/responses/example1" } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt index e65264a36..bbd27ff18 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiResponseTests.SerializeReferencedResponseAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"$ref":"#/components/responses/example1"} \ No newline at end of file +{"$ref":"#/components/responses/example1"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index 19773c717..2a9b08f98 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,3 +1,3 @@ -{ +{ "$ref": "#/components/schemas/schemaObject1" } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt index 34a933101..ca0ce704f 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"$ref":"#/components/schemas/schemaObject1"} \ No newline at end of file +{"$ref":"#/components/schemas/schemaObject1"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3WithoutReferenceJsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3WithoutReferenceJsonWorksAsync_produceTerseOutput=False.verified.txt index 7a3aa9ce8..b431f1607 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3WithoutReferenceJsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3WithoutReferenceJsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "title": "title1", "multipleOf": 3, "maximum": 42, diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3WithoutReferenceJsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3WithoutReferenceJsonWorksAsync_produceTerseOutput=True.verified.txt index f3407133d..d71a5f0a8 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3WithoutReferenceJsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeReferencedSchemaAsV3WithoutReferenceJsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"title":"title1","multipleOf":3,"maximum":42,"minimum":10,"exclusiveMinimum":true,"type":"integer","default":15,"nullable":true,"externalDocs":{"url":"http://example.com/externalDocs"}} \ No newline at end of file +{"title":"title1","multipleOf":3,"maximum":42,"minimum":10,"exclusiveMinimum":true,"type":"integer","default":15,"nullable":true,"externalDocs":{"url":"http://example.com/externalDocs"}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeSchemaWRequiredPropertiesAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeSchemaWRequiredPropertiesAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt index 49aece921..9ab9fad6f 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeSchemaWRequiredPropertiesAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeSchemaWRequiredPropertiesAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "title": "title1", "required": [ "property1" diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeSchemaWRequiredPropertiesAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeSchemaWRequiredPropertiesAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt index 4777a425c..b0b24d295 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeSchemaWRequiredPropertiesAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSchemaTests.SerializeSchemaWRequiredPropertiesAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"title":"title1","required":["property1"],"properties":{"property1":{"required":["property3"],"properties":{"property2":{"type":"integer"},"property3":{"maxLength":15,"type":"string"}}},"property4":{"properties":{"property5":{"properties":{"property6":{"type":"boolean"}}},"property7":{"minLength":2,"type":"string"}},"readOnly":true}},"externalDocs":{"url":"http://example.com/externalDocs"}} \ No newline at end of file +{"title":"title1","required":["property1"],"properties":{"property1":{"required":["property3"],"properties":{"property2":{"type":"integer"},"property3":{"maxLength":15,"type":"string"}}},"property4":{"properties":{"property5":{"properties":{"property6":{"type":"boolean"}}},"property7":{"minLength":2,"type":"string"}},"readOnly":true}},"externalDocs":{"url":"http://example.com/externalDocs"}} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index 1de104df5..39613f3ae 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "type": "openIdConnect", "description": "description1", "openIdConnectUrl": "https://example.com/openIdConnect" diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt index 5e7183dc8..717cba0a8 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"type":"openIdConnect","description":"description1","openIdConnectUrl":"https://example.com/openIdConnect"} \ No newline at end of file +{"type":"openIdConnect","description":"description1","openIdConnectUrl":"https://example.com/openIdConnect"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index 5bf57b219..e17924528 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,3 +1,3 @@ -{ +{ "$ref": "sampleSecurityScheme" } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt index 04a9d3e76..3866a27aa 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiSecuritySchemeTests.SerializeReferencedSecuritySchemeAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"$ref":"sampleSecurityScheme"} \ No newline at end of file +{"$ref":"sampleSecurityScheme"} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index 4e4df0f3b..2afa516e0 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "name": "pet", "description": "Pets operations", "externalDocs": { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt index 269fd9e7f..f0a901938 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"name":"pet","description":"Pets operations","externalDocs":{"description":"Find more info here","url":"https://example.com"},"x-tag-extension":null} \ No newline at end of file +{"name":"pet","description":"Pets operations","externalDocs":{"description":"Find more info here","url":"https://example.com"},"x-tag-extension":null} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt index 8c38cc78d..d3d287dca 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1 +1 @@ -"pet" \ No newline at end of file +"pet" \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt index 8c38cc78d..d3d287dca 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -"pet" \ No newline at end of file +"pet" \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index 4e4df0f3b..2afa516e0 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "name": "pet", "description": "Pets operations", "externalDocs": { diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt index 269fd9e7f..f0a901938 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{"name":"pet","description":"Pets operations","externalDocs":{"description":"Find more info here","url":"https://example.com"},"x-tag-extension":null} \ No newline at end of file +{"name":"pet","description":"Pets operations","externalDocs":{"description":"Find more info here","url":"https://example.com"},"x-tag-extension":null} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index 8c38cc78d..d3d287dca 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1 +1 @@ -"pet" \ No newline at end of file +"pet" \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt index 8c38cc78d..d3d287dca 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeAdvancedTagAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -"pet" \ No newline at end of file +"pet" \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index 6f31cf5a2..87b8ff218 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1 +1 @@ -{ } \ No newline at end of file +{ } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt index 9e26dfeeb..22fdca1b2 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV2JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{} \ No newline at end of file +{} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt index 6f31cf5a2..87b8ff218 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=False.verified.txt @@ -1 +1 @@ -{ } \ No newline at end of file +{ } \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt index 9e26dfeeb..22fdca1b2 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeBasicTagAsV3JsonWithoutReferenceWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -{} \ No newline at end of file +{} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt index 8c38cc78d..d3d287dca 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV2JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1 +1 @@ -"pet" \ No newline at end of file +"pet" \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt index 8c38cc78d..d3d287dca 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV2JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -"pet" \ No newline at end of file +"pet" \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt index 8c38cc78d..d3d287dca 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV3JsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1 +1 @@ -"pet" \ No newline at end of file +"pet" \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt index 8c38cc78d..d3d287dca 100644 --- a/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Models/OpenApiTagTests.SerializeReferencedTagAsV3JsonWorksAsync_produceTerseOutput=True.verified.txt @@ -1 +1 @@ -"pet" \ No newline at end of file +"pet" \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiUrlTreeNodeTests.VerifyDiagramFromSampleOpenAPI.verified.txt b/test/Microsoft.OpenApi.Tests/Services/OpenApiUrlTreeNodeTests.VerifyDiagramFromSampleOpenAPIAsync.verified.txt similarity index 100% rename from test/Microsoft.OpenApi.Tests/Services/OpenApiUrlTreeNodeTests.VerifyDiagramFromSampleOpenAPI.verified.txt rename to test/Microsoft.OpenApi.Tests/Services/OpenApiUrlTreeNodeTests.VerifyDiagramFromSampleOpenAPIAsync.verified.txt diff --git a/test/Microsoft.OpenApi.Tests/Services/OpenApiUrlTreeNodeTests.cs b/test/Microsoft.OpenApi.Tests/Services/OpenApiUrlTreeNodeTests.cs index 511c6c5bd..8d0bb8cd5 100644 --- a/test/Microsoft.OpenApi.Tests/Services/OpenApiUrlTreeNodeTests.cs +++ b/test/Microsoft.OpenApi.Tests/Services/OpenApiUrlTreeNodeTests.cs @@ -452,7 +452,7 @@ public void ThrowsArgumentNullExceptionForNullArgumentInAddAdditionalDataMethod( } [Fact] - public async Task VerifyDiagramFromSampleOpenAPI() + public async Task VerifyDiagramFromSampleOpenAPIAsync() { var doc1 = OpenApiDocumentSample_1; @@ -461,7 +461,7 @@ public async Task VerifyDiagramFromSampleOpenAPI() var writer = new StringWriter(); rootNode.WriteMermaid(writer); - writer.Flush(); + await writer.FlushAsync(); var diagram = writer.GetStringBuilder().ToString(); await Verifier.Verify(diagram); diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiArrayAsJsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiArrayAsJsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 100% rename from test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiArrayAsJsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiArrayAsJsonWorksAsync_produceTerseOutput=False.verified.txt diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiArrayAsJsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiArrayAsJsonWorksAsync_produceTerseOutput=True.verified.txt similarity index 100% rename from test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiArrayAsJsonWorks_produceTerseOutput=True.verified.txt rename to test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiArrayAsJsonWorksAsync_produceTerseOutput=True.verified.txt diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiArrayAsJsonWorks_terse=False.verified.txt b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiArrayAsJsonWorks_terse=False.verified.txt deleted file mode 100644 index 1a91b1047..000000000 --- a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiArrayAsJsonWorks_terse=False.verified.txt +++ /dev/null @@ -1,11 +0,0 @@ -[ - false, - { - "stringProp": "stringValue1", - "objProp": { }, - "arrayProp": [ - false - ] - }, - "stringValue2" -] \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiArrayAsJsonWorks_terse=True.verified.txt b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiArrayAsJsonWorks_terse=True.verified.txt deleted file mode 100644 index 75f913cf2..000000000 --- a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiArrayAsJsonWorks_terse=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -[false,{"stringProp":"stringValue1","objProp":{},"arrayProp":[false]},"stringValue2"] \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiObjectAsJsonWorks_produceTerseOutput=False.verified.txt b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiObjectAsJsonWorksAsync_produceTerseOutput=False.verified.txt similarity index 94% rename from test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiObjectAsJsonWorks_produceTerseOutput=False.verified.txt rename to test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiObjectAsJsonWorksAsync_produceTerseOutput=False.verified.txt index 1b6b4d799..c7812132a 100644 --- a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiObjectAsJsonWorks_produceTerseOutput=False.verified.txt +++ b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiObjectAsJsonWorksAsync_produceTerseOutput=False.verified.txt @@ -1,4 +1,4 @@ -{ +{ "stringProp": "stringValue1", "objProp": { }, "arrayProp": [ diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiObjectAsJsonWorksAsync_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiObjectAsJsonWorksAsync_produceTerseOutput=True.verified.txt new file mode 100644 index 000000000..f9a0cd869 --- /dev/null +++ b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiObjectAsJsonWorksAsync_produceTerseOutput=True.verified.txt @@ -0,0 +1 @@ +{"stringProp":"stringValue1","objProp":{},"arrayProp":[false]} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiObjectAsJsonWorks_produceTerseOutput=True.verified.txt b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiObjectAsJsonWorks_produceTerseOutput=True.verified.txt deleted file mode 100644 index c2132cb78..000000000 --- a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.WriteOpenApiObjectAsJsonWorks_produceTerseOutput=True.verified.txt +++ /dev/null @@ -1 +0,0 @@ -{"stringProp":"stringValue1","objProp":{},"arrayProp":[false]} \ No newline at end of file diff --git a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.cs b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.cs index 686e3a08a..6bc2c711b 100644 --- a/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.cs +++ b/test/Microsoft.OpenApi.Tests/Writers/OpenApiWriterAnyExtensionsTests.cs @@ -23,12 +23,12 @@ public class OpenApiWriterAnyExtensionsTests [Theory] [InlineData(true)] [InlineData(false)] - public void WriteOpenApiNullAsJsonWorks(bool produceTerseOutput) + public async Task WriteOpenApiNullAsJsonWorksAsync(bool produceTerseOutput) { // Arrange var nullValue = new OpenApiNull(); - var json = WriteAsJson(nullValue, produceTerseOutput); + var json = await WriteAsJsonAsync(nullValue, produceTerseOutput); // Assert json.Should().Be("null"); @@ -51,12 +51,12 @@ from shouldBeTerse in shouldProduceTerseOutputValues [Theory] [MemberData(nameof(IntInputs))] - public void WriteOpenApiIntegerAsJsonWorks(int input, bool produceTerseOutput) + public async Task WriteOpenApiIntegerAsJsonWorksAsync(int input, bool produceTerseOutput) { // Arrange var intValue = new OpenApiInteger(input); - var json = WriteAsJson(intValue, produceTerseOutput); + var json = await WriteAsJsonAsync(intValue, produceTerseOutput); // Assert json.Should().Be(input.ToString()); @@ -79,12 +79,12 @@ from shouldBeTerse in shouldProduceTerseOutputValues [Theory] [MemberData(nameof(LongInputs))] - public void WriteOpenApiLongAsJsonWorks(long input, bool produceTerseOutput) + public async Task WriteOpenApiLongAsJsonWorksAsync(long input, bool produceTerseOutput) { // Arrange var longValue = new OpenApiLong(input); - var json = WriteAsJson(longValue, produceTerseOutput); + var json = await WriteAsJsonAsync(longValue, produceTerseOutput); // Assert json.Should().Be(input.ToString()); @@ -107,12 +107,12 @@ from shouldBeTerse in shouldProduceTerseOutputValues [Theory] [MemberData(nameof(FloatInputs))] - public void WriteOpenApiFloatAsJsonWorks(float input, bool produceTerseOutput) + public async Task WriteOpenApiFloatAsJsonWorksAsync(float input, bool produceTerseOutput) { // Arrange var floatValue = new OpenApiFloat(input); - var json = WriteAsJson(floatValue, produceTerseOutput); + var json = await WriteAsJsonAsync(floatValue, produceTerseOutput); // Assert json.Should().Be(input.ToString()); @@ -135,12 +135,12 @@ from shouldBeTerse in shouldProduceTerseOutputValues [Theory] [MemberData(nameof(DoubleInputs))] - public void WriteOpenApiDoubleAsJsonWorks(double input, bool produceTerseOutput) + public async Task WriteOpenApiDoubleAsJsonWorksAsync(double input, bool produceTerseOutput) { // Arrange var doubleValue = new OpenApiDouble(input); - var json = WriteAsJson(doubleValue, produceTerseOutput); + var json = await WriteAsJsonAsync(doubleValue, produceTerseOutput); // Assert json.Should().Be(input.ToString()); @@ -164,13 +164,13 @@ from shouldBeTerse in shouldProduceTerseOutputValues [Theory] [MemberData(nameof(StringifiedDateTimes))] - public void WriteOpenApiDateTimeAsJsonWorks(string inputString, bool produceTerseOutput) + public async Task WriteOpenApiDateTimeAsJsonWorksAsync(string inputString, bool produceTerseOutput) { // Arrange var input = DateTimeOffset.Parse(inputString, CultureInfo.InvariantCulture); var dateTimeValue = new OpenApiDateTime(input); - var json = WriteAsJson(dateTimeValue, produceTerseOutput); + var json = await WriteAsJsonAsync(dateTimeValue, produceTerseOutput); var expectedJson = "\"" + input.ToString("o") + "\""; // Assert @@ -187,12 +187,12 @@ from shouldBeTerse in shouldProduceTerseOutputValues [Theory] [MemberData(nameof(BooleanInputs))] - public void WriteOpenApiBooleanAsJsonWorks(bool input, bool produceTerseOutput) + public async Task WriteOpenApiBooleanAsJsonWorksAsync(bool input, bool produceTerseOutput) { // Arrange var boolValue = new OpenApiBoolean(input); - var json = WriteAsJson(boolValue, produceTerseOutput); + var json = await WriteAsJsonAsync(boolValue, produceTerseOutput); // Assert json.Should().Be(input.ToString().ToLower()); @@ -201,7 +201,7 @@ public void WriteOpenApiBooleanAsJsonWorks(bool input, bool produceTerseOutput) [Theory] [InlineData(true)] [InlineData(false)] - public async Task WriteOpenApiObjectAsJsonWorks(bool produceTerseOutput) + public async Task WriteOpenApiObjectAsJsonWorksAsync(bool produceTerseOutput) { // Arrange var openApiObject = new OpenApiObject @@ -217,7 +217,7 @@ public async Task WriteOpenApiObjectAsJsonWorks(bool produceTerseOutput) } }; - var actualJson = WriteAsJson(openApiObject, produceTerseOutput); + var actualJson = WriteAsJsonAsync(openApiObject, produceTerseOutput); // Assert await Verifier.Verify(actualJson).UseParameters(produceTerseOutput); @@ -226,7 +226,7 @@ public async Task WriteOpenApiObjectAsJsonWorks(bool produceTerseOutput) [Theory] [InlineData(true)] [InlineData(false)] - public async Task WriteOpenApiArrayAsJsonWorks(bool produceTerseOutput) + public async Task WriteOpenApiArrayAsJsonWorksAsync(bool produceTerseOutput) { // Arrange var openApiObject = new OpenApiObject @@ -249,17 +249,17 @@ public async Task WriteOpenApiArrayAsJsonWorks(bool produceTerseOutput) new OpenApiString("stringValue2") }; - var actualJson = WriteAsJson(array, produceTerseOutput); + var actualJson = WriteAsJsonAsync(array, produceTerseOutput); // Assert await Verifier.Verify(actualJson).UseParameters(produceTerseOutput); } - private static string WriteAsJson(IOpenApiAny any, bool produceTerseOutput = false) + private static async Task WriteAsJsonAsync(IOpenApiAny any, bool produceTerseOutput = false) { // Arrange (continued) - var stream = new MemoryStream(); - IOpenApiWriter writer = new OpenApiJsonWriter( + using var stream = new MemoryStream(); + var writer = new OpenApiJsonWriter( new StreamWriter(stream), new() { Terse = produceTerseOutput }); @@ -268,7 +268,8 @@ private static string WriteAsJson(IOpenApiAny any, bool produceTerseOutput = fal stream.Position = 0; // Act - var value = new StreamReader(stream).ReadToEnd(); + using var sr = new StreamReader(stream); + var value = await sr.ReadToEndAsync(); if (any.AnyType is AnyType.Primitive or AnyType.Null) {