diff --git a/test/DotSwashbuckle.AspNetCore.SwaggerGen.Test/DotSwashbuckle.AspNetCore.SwaggerGen.Test.xml b/test/DotSwashbuckle.AspNetCore.SwaggerGen.Test/DotSwashbuckle.AspNetCore.SwaggerGen.Test.xml index a94f9b7..6edb2b1 100644 --- a/test/DotSwashbuckle.AspNetCore.SwaggerGen.Test/DotSwashbuckle.AspNetCore.SwaggerGen.Test.xml +++ b/test/DotSwashbuckle.AspNetCore.SwaggerGen.Test/DotSwashbuckle.AspNetCore.SwaggerGen.Test.xml @@ -43,6 +43,71 @@ Description for 200 response Description for 400 response + + + Summary for XmlAnnotatedType + + Summary for BoolProperty + Summary for IntProperty + Summary for LongProperty + Summary for FloatProperty + Summary for DoubleProperty + Summary for EnumProperty + Summary for GuidProperty + Summary for Nullable StringPropertyWithNullExample + Summary for StringProperty + Summary for StringPropertyWithUri + Summary for ObjectProperty + + + + Summary for XmlAnnotatedType + + Summary for BoolProperty + Summary for IntProperty + Summary for LongProperty + Summary for FloatProperty + Summary for DoubleProperty + Summary for EnumProperty + Summary for GuidProperty + Summary for Nullable StringPropertyWithNullExample + Summary for StringProperty + Summary for StringPropertyWithUri + Summary for ObjectProperty + + + Summary for BoolProperty + + + Summary for IntProperty + + + Summary for LongProperty + + + Summary for FloatProperty + + + Summary for DoubleProperty + + + Summary for EnumProperty + + + Summary for GuidProperty + + + Summary for Nullable StringPropertyWithNullExample + + + Summary for StringProperty + + + Summary for StringPropertyWithUri + + + Summary for ObjectProperty + Summary for XmlRemarkAnnotatedType diff --git a/test/DotSwashbuckle.AspNetCore.SwaggerGen.Test/Fixtures/XmlAnnotatedRecord.cs b/test/DotSwashbuckle.AspNetCore.SwaggerGen.Test/Fixtures/XmlAnnotatedRecord.cs new file mode 100644 index 0000000..8392822 --- /dev/null +++ b/test/DotSwashbuckle.AspNetCore.SwaggerGen.Test/Fixtures/XmlAnnotatedRecord.cs @@ -0,0 +1,33 @@ +using System; +using DotSwashbuckle.AspNetCore.TestSupport; + +namespace DotSwashbuckle.AspNetCore.SwaggerGen.Test.Fixtures +{ + /// + /// Summary for XmlAnnotatedType + /// + /// Summary for BoolProperty + /// Summary for IntProperty + /// Summary for LongProperty + /// Summary for FloatProperty + /// Summary for DoubleProperty + /// Summary for EnumProperty + /// Summary for GuidProperty + /// Summary for Nullable StringPropertyWithNullExample + /// Summary for StringProperty + /// Summary for StringPropertyWithUri + /// Summary for ObjectProperty + public record XmlAnnotatedRecord( + bool BoolProperty, + int IntProperty, + long LongProperty, + float FloatProperty, + double DoubleProperty, + IntEnum EnumProperty, + Guid GuidProperty, + string StringPropertyWithNullExample, + string StringProperty, + string StringPropertyWithUri, + object ObjectProperty + ); +} diff --git a/test/DotSwashbuckle.AspNetCore.SwaggerGen.Test/XmlComments/XmlCommentsSchemaFilterTests.cs b/test/DotSwashbuckle.AspNetCore.SwaggerGen.Test/XmlComments/XmlCommentsSchemaFilterTests.cs index cfb8e36..f239f7c 100644 --- a/test/DotSwashbuckle.AspNetCore.SwaggerGen.Test/XmlComments/XmlCommentsSchemaFilterTests.cs +++ b/test/DotSwashbuckle.AspNetCore.SwaggerGen.Test/XmlComments/XmlCommentsSchemaFilterTests.cs @@ -1,7 +1,5 @@ using System; using System.Globalization; -using System.Xml.XPath; -using System.IO; using DotSwashbuckle.AspNetCore.SwaggerGen.Test.Fixtures; using Microsoft.OpenApi.Models; using Xunit; @@ -76,6 +74,17 @@ public void Apply_SetsDescription_FromPropertySummaryTag( [InlineData(typeof(XmlAnnotatedType), nameof(XmlAnnotatedType.StringPropertyWithNullExample), "string", "null")] [InlineData(typeof(XmlAnnotatedType), nameof(XmlAnnotatedType.StringPropertyWithUri), "string", "\"https://test.com/a?b=1&c=2\"")] [InlineData(typeof(XmlAnnotatedType), nameof(XmlAnnotatedType.MultiLineSummaryExample), "string", "\"When Number equals 2023/S 106-333284 Then Publication = 333284-2023\"")] + [InlineData(typeof(XmlAnnotatedRecord), nameof(XmlAnnotatedRecord.BoolProperty), "boolean", "true")] + [InlineData(typeof(XmlAnnotatedRecord), nameof(XmlAnnotatedRecord.IntProperty), "integer", "10")] + [InlineData(typeof(XmlAnnotatedRecord), nameof(XmlAnnotatedRecord.LongProperty), "integer", "4294967295")] + [InlineData(typeof(XmlAnnotatedRecord), nameof(XmlAnnotatedRecord.FloatProperty), "number", "1.2")] + [InlineData(typeof(XmlAnnotatedRecord), nameof(XmlAnnotatedRecord.DoubleProperty), "number", "1.25")] + [InlineData(typeof(XmlAnnotatedRecord), nameof(XmlAnnotatedRecord.EnumProperty), "integer", "2")] + [InlineData(typeof(XmlAnnotatedRecord), nameof(XmlAnnotatedRecord.GuidProperty), "string", "\"d3966535-2637-48fa-b911-e3c27405ee09\"")] + [InlineData(typeof(XmlAnnotatedRecord), nameof(XmlAnnotatedRecord.StringProperty), "string", "\"Example for StringProperty\"")] + [InlineData(typeof(XmlAnnotatedRecord), nameof(XmlAnnotatedRecord.ObjectProperty), "object", "{\n \"prop1\": 1,\n \"prop2\": \"foobar\"\n}")] + [InlineData(typeof(XmlAnnotatedRecord), nameof(XmlAnnotatedRecord.StringPropertyWithNullExample), "string", "null")] + [InlineData(typeof(XmlAnnotatedRecord), nameof(XmlAnnotatedRecord.StringPropertyWithUri), "string", "\"https://test.com/a?b=1&c=2\"")] [UseInvariantCulture] public void Apply_SetsExample_FromPropertyExampleTag( Type declaringType,