forked from domaindrivendev/Swashbuckle.AspNetCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Mark non-nullable properties required when SupportNonNullableReferenc…
…eTypes is enabled and property is declared non-nullable. Fixes domaindrivendev#2623 for #3
- Loading branch information
Showing
5 changed files
with
128 additions
and
5 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
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
67 changes: 67 additions & 0 deletions
67
...otSwashbuckle.AspNetCore.SwaggerGen.Test/Fixtures/RecordsWithNullableAndRequiredParams.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,67 @@ | ||
namespace DotSwashbuckle.AspNetCore.SwaggerGen.Test.Fixtures | ||
{ | ||
public sealed class TestClass | ||
{ | ||
public TestClass(string requiredString, string optionalString) | ||
{ | ||
RequiredString = requiredString; | ||
OptionalString = optionalString; | ||
} | ||
|
||
public string RequiredString { get; } | ||
public string? OptionalString { get; } | ||
} | ||
|
||
public sealed record TestRecordPrimary(string RequiredString, string? OptionalString); | ||
public sealed record TestRecordPrimaryInverse(string? OptionalString, string RequiredString); | ||
|
||
public sealed record TestValueRecordPrimary(int RequiredString, int? OptionalString); | ||
public sealed record TestValueRecordPrimaryInverse(int? OptionalString, int RequiredString); | ||
|
||
public sealed record TestRecord | ||
{ | ||
public TestRecord(string requiredString, string? optionalString) | ||
{ | ||
RequiredString = requiredString; | ||
OptionalString = optionalString; | ||
} | ||
|
||
public string RequiredString { get; } | ||
|
||
public string? OptionalString { get; } | ||
} | ||
|
||
public sealed record TestRecordInitOptional | ||
{ | ||
public TestRecordInitOptional(string? optionalString) | ||
{ | ||
OptionalString = optionalString; | ||
} | ||
|
||
public string RequiredString { get; set; } = string.Empty; | ||
|
||
public string? OptionalString { get; } | ||
} | ||
|
||
public sealed record TestRecordInitRequired | ||
{ | ||
public TestRecordInitRequired(string requiredString) | ||
{ | ||
RequiredString = requiredString; | ||
} | ||
|
||
public string RequiredString { get; } | ||
|
||
public string? OptionalString { get; set; } | ||
} | ||
|
||
public sealed record TestRecordMixed(string RequiredString) | ||
{ | ||
public string? OptionalString { get; } | ||
} | ||
|
||
public sealed record TestRecordMixedSwapped(string? OptionalString) | ||
{ | ||
public string RequiredString { get; set; } = string.Empty; | ||
} | ||
} |
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