Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
…avunen/DotSwashbuckle#1 records are supported
  • Loading branch information
Havunen committed Feb 11, 2024
1 parent 0b8a5d1 commit 2514f8b
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 2 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using DotSwashbuckle.AspNetCore.TestSupport;

namespace DotSwashbuckle.AspNetCore.SwaggerGen.Test.Fixtures
{
/// <summary>
/// Summary for XmlAnnotatedType
/// </summary>
/// <param name="BoolProperty" example="true">Summary for BoolProperty</param>
/// <param name="IntProperty" example="10">Summary for IntProperty</param>
/// <param name="LongProperty" example="4294967295">Summary for LongProperty</param>
/// <param name="FloatProperty" example="1.2">Summary for FloatProperty</param>
/// <param name="DoubleProperty" example="1.25">Summary for DoubleProperty</param>
/// <param name="EnumProperty" example="2">Summary for EnumProperty</param>
/// <param name="GuidProperty" example="d3966535-2637-48fa-b911-e3c27405ee09">Summary for GuidProperty</param>
/// <param name="StringPropertyWithNullExample" example="null">Summary for Nullable StringPropertyWithNullExample</param>
/// <param name="StringProperty" example="Example for StringProperty">Summary for StringProperty</param>
/// <param name="StringPropertyWithUri" example="https://test.com/a?b=1&amp;c=2">Summary for StringPropertyWithUri</param>
/// <param name="ObjectProperty" example="{&quot;prop1&quot;: 1, &quot;prop2&quot;: &quot;foobar&quot;}">Summary for ObjectProperty</param>
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
);
}
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 2514f8b

Please sign in to comment.