diff --git a/src/Saunter/AsyncApiSchema/v2/AsyncApiDocument.cs b/src/Saunter/AsyncApiSchema/v2/AsyncApiDocument.cs index 1a55f08d..dc7f15c8 100644 --- a/src/Saunter/AsyncApiSchema/v2/AsyncApiDocument.cs +++ b/src/Saunter/AsyncApiSchema/v2/AsyncApiDocument.cs @@ -87,6 +87,7 @@ public AsyncApiDocument Clone() clone.Info = Info; clone.Id = Id; clone.DefaultContentType = DefaultContentType; + clone.DocumentName = DocumentName; clone.Channels = Channels.ToDictionary(p => p.Key, p => p.Value); clone.Servers = Servers.ToDictionary(p => p.Key, p => p.Value); foreach (var tag in Tags) diff --git a/test/Saunter.Tests/Generation/Filters/DocumentFilterTests.cs b/test/Saunter.Tests/Generation/Filters/DocumentFilterTests.cs index 150bab95..3640ca16 100644 --- a/test/Saunter.Tests/Generation/Filters/DocumentFilterTests.cs +++ b/test/Saunter.Tests/Generation/Filters/DocumentFilterTests.cs @@ -27,7 +27,24 @@ public void DocumentFilterIsAppliedToAsyncApiDocument() document.Channels.ShouldContainKey("foo"); } + [Fact] + public void DocumentNameIsAppliedToAsyncApiDocument() + { + // Arrange + const string documentName = "Test Document"; + var options = new AsyncApiOptions(); + options.AsyncApi.DocumentName = documentName; + var documentGenerator = new DocumentGenerator(); + // Act + options.AddDocumentFilter(); + var document = documentGenerator.GenerateDocument(new[] { GetType().GetTypeInfo() }, options, options.AsyncApi, ActivatorServiceProvider.Instance); + + // Assert + document.ShouldNotBeNull(); + document.DocumentName.ShouldBe(documentName); + } + private class ExampleDocumentFilter : IDocumentFilter { public void Apply(AsyncApiDocument document, DocumentFilterContext context)