-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix schema generation for C# 9 positional record with no example (#2901)
* Add schema filter test for when example tag is not present * Add datetime to schema filter example tag positive test * Fix missing example property on record xmldoc param tag causing unexpected empty example string in generated schema
- Loading branch information
Showing
6 changed files
with
161 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
test/Swashbuckle.AspNetCore.SwaggerGen.Test/Fixtures/XmlAnnotatedRecordWithoutExample.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using Swashbuckle.AspNetCore.TestSupport; | ||
|
||
namespace Swashbuckle.AspNetCore.SwaggerGen.Test | ||
{ | ||
/// <summary> | ||
/// Summary for XmlAnnotatedRecordWithoutExample | ||
/// </summary> | ||
/// <param name="BoolProperty">Summary for BoolProperty</param> | ||
/// <param name="IntProperty">Summary for IntProperty</param> | ||
/// <param name="LongProperty">Summary for LongProperty</param> | ||
/// <param name="FloatProperty">Summary for FloatProperty</param> | ||
/// <param name="DoubleProperty">Summary for DoubleProperty</param> | ||
/// <param name="DateTimeProperty">Summary for DateTimeProperty</param> | ||
/// <param name="EnumProperty">Summary for EnumProperty</param> | ||
/// <param name="GuidProperty">Summary for GuidProperty</param> | ||
/// <param name="StringPropertyWithNullExample">Summary for Nullable StringPropertyWithNullExample</param> | ||
/// <param name="StringProperty">Summary for StringProperty</param> | ||
/// <param name="StringPropertyWithUri">Summary for StringPropertyWithUri</param> | ||
/// <param name="ObjectProperty">Summary for ObjectProperty</param> | ||
public record XmlAnnotatedRecordWithoutExample( | ||
bool BoolProperty, | ||
int IntProperty, | ||
long LongProperty, | ||
float FloatProperty, | ||
double DoubleProperty, | ||
DateTime DateTimeProperty, | ||
IntEnum EnumProperty, | ||
Guid GuidProperty, | ||
string StringPropertyWithNullExample, | ||
string StringProperty, | ||
string StringPropertyWithUri, | ||
object ObjectProperty | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
test/Swashbuckle.AspNetCore.SwaggerGen.Test/Fixtures/XmlAnnotatedTypeWithoutExample.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using System; | ||
using Swashbuckle.AspNetCore.TestSupport; | ||
|
||
namespace Swashbuckle.AspNetCore.SwaggerGen.Test | ||
{ | ||
/// <summary> | ||
/// Summary for XmlAnnotatedTypeWithoutExample | ||
/// </summary> | ||
public class XmlAnnotatedTypeWithoutExample | ||
{ | ||
/// <summary> | ||
/// Summary for BoolProperty | ||
/// </summary> | ||
public bool BoolProperty { get; set; } | ||
|
||
/// <summary> | ||
/// Summary for IntProperty | ||
/// </summary> | ||
public int IntProperty { get; set; } | ||
|
||
/// <summary> | ||
/// Summary for LongProperty | ||
/// </summary> | ||
public long LongProperty { get; set; } | ||
|
||
/// <summary> | ||
/// Summary for FloatProperty | ||
/// </summary> | ||
public float FloatProperty { get; set; } | ||
|
||
/// <summary> | ||
/// Summary for DoubleProperty | ||
/// </summary> | ||
public double DoubleProperty { get; set; } | ||
|
||
/// <summary> | ||
/// Summary for DateTimeProperty | ||
/// </summary> | ||
public DateTime DateTimeProperty { get; set; } | ||
|
||
/// <summary> | ||
/// Summary for EnumProperty | ||
/// </summary> | ||
public IntEnum EnumProperty { get; set; } | ||
|
||
/// <summary> | ||
/// Summary for GuidProperty | ||
/// </summary> | ||
public Guid GuidProperty { get; set; } | ||
|
||
/// <summary> | ||
/// Summary for Nullable StringPropertyWithNullExample | ||
/// </summary> | ||
public string StringPropertyWithNullExample { get; set; } | ||
|
||
/// <summary> | ||
/// Summary for StringProperty | ||
/// </summary> | ||
public string StringProperty { get; set; } | ||
|
||
/// <summary> | ||
/// Summary for StringPropertyWithUri | ||
/// </summary> | ||
public string StringPropertyWithUri { get; set; } | ||
|
||
/// <summary> | ||
/// Summary for ObjectProperty | ||
/// </summary> | ||
public object ObjectProperty { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters