From a746e4d0db912f915d11a4a82b84af60fac37858 Mon Sep 17 00:00:00 2001 From: Senn Geerts Date: Tue, 9 Jul 2024 20:51:52 +0200 Subject: [PATCH] #196 Fixed formatting etc + some PR remarks --- .editorconfig | 2 - src/AsyncAPI.Saunter.Generator.Cli/Args.cs | 6 +- .../AsyncAPI.Saunter.Generator.Cli.csproj | 7 +- .../Commands/Tofile.cs | 6 +- .../Commands/TofileInternal.cs | 30 +-- .../Internal/DependencyResolver.cs | 6 +- .../SwashbuckleImport/HostFactoryResolver.cs | 5 +- src/AsyncAPI.Saunter.Generator.Cli/readme.md | 6 +- src/Saunter/AsyncApiOptions.cs | 14 +- .../AsyncApiServiceCollectionExtensions.cs | 10 +- .../DotnetCliToolTests.cs | 6 +- .../PackAndInstallLocalTests.cs | 6 +- .../InterfaceAttributeTests.cs | 214 +++++++++--------- .../AsyncApiTypesTests.cs | 1 - .../SchemaGeneration/SchemaGenerationTests.cs | 30 +-- 15 files changed, 160 insertions(+), 189 deletions(-) diff --git a/.editorconfig b/.editorconfig index 5209be73..20f2dfdc 100644 --- a/.editorconfig +++ b/.editorconfig @@ -144,8 +144,6 @@ dotnet_naming_symbols.all_members.applicable_kinds = * dotnet_naming_style.pascal_case_style.capitalization = pascal_case -file_header_template = Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.\nSee the LICENSE file in the project root for more information. - # RS0016: Only enable if API files are present dotnet_public_api_analyzer.require_api_files = true diff --git a/src/AsyncAPI.Saunter.Generator.Cli/Args.cs b/src/AsyncAPI.Saunter.Generator.Cli/Args.cs index cafc79b3..1100a58b 100644 --- a/src/AsyncAPI.Saunter.Generator.Cli/Args.cs +++ b/src/AsyncAPI.Saunter.Generator.Cli/Args.cs @@ -1,8 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -// ReSharper disable once CheckNamespace +// ReSharper disable once CheckNamespace public static partial class Program { internal const string StartupAssemblyArgument = "startupassembly"; diff --git a/src/AsyncAPI.Saunter.Generator.Cli/AsyncAPI.Saunter.Generator.Cli.csproj b/src/AsyncAPI.Saunter.Generator.Cli/AsyncAPI.Saunter.Generator.Cli.csproj index 472cc32e..0ece5488 100644 --- a/src/AsyncAPI.Saunter.Generator.Cli/AsyncAPI.Saunter.Generator.Cli.csproj +++ b/src/AsyncAPI.Saunter.Generator.Cli/AsyncAPI.Saunter.Generator.Cli.csproj @@ -7,7 +7,7 @@ 12 AsyncAPI.Saunter.Generator.Cli - AsyncAPI Command Line Tools + AsyncAPI Command Line Tools: Dotnet tool to generate AsyncAPI spec file from dotnet startup assembly. AsyncAPI Initiative true AsyncAPI.Saunter.Generator.Cli @@ -23,7 +23,10 @@ false true snupkg - 1.0.1 + + + + true diff --git a/src/AsyncAPI.Saunter.Generator.Cli/Commands/Tofile.cs b/src/AsyncAPI.Saunter.Generator.Cli/Commands/Tofile.cs index a447ce43..1c90a9b9 100644 --- a/src/AsyncAPI.Saunter.Generator.Cli/Commands/Tofile.cs +++ b/src/AsyncAPI.Saunter.Generator.Cli/Commands/Tofile.cs @@ -1,8 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; +using System.Diagnostics; using System.Reflection; using static Program; diff --git a/src/AsyncAPI.Saunter.Generator.Cli/Commands/TofileInternal.cs b/src/AsyncAPI.Saunter.Generator.Cli/Commands/TofileInternal.cs index 5889e5d2..b833d741 100644 --- a/src/AsyncAPI.Saunter.Generator.Cli/Commands/TofileInternal.cs +++ b/src/AsyncAPI.Saunter.Generator.Cli/Commands/TofileInternal.cs @@ -1,24 +1,18 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using LEGO.AsyncAPI.Readers; -using Microsoft.Extensions.Options; -using Saunter.Serialization; -using Saunter; +using System.Reflection; using System.Runtime.Loader; -using System.Reflection; +using AsyncApi.Saunter.Generator.Cli.SwashbuckleImport; using LEGO.AsyncAPI; using LEGO.AsyncAPI.Models; -using Microsoft.Extensions.DependencyInjection; -using AsyncApi.Saunter.Generator.Cli.SwashbuckleImport; -using Microsoft.AspNetCore.Hosting; +using LEGO.AsyncAPI.Readers; using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Saunter.AsyncApiSchema.v2; +using Microsoft.Extensions.Options; +using Saunter; +using Saunter.Serialization; using static Program; using AsyncApiDocument = Saunter.AsyncApiSchema.v2.AsyncApiDocument; -using System.IO; namespace AsyncApi.Saunter.Generator.Cli.Commands; @@ -35,13 +29,13 @@ internal static int Run(IDictionary namedArgs) var envVars = (namedArgs.TryGetValue(EnvOption, out var x) && !string.IsNullOrWhiteSpace(x)) ? x.Split(',').Select(x => x.Trim()) : Array.Empty(); foreach (var envVar in envVars.Select(x => x.Split('=').Select(x => x.Trim()).ToList())) { - if (envVar.Count == 2) + if (envVar.Count is 1 or 2) { - Environment.SetEnvironmentVariable(envVar[0], envVar[1], EnvironmentVariableTarget.Process); + Environment.SetEnvironmentVariable(envVar[0], envVar.ElementAtOrDefault(1), EnvironmentVariableTarget.Process); } else { - throw new ArgumentOutOfRangeException(EnvOption, namedArgs[EnvOption], "Environment variable should be in the format: env1=value1,env2=value2"); + throw new ArgumentOutOfRangeException(EnvOption, namedArgs[EnvOption], "Environment variable should be in the format: env1=value1,env2=value2,env3"); } } var serviceProvider = GetServiceProvider(startupAssembly); @@ -51,7 +45,7 @@ internal static int Run(IDictionary namedArgs) var asyncapiOptions = serviceProvider.GetService>().Value; var documentSerializer = serviceProvider.GetRequiredService(); - var documentNames = (namedArgs.TryGetValue(DocOption, out var doc) && !string.IsNullOrWhiteSpace(doc)) ? [doc] : asyncapiOptions.NamedApis.Keys; + var documentNames = (namedArgs.TryGetValue(DocOption, out var doc) && !string.IsNullOrWhiteSpace(doc)) ? [doc] : asyncapiOptions.NamedApis.Keys; var fileTemplate = (namedArgs.TryGetValue(FileNameOption, out var template) && !string.IsNullOrWhiteSpace(template)) ? template : "{document}_asyncapi.{extension}"; if (documentNames.Count == 0) { diff --git a/src/AsyncAPI.Saunter.Generator.Cli/Internal/DependencyResolver.cs b/src/AsyncAPI.Saunter.Generator.Cli/Internal/DependencyResolver.cs index e6ef1bc3..d136cf1f 100644 --- a/src/AsyncAPI.Saunter.Generator.Cli/Internal/DependencyResolver.cs +++ b/src/AsyncAPI.Saunter.Generator.Cli/Internal/DependencyResolver.cs @@ -1,8 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Reflection; +using System.Reflection; namespace AsyncAPI.Saunter.Generator.Cli.Internal; diff --git a/src/AsyncAPI.Saunter.Generator.Cli/SwashbuckleImport/HostFactoryResolver.cs b/src/AsyncAPI.Saunter.Generator.Cli/SwashbuckleImport/HostFactoryResolver.cs index 29d3e96e..266e47f4 100644 --- a/src/AsyncAPI.Saunter.Generator.Cli/SwashbuckleImport/HostFactoryResolver.cs +++ b/src/AsyncAPI.Saunter.Generator.Cli/SwashbuckleImport/HostFactoryResolver.cs @@ -1,7 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System.Diagnostics; +using System.Diagnostics; using System.Reflection; namespace Microsoft.Extensions.Hosting; diff --git a/src/AsyncAPI.Saunter.Generator.Cli/readme.md b/src/AsyncAPI.Saunter.Generator.Cli/readme.md index 8eb9a503..05c42764 100644 --- a/src/AsyncAPI.Saunter.Generator.Cli/readme.md +++ b/src/AsyncAPI.Saunter.Generator.Cli/readme.md @@ -5,14 +5,14 @@ A dotnet tool to generate AsyncAPI specification files based of a dotnet DLL (Th ``` dotnet asyncapi tofile --output [output-path] --format [json,yml,yaml] --doc [asyncapi-document-name] [startup-assembly] ``` -startup-assembly: the file path to the entrypoint dotnet DLL that hosts AsyncAPI document(s). +- _startup-assembly_: the file path to the entrypoint dotnet DLL that hosts AsyncAPI document(s). ## Tool options - _--doc_: The name of the AsyncAPI document as defined in the startup class by the ```.ConfigureNamedAsyncApi()```-method. If only ```.AddAsyncApiSchemaGeneration()``` is used, the document is unnamed and will always be exported. If not specified, all documents will be exported. - _--output_: relative path where the AsyncAPI will be output [defaults to stdout] - _--filename_: the template for the outputted file names. Default: "{document}_asyncapi.{extension}" -- _--format_: the output formats to generate, can be a combination of json, yml and/or yaml. File extension is appended to the output path. -- _--env_: define environment variable(s) for the application +- _--format_: the output formats to generate, can be a combination of json, yml and/or yaml. +- _--env_: define environment variable(s) for the application. Formatted as a comma separated list of _key=value_ pairs or just _key_ for flags, example: ```ASPNETCORE_ENVIRONMENT=AsyncAPI,CONNECT_TO_DATABASE=false,GENERATOR_FLAG```. ## Install the Generator.Cli dotnet Tool ``` diff --git a/src/Saunter/AsyncApiOptions.cs b/src/Saunter/AsyncApiOptions.cs index cc64cc55..cdd410fb 100644 --- a/src/Saunter/AsyncApiOptions.cs +++ b/src/Saunter/AsyncApiOptions.cs @@ -1,13 +1,13 @@ using System; using System.Collections.Concurrent; -using System.Collections.Generic; - +using System.Collections.Generic; + using Newtonsoft.Json; using Newtonsoft.Json.Serialization; - + using NJsonSchema; using NJsonSchema.NewtonsoftJson.Generation; - + using Saunter.AsyncApiSchema.v2; using Saunter.Generation.Filters; using Saunter.Generation.SchemaGeneration; @@ -90,10 +90,10 @@ public void AddOperationFilter() where T : IOperationFilter public class AsyncApiSchemaOptions : NewtonsoftJsonSchemaGeneratorSettings { - public AsyncApiSchemaOptions() + public AsyncApiSchemaOptions() { SchemaType = SchemaType.JsonSchema; // AsyncAPI uses json-schema, see https://github.com/tehmantra/saunter/pull/103#issuecomment-893267360 - TypeNameGenerator = new CamelCaseTypeNameGenerator(); + TypeNameGenerator = new CamelCaseTypeNameGenerator(); SerializerSettings = new JsonSerializerSettings() { ContractResolver = new CamelCasePropertyNamesContractResolver(), @@ -120,4 +120,4 @@ public class AsyncApiMiddlewareOptions /// public string UiTitle { get; set; } = "AsyncAPI"; } -} +} diff --git a/src/Saunter/AsyncApiServiceCollectionExtensions.cs b/src/Saunter/AsyncApiServiceCollectionExtensions.cs index 288001cb..cf2ac39c 100644 --- a/src/Saunter/AsyncApiServiceCollectionExtensions.cs +++ b/src/Saunter/AsyncApiServiceCollectionExtensions.cs @@ -1,8 +1,8 @@ -using System; - +using System; + using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; - +using Microsoft.Extensions.DependencyInjection.Extensions; + using Saunter.AsyncApiSchema.v2; using Saunter.Generation; using Saunter.Serialization; @@ -57,4 +57,4 @@ public static IServiceCollection ConfigureNamedAsyncApi(this IServiceCollection return services; } } -} +} diff --git a/test/AsyncAPI.Saunter.Generator.Cli.Tests/DotnetCliToolTests.cs b/test/AsyncAPI.Saunter.Generator.Cli.Tests/DotnetCliToolTests.cs index 97258c87..47746fc8 100644 --- a/test/AsyncAPI.Saunter.Generator.Cli.Tests/DotnetCliToolTests.cs +++ b/test/AsyncAPI.Saunter.Generator.Cli.Tests/DotnetCliToolTests.cs @@ -1,8 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; +using System.Diagnostics; using Shouldly; using Xunit.Abstractions; diff --git a/test/AsyncAPI.Saunter.Generator.Cli.Tests/PackAndInstallLocalTests.cs b/test/AsyncAPI.Saunter.Generator.Cli.Tests/PackAndInstallLocalTests.cs index 79d9844d..2bf87baf 100644 --- a/test/AsyncAPI.Saunter.Generator.Cli.Tests/PackAndInstallLocalTests.cs +++ b/test/AsyncAPI.Saunter.Generator.Cli.Tests/PackAndInstallLocalTests.cs @@ -1,8 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; +using System.Diagnostics; using Shouldly; using Xunit.Abstractions; diff --git a/test/Saunter.Tests/Generation/DocumentGeneratorTests/InterfaceAttributeTests.cs b/test/Saunter.Tests/Generation/DocumentGeneratorTests/InterfaceAttributeTests.cs index a5183890..f520bd10 100644 --- a/test/Saunter.Tests/Generation/DocumentGeneratorTests/InterfaceAttributeTests.cs +++ b/test/Saunter.Tests/Generation/DocumentGeneratorTests/InterfaceAttributeTests.cs @@ -1,107 +1,107 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Reflection; -using Saunter.AsyncApiSchema.v2; -using Saunter.Attributes; -using Saunter.Generation; -using Shouldly; -using Xunit; -using System.Linq; - -namespace Saunter.Tests.Generation.DocumentGeneratorTests -{ - public class InterfaceAttributeTests - { - [Theory] - [InlineData(typeof(IServiceEvents))] - [InlineData(typeof(ServiceEventsFromInterface))] - [InlineData(typeof(ServiceEventsFromAnnotatedInterface))] // Check that annotations are not inherited from the interface - public void NonAnnotatedTypesTest(Type type) - { - // Arrange - var options = new AsyncApiOptions(); - var documentGenerator = new DocumentGenerator(); - - // Act - var document = documentGenerator.GenerateDocument(new[] { type.GetTypeInfo() }, options, options.AsyncApi, ActivatorServiceProvider.Instance); - - // Assert - document.ShouldNotBeNull(); - document.Channels.Count.ShouldBe(0); - } - - [Theory] - [InlineData(typeof(IAnnotatedServiceEvents), "interface")] - [InlineData(typeof(AnnotatedServiceEventsFromInterface), "class")] - [InlineData(typeof(AnnotatedServiceEventsFromAnnotatedInterface), "class")] // Check that the actual type's annotation takes precedence of the inherited interface - public void AnnotatedTypesTest(Type type, string source) - { - // Arrange - var options = new AsyncApiOptions(); - var documentGenerator = new DocumentGenerator(); - - // Act - var document = documentGenerator.GenerateDocument(new[] { type.GetTypeInfo() }, options, options.AsyncApi, ActivatorServiceProvider.Instance); - - // Assert - document.ShouldNotBeNull(); - document.Channels.Count.ShouldBe(1); - - var channel = document.Channels.First(); - channel.Key.ShouldBe($"{source}.event"); - channel.Value.Description.ShouldBeNull(); - - var publish = channel.Value.Publish; - publish.ShouldNotBeNull(); - publish.OperationId.ShouldBe("PublishEvent"); - publish.Description.ShouldBe($"({source}) Subscribe to domains events about a tenant."); - - var messageRef = publish.Message.ShouldBeOfType(); - messageRef.Id.ShouldBe("tenantEvent"); - } - - [AsyncApi] - private interface IAnnotatedServiceEvents - { - [Channel("interface.event")] - [PublishOperation(typeof(TenantEvent), Description = "(interface) Subscribe to domains events about a tenant.")] - void PublishEvent(TenantEvent evt); - } - - private interface IServiceEvents - { - void PublishEvent(TenantEvent evt); - } - - private class ServiceEventsFromInterface : IServiceEvents - { - public void PublishEvent(TenantEvent evt) { } - } - - private class ServiceEventsFromAnnotatedInterface : IAnnotatedServiceEvents - { - public void PublishEvent(TenantEvent evt) { } - } - - [AsyncApi] - private class AnnotatedServiceEventsFromInterface : IAnnotatedServiceEvents - { - [Channel("class.event")] - [PublishOperation(typeof(TenantEvent), Description = "(class) Subscribe to domains events about a tenant.")] - public void PublishEvent(TenantEvent evt) { } - } - - [AsyncApi] - private class AnnotatedServiceEventsFromAnnotatedInterface : IAnnotatedServiceEvents - { - [Channel("class.event")] - [PublishOperation(typeof(TenantEvent), Description = "(class) Subscribe to domains events about a tenant.")] - public void PublishEvent(TenantEvent evt) { } - } - - private class TenantEvent { } - } -} +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Reflection; +using Saunter.AsyncApiSchema.v2; +using Saunter.Attributes; +using Saunter.Generation; +using Shouldly; +using Xunit; +using System.Linq; + +namespace Saunter.Tests.Generation.DocumentGeneratorTests +{ + public class InterfaceAttributeTests + { + [Theory] + [InlineData(typeof(IServiceEvents))] + [InlineData(typeof(ServiceEventsFromInterface))] + [InlineData(typeof(ServiceEventsFromAnnotatedInterface))] // Check that annotations are not inherited from the interface + public void NonAnnotatedTypesTest(Type type) + { + // Arrange + var options = new AsyncApiOptions(); + var documentGenerator = new DocumentGenerator(); + + // Act + var document = documentGenerator.GenerateDocument(new[] { type.GetTypeInfo() }, options, options.AsyncApi, ActivatorServiceProvider.Instance); + + // Assert + document.ShouldNotBeNull(); + document.Channels.Count.ShouldBe(0); + } + + [Theory] + [InlineData(typeof(IAnnotatedServiceEvents), "interface")] + [InlineData(typeof(AnnotatedServiceEventsFromInterface), "class")] + [InlineData(typeof(AnnotatedServiceEventsFromAnnotatedInterface), "class")] // Check that the actual type's annotation takes precedence of the inherited interface + public void AnnotatedTypesTest(Type type, string source) + { + // Arrange + var options = new AsyncApiOptions(); + var documentGenerator = new DocumentGenerator(); + + // Act + var document = documentGenerator.GenerateDocument(new[] { type.GetTypeInfo() }, options, options.AsyncApi, ActivatorServiceProvider.Instance); + + // Assert + document.ShouldNotBeNull(); + document.Channels.Count.ShouldBe(1); + + var channel = document.Channels.First(); + channel.Key.ShouldBe($"{source}.event"); + channel.Value.Description.ShouldBeNull(); + + var publish = channel.Value.Publish; + publish.ShouldNotBeNull(); + publish.OperationId.ShouldBe("PublishEvent"); + publish.Description.ShouldBe($"({source}) Subscribe to domains events about a tenant."); + + var messageRef = publish.Message.ShouldBeOfType(); + messageRef.Id.ShouldBe("tenantEvent"); + } + + [AsyncApi] + private interface IAnnotatedServiceEvents + { + [Channel("interface.event")] + [PublishOperation(typeof(TenantEvent), Description = "(interface) Subscribe to domains events about a tenant.")] + void PublishEvent(TenantEvent evt); + } + + private interface IServiceEvents + { + void PublishEvent(TenantEvent evt); + } + + private class ServiceEventsFromInterface : IServiceEvents + { + public void PublishEvent(TenantEvent evt) { } + } + + private class ServiceEventsFromAnnotatedInterface : IAnnotatedServiceEvents + { + public void PublishEvent(TenantEvent evt) { } + } + + [AsyncApi] + private class AnnotatedServiceEventsFromInterface : IAnnotatedServiceEvents + { + [Channel("class.event")] + [PublishOperation(typeof(TenantEvent), Description = "(class) Subscribe to domains events about a tenant.")] + public void PublishEvent(TenantEvent evt) { } + } + + [AsyncApi] + private class AnnotatedServiceEventsFromAnnotatedInterface : IAnnotatedServiceEvents + { + [Channel("class.event")] + [PublishOperation(typeof(TenantEvent), Description = "(class) Subscribe to domains events about a tenant.")] + public void PublishEvent(TenantEvent evt) { } + } + + private class TenantEvent { } + } +} diff --git a/test/Saunter.Tests/Generation/DocumentProviderTests/AsyncApiTypesTests.cs b/test/Saunter.Tests/Generation/DocumentProviderTests/AsyncApiTypesTests.cs index c3692640..c7806ae5 100644 --- a/test/Saunter.Tests/Generation/DocumentProviderTests/AsyncApiTypesTests.cs +++ b/test/Saunter.Tests/Generation/DocumentProviderTests/AsyncApiTypesTests.cs @@ -1,7 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Saunter.AsyncApiSchema.v2; -using Saunter.Attributes; using Saunter.Tests.MarkerTypeTests; using Shouldly; using Xunit; diff --git a/test/Saunter.Tests/Generation/SchemaGeneration/SchemaGenerationTests.cs b/test/Saunter.Tests/Generation/SchemaGeneration/SchemaGenerationTests.cs index 41d11a8c..b836fa00 100644 --- a/test/Saunter.Tests/Generation/SchemaGeneration/SchemaGenerationTests.cs +++ b/test/Saunter.Tests/Generation/SchemaGeneration/SchemaGenerationTests.cs @@ -1,23 +1,23 @@ using System; using System.ComponentModel.DataAnnotations; using System.Linq; -using System.Runtime.Serialization; - +using System.Runtime.Serialization; + using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; - +using Newtonsoft.Json.Serialization; + using NJsonSchema; using NJsonSchema.Generation; -using NJsonSchema.NewtonsoftJson.Converters; - +using NJsonSchema.NewtonsoftJson.Converters; + using Saunter.AsyncApiSchema.v2; using Saunter.Generation.SchemaGeneration; -using Saunter.Tests.Utils; - -using Shouldly; - -using Xunit; - +using Saunter.Tests.Utils; + +using Shouldly; + +using Xunit; + using JsonInheritanceAttribute = NJsonSchema.NewtonsoftJson.Converters.JsonInheritanceAttribute; namespace Saunter.Tests.Generation.SchemaGeneration @@ -97,8 +97,8 @@ public void GenerateSchema_GenerateSchemaFromClassWithDiscriminator_GeneratesSch var schema = _schemaGenerator.Generate(type, _schemaResolver); - schema.ShouldNotBeNull(); - + schema.ShouldNotBeNull(); + _schemaResolver.Schemas.ShouldNotBeNull(); var petSchema = _schemaResolver.Schemas.FirstOrDefault(s => s.Id == "pet"); petSchema.Discriminator.ShouldBe("petType"); @@ -242,4 +242,4 @@ public class Dog : Pet { public string PackSize { get; set; } } -} +}