diff --git a/README.md b/README.md index 3d3d6635a2..5edd42845e 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ The following steps describe how to create a JSON:API project. public class Person : Identifiable { [Attr] public string? FirstName { get; set; } - [Attr] public string LastName { get; set; } = null!; + [Attr] public required string LastName { get; set; } [HasMany] public ISet Children { get; set; } = new HashSet(); } ``` diff --git a/benchmarks/Deserialization/DeserializationBenchmarkBase.cs b/benchmarks/Deserialization/DeserializationBenchmarkBase.cs index 018f220994..ce551cf6b8 100644 --- a/benchmarks/Deserialization/DeserializationBenchmarkBase.cs +++ b/benchmarks/Deserialization/DeserializationBenchmarkBase.cs @@ -89,7 +89,7 @@ public sealed class IncomingResource : Identifiable public float? Attribute05 { get; set; } [Attr] - public string Attribute06 { get; set; } = null!; + public required string Attribute06 { get; set; } [Attr] public DateTime? Attribute07 { get; set; } @@ -104,33 +104,33 @@ public sealed class IncomingResource : Identifiable public DayOfWeek Attribute10 { get; set; } [HasOne] - public IncomingResource Single1 { get; set; } = null!; + public required IncomingResource Single1 { get; set; } [HasOne] - public IncomingResource Single2 { get; set; } = null!; + public required IncomingResource Single2 { get; set; } [HasOne] - public IncomingResource Single3 { get; set; } = null!; + public required IncomingResource Single3 { get; set; } [HasOne] - public IncomingResource Single4 { get; set; } = null!; + public required IncomingResource Single4 { get; set; } [HasOne] - public IncomingResource Single5 { get; set; } = null!; + public required IncomingResource Single5 { get; set; } [HasMany] - public ISet Multi1 { get; set; } = null!; + public required ISet Multi1 { get; set; } [HasMany] - public ISet Multi2 { get; set; } = null!; + public required ISet Multi2 { get; set; } [HasMany] - public ISet Multi3 { get; set; } = null!; + public required ISet Multi3 { get; set; } [HasMany] - public ISet Multi4 { get; set; } = null!; + public required ISet Multi4 { get; set; } [HasMany] - public ISet Multi5 { get; set; } = null!; + public required ISet Multi5 { get; set; } } } diff --git a/benchmarks/Serialization/SerializationBenchmarkBase.cs b/benchmarks/Serialization/SerializationBenchmarkBase.cs index 2ab328c074..3b1f77c15c 100644 --- a/benchmarks/Serialization/SerializationBenchmarkBase.cs +++ b/benchmarks/Serialization/SerializationBenchmarkBase.cs @@ -73,7 +73,7 @@ public sealed class OutgoingResource : Identifiable public float? Attribute05 { get; set; } [Attr] - public string Attribute06 { get; set; } = null!; + public required string Attribute06 { get; set; } [Attr] public DateTime? Attribute07 { get; set; } diff --git a/docs/home/index.html b/docs/home/index.html index 7023e2ddc6..388c91d598 100644 --- a/docs/home/index.html +++ b/docs/home/index.html @@ -189,7 +189,7 @@

Resource

{ [Attr] [MaxLength(30)] - public string Title { get; set; } = null!; + public required string Title { get; set; } [Attr(Capabilities = AttrCapabilities.AllowFilter)] public string? Summary { get; set; } @@ -205,7 +205,7 @@

Resource

public DateTimeOffset LastModifiedAt { get; set; } [HasOne] - public Person Author { get; set; } = null!; + public required required Person Author { get; set; } [HasOne] public Person? Reviewer { get; set; } diff --git a/docs/usage/common-pitfalls.md b/docs/usage/common-pitfalls.md index 60162cfd37..a4d03fb168 100644 --- a/docs/usage/common-pitfalls.md +++ b/docs/usage/common-pitfalls.md @@ -17,7 +17,7 @@ Now let's try to define the resource classes: public sealed class WebCustomer : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasOne] public LoginAccount? Account { get; set; } @@ -27,7 +27,7 @@ public sealed class WebCustomer : Identifiable public sealed class AdminCustomer : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public string? CreditRating { get; set; } @@ -40,7 +40,7 @@ public sealed class AdminCustomer : Identifiable public sealed class LoginAccount : Identifiable { [Attr] - public string EmailAddress { get; set; } = null!; + public required string EmailAddress { get; set; } [HasOne] public ??? Customer { get; set; } diff --git a/docs/usage/options.md b/docs/usage/options.md index 9b900f3973..7af55776c0 100644 --- a/docs/usage/options.md +++ b/docs/usage/options.md @@ -141,13 +141,13 @@ public class Person : Identifiable { [Attr] [MinLength(3)] - public string FirstName { get; set; } = null!; + public required string FirstName { get; set; } [Attr] [Required] public int? Age { get; set; } [HasOne] - public LoginAccount Account { get; set; } = null!; + public required LoginAccount Account { get; set; } } ``` diff --git a/docs/usage/resources/attributes.md b/docs/usage/resources/attributes.md index 42a2aa2600..b683f39154 100644 --- a/docs/usage/resources/attributes.md +++ b/docs/usage/resources/attributes.md @@ -11,7 +11,7 @@ public class Person : Identifiable public string? FirstName { get; set; } [Attr] - public string LastName { get; set; } = null!; + public required string LastName { get; set; } } ``` @@ -54,7 +54,7 @@ Otherwise, the attribute is silently omitted. public class User : Identifiable { [Attr(Capabilities = ~AttrCapabilities.AllowView)] - public string Password { get; set; } = null!; + public required string Password { get; set; } } ``` diff --git a/docs/usage/resources/inheritance.md b/docs/usage/resources/inheritance.md index 56c046ef82..7004ddcad6 100644 --- a/docs/usage/resources/inheritance.md +++ b/docs/usage/resources/inheritance.md @@ -10,7 +10,7 @@ Resource classes can be part of a type hierarchy. For example: public abstract class Human : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasOne] public Man? Father { get; set; } diff --git a/docs/usage/resources/nullability.md b/docs/usage/resources/nullability.md index 7c600131d0..5fdbe4d0d5 100644 --- a/docs/usage/resources/nullability.md +++ b/docs/usage/resources/nullability.md @@ -72,13 +72,13 @@ Example: public sealed class Label : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public string? RgbColor { get; set; } [HasOne] - public Person Creator { get; set; } = null!; + public required Person Creator { get; set; } [HasOne] public Label? Parent { get; set; } diff --git a/docs/usage/resources/relationships.md b/docs/usage/resources/relationships.md index 30e90c359c..a42cff1bf7 100644 --- a/docs/usage/resources/relationships.md +++ b/docs/usage/resources/relationships.md @@ -39,7 +39,7 @@ The next example defines that each car requires an engine, while an engine is op public sealed class Car : Identifiable { [HasOne] - public Engine Engine { get; set; } = null!; + public required Engine Engine { get; set; } } public sealed class Engine : Identifiable @@ -264,7 +264,7 @@ There are two ways the exposed relationship name is determined: public class TodoItem : Identifiable { [HasOne(PublicName = "item-owner")] - public Person Owner { get; set; } = null!; + public required Person Owner { get; set; } } ``` @@ -297,7 +297,7 @@ Otherwise, the relationship (and its related resources, when included) are silen public class User : Identifiable { [HasOne(Capabilities = ~HasOneCapabilities.AllowView)] - public LoginAccount Account { get; set; } = null!; + public required LoginAccount Account { get; set; } } ``` @@ -339,7 +339,7 @@ Indicates whether POST and PATCH requests can replace the relationship. When sen public class User : Identifiable { [HasOne(Capabilities = ~HasOneCapabilities.AllowSet)] - public LoginAccount Account { get; set; } = null!; + public required LoginAccount Account { get; set; } } ``` @@ -400,7 +400,7 @@ So for the calculated property to be evaluated correctly, the related entity mus public class ShippingAddress : Identifiable { [Attr] - public string Street { get; set; } = null!; + public required string Street { get; set; } [Attr] public string? CountryName => Country?.DisplayName; @@ -412,7 +412,7 @@ public class ShippingAddress : Identifiable public class Country { - public string IsoCode { get; set; } = null!; - public string DisplayName { get; set; } = null!; + public required string IsoCode { get; set; } + public required string DisplayName { get; set; } } ``` diff --git a/src/Examples/DapperExample/Models/LoginAccount.cs b/src/Examples/DapperExample/Models/LoginAccount.cs index 149fc6c7f8..a40fcaa46e 100644 --- a/src/Examples/DapperExample/Models/LoginAccount.cs +++ b/src/Examples/DapperExample/Models/LoginAccount.cs @@ -9,7 +9,7 @@ namespace DapperExample.Models; public sealed class LoginAccount : Identifiable { [Attr] - public string UserName { get; set; } = null!; + public required string UserName { get; set; } public DateTimeOffset? LastUsedAt { get; set; } diff --git a/src/Examples/DapperExample/Models/Person.cs b/src/Examples/DapperExample/Models/Person.cs index 1eb4ecadee..a4f773aab7 100644 --- a/src/Examples/DapperExample/Models/Person.cs +++ b/src/Examples/DapperExample/Models/Person.cs @@ -13,7 +13,7 @@ public sealed class Person : Identifiable public string? FirstName { get; set; } [Attr] - public string LastName { get; set; } = null!; + public required string LastName { get; set; } // Mistakenly includes AllowFilter, so we can test for the error produced. [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowFilter)] diff --git a/src/Examples/DapperExample/Models/Tag.cs b/src/Examples/DapperExample/Models/Tag.cs index cb49ff42fb..bae458c33a 100644 --- a/src/Examples/DapperExample/Models/Tag.cs +++ b/src/Examples/DapperExample/Models/Tag.cs @@ -11,7 +11,7 @@ public sealed class Tag : Identifiable { [Attr] [MinLength(1)] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasOne] public RgbColor? Color { get; set; } diff --git a/src/Examples/DapperExample/Models/TodoItem.cs b/src/Examples/DapperExample/Models/TodoItem.cs index d2f3916268..80b6718eaa 100644 --- a/src/Examples/DapperExample/Models/TodoItem.cs +++ b/src/Examples/DapperExample/Models/TodoItem.cs @@ -10,7 +10,7 @@ namespace DapperExample.Models; public sealed class TodoItem : Identifiable { [Attr] - public string Description { get; set; } = null!; + public required string Description { get; set; } [Attr] [Required] @@ -26,7 +26,7 @@ public sealed class TodoItem : Identifiable public DateTimeOffset? LastModifiedAt { get; set; } [HasOne] - public Person Owner { get; set; } = null!; + public required Person Owner { get; set; } [HasOne] public Person? Assignee { get; set; } diff --git a/src/Examples/DatabasePerTenantExample/Models/Employee.cs b/src/Examples/DatabasePerTenantExample/Models/Employee.cs index cc79449880..6cc1c4a676 100644 --- a/src/Examples/DatabasePerTenantExample/Models/Employee.cs +++ b/src/Examples/DatabasePerTenantExample/Models/Employee.cs @@ -9,11 +9,11 @@ namespace DatabasePerTenantExample.Models; public sealed class Employee : Identifiable { [Attr] - public string FirstName { get; set; } = null!; + public required string FirstName { get; set; } [Attr] - public string LastName { get; set; } = null!; + public required string LastName { get; set; } [Attr] - public string CompanyName { get; set; } = null!; + public required string CompanyName { get; set; } } diff --git a/src/Examples/GettingStarted/Models/Book.cs b/src/Examples/GettingStarted/Models/Book.cs index af4f857fdc..211ea73ea8 100644 --- a/src/Examples/GettingStarted/Models/Book.cs +++ b/src/Examples/GettingStarted/Models/Book.cs @@ -9,11 +9,11 @@ namespace GettingStarted.Models; public sealed class Book : Identifiable { [Attr] - public string Title { get; set; } = null!; + public required string Title { get; set; } [Attr] public int PublishYear { get; set; } [HasOne] - public Person Author { get; set; } = null!; + public required Person Author { get; set; } } diff --git a/src/Examples/GettingStarted/Models/Person.cs b/src/Examples/GettingStarted/Models/Person.cs index c30b87a889..f3fb215baa 100644 --- a/src/Examples/GettingStarted/Models/Person.cs +++ b/src/Examples/GettingStarted/Models/Person.cs @@ -9,7 +9,7 @@ namespace GettingStarted.Models; public sealed class Person : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasMany] public ICollection Books { get; set; } = new List(); diff --git a/src/Examples/JsonApiDotNetCoreExample/Models/Person.cs b/src/Examples/JsonApiDotNetCoreExample/Models/Person.cs index d11fbffff6..daeba78e2d 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Models/Person.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Models/Person.cs @@ -13,7 +13,7 @@ public sealed class Person : Identifiable public string? FirstName { get; set; } [Attr] - public string LastName { get; set; } = null!; + public required string LastName { get; set; } [Attr(Capabilities = AttrCapabilities.AllowView)] [NotMapped] diff --git a/src/Examples/JsonApiDotNetCoreExample/Models/Tag.cs b/src/Examples/JsonApiDotNetCoreExample/Models/Tag.cs index 8904ec01a3..bda77ebf7d 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Models/Tag.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Models/Tag.cs @@ -11,7 +11,7 @@ public sealed class Tag : Identifiable { [Attr] [MinLength(1)] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasMany] public ISet TodoItems { get; set; } = new HashSet(); diff --git a/src/Examples/JsonApiDotNetCoreExample/Models/TodoItem.cs b/src/Examples/JsonApiDotNetCoreExample/Models/TodoItem.cs index 68df7cef27..f4238998ff 100644 --- a/src/Examples/JsonApiDotNetCoreExample/Models/TodoItem.cs +++ b/src/Examples/JsonApiDotNetCoreExample/Models/TodoItem.cs @@ -10,7 +10,7 @@ namespace JsonApiDotNetCoreExample.Models; public sealed class TodoItem : Identifiable { [Attr] - public string Description { get; set; } = null!; + public required string Description { get; set; } [Attr] [Required] @@ -26,7 +26,7 @@ public sealed class TodoItem : Identifiable public DateTimeOffset? LastModifiedAt { get; set; } [HasOne] - public Person Owner { get; set; } = null!; + public required Person Owner { get; set; } [HasOne] public Person? Assignee { get; set; } diff --git a/src/Examples/NoEntityFrameworkExample/Models/Person.cs b/src/Examples/NoEntityFrameworkExample/Models/Person.cs index 2e7d4a02ab..6e2ea91d68 100644 --- a/src/Examples/NoEntityFrameworkExample/Models/Person.cs +++ b/src/Examples/NoEntityFrameworkExample/Models/Person.cs @@ -14,7 +14,7 @@ public sealed class Person : Identifiable public string? FirstName { get; set; } [Attr] - public string LastName { get; set; } = null!; + public required string LastName { get; set; } [Attr(Capabilities = AttrCapabilities.AllowView)] [NotMapped] diff --git a/src/Examples/NoEntityFrameworkExample/Models/Tag.cs b/src/Examples/NoEntityFrameworkExample/Models/Tag.cs index 4a6ae70f49..464459f8ce 100644 --- a/src/Examples/NoEntityFrameworkExample/Models/Tag.cs +++ b/src/Examples/NoEntityFrameworkExample/Models/Tag.cs @@ -12,7 +12,7 @@ public sealed class Tag : Identifiable { [Attr] [MinLength(1)] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasMany] public ISet TodoItems { get; set; } = new HashSet(); diff --git a/src/Examples/NoEntityFrameworkExample/Models/TodoItem.cs b/src/Examples/NoEntityFrameworkExample/Models/TodoItem.cs index 75d948ca7c..eb158cd7bb 100644 --- a/src/Examples/NoEntityFrameworkExample/Models/TodoItem.cs +++ b/src/Examples/NoEntityFrameworkExample/Models/TodoItem.cs @@ -11,7 +11,7 @@ namespace NoEntityFrameworkExample.Models; public sealed class TodoItem : Identifiable { [Attr] - public string Description { get; set; } = null!; + public required string Description { get; set; } [Attr] [Required] @@ -21,7 +21,7 @@ public sealed class TodoItem : Identifiable public long? DurationInHours { get; set; } [HasOne] - public Person Owner { get; set; } = null!; + public required Person Owner { get; set; } [HasOne] public Person? Assignee { get; set; } diff --git a/src/Examples/ReportsExample/Models/Report.cs b/src/Examples/ReportsExample/Models/Report.cs index e05f8e61a1..688d8a562e 100644 --- a/src/Examples/ReportsExample/Models/Report.cs +++ b/src/Examples/ReportsExample/Models/Report.cs @@ -10,8 +10,8 @@ namespace ReportsExample.Models; public sealed class Report : Identifiable { [Attr] - public string Title { get; set; } = null!; + public required string Title { get; set; } [Attr] - public ReportStatistics Statistics { get; set; } = null!; + public required ReportStatistics Statistics { get; set; } } diff --git a/src/Examples/ReportsExample/Models/ReportStatistics.cs b/src/Examples/ReportsExample/Models/ReportStatistics.cs index 2df01f9b5e..c477596b6f 100644 --- a/src/Examples/ReportsExample/Models/ReportStatistics.cs +++ b/src/Examples/ReportsExample/Models/ReportStatistics.cs @@ -5,6 +5,6 @@ namespace ReportsExample.Models; [UsedImplicitly(ImplicitUseTargetFlags.Members)] public sealed class ReportStatistics { - public string ProgressIndication { get; set; } = null!; + public required string ProgressIndication { get; set; } public int HoursSpent { get; set; } } diff --git a/src/JsonApiDotNetCore.Annotations/Resources/Annotations/AttrAttribute.cs b/src/JsonApiDotNetCore.Annotations/Resources/Annotations/AttrAttribute.cs index 26a660775a..fa18f9d8bd 100644 --- a/src/JsonApiDotNetCore.Annotations/Resources/Annotations/AttrAttribute.cs +++ b/src/JsonApiDotNetCore.Annotations/Resources/Annotations/AttrAttribute.cs @@ -21,7 +21,7 @@ public sealed class AttrAttribute : ResourceFieldAttribute /// public class Author : Identifiable /// { /// [Attr(Capabilities = AttrCapabilities.AllowFilter | AttrCapabilities.AllowSort)] - /// public string Name { get; set; } = null!; + /// public required string Name { get; set; } /// } /// ]]> /// diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/BroadcastComment.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/BroadcastComment.cs index e76da97f29..0ea8e5b8ba 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/BroadcastComment.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/BroadcastComment.cs @@ -9,11 +9,11 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Archiving; public sealed class BroadcastComment : Identifiable { [Attr] - public string Text { get; set; } = null!; + public required string Text { get; set; } [Attr] public DateTimeOffset CreatedAt { get; set; } [HasOne] - public TelevisionBroadcast AppliesTo { get; set; } = null!; + public required TelevisionBroadcast AppliesTo { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/TelevisionBroadcast.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/TelevisionBroadcast.cs index 8476036013..14a1776360 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/TelevisionBroadcast.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/TelevisionBroadcast.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Archiving; public sealed class TelevisionBroadcast : Identifiable { [Attr] - public string Title { get; set; } = null!; + public required string Title { get; set; } [Attr] public DateTimeOffset AiredAt { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/TelevisionNetwork.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/TelevisionNetwork.cs index cbbe3219cc..4dbc8338e0 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/TelevisionNetwork.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/TelevisionNetwork.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Archiving; public sealed class TelevisionNetwork : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasMany] public ISet Stations { get; set; } = new HashSet(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/TelevisionStation.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/TelevisionStation.cs index 1bfab54405..9f8d47e076 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/TelevisionStation.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Archiving/TelevisionStation.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Archiving; public sealed class TelevisionStation : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasMany] public ISet Broadcasts { get; set; } = new HashSet(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Lyric.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Lyric.cs index af1ac9e18b..b0c5df488c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Lyric.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Lyric.cs @@ -12,7 +12,7 @@ public sealed class Lyric : Identifiable public string? Format { get; set; } [Attr] - public string Text { get; set; } = null!; + public required string Text { get; set; } [Attr(Capabilities = AttrCapabilities.None)] public DateTimeOffset CreatedAt { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/MusicTrack.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/MusicTrack.cs index 0abf7385ee..8869171be9 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/MusicTrack.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/MusicTrack.cs @@ -13,7 +13,7 @@ public sealed class MusicTrack : Identifiable public override Guid Id { get; set; } [Attr] - public string Title { get; set; } = null!; + public required string Title { get; set; } [Attr] [Range(1, 24 * 60)] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Playlist.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Playlist.cs index 0d6409e761..653b3aede8 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Playlist.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/Playlist.cs @@ -10,7 +10,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.AtomicOperations; public sealed class Playlist : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] [NotMapped] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/RecordCompany.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/RecordCompany.cs index 5e0509a57f..005cad3611 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/RecordCompany.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/AtomicOperations/RecordCompany.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.AtomicOperations; public sealed class RecordCompany : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public string? CountryOfResidence { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/Actor.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/Actor.cs index 262fab70f1..ae431f9c30 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/Actor.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/Actor.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Authorization.Scopes; public sealed class Actor : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public DateTime BornAt { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/Genre.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/Genre.cs index f5bcba8fe2..d48443caae 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/Genre.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/Genre.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Authorization.Scopes; public sealed class Genre : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasMany] public ISet Movies { get; set; } = new HashSet(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/Movie.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/Movie.cs index 4e52ff2728..eace8d3741 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/Movie.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Authorization/Scopes/Movie.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Authorization.Scopes; public sealed class Movie : Identifiable { [Attr] - public string Title { get; set; } = null!; + public required string Title { get; set; } [Attr] public int ReleaseYear { get; set; } @@ -18,7 +18,7 @@ public sealed class Movie : Identifiable public int DurationInSeconds { get; set; } [HasOne] - public Genre Genre { get; set; } = null!; + public required Genre Genre { get; set; } [HasMany] public ISet Cast { get; set; } = new HashSet(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/ImageContainer.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/ImageContainer.cs index 3462cdb2df..6b746389a5 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/ImageContainer.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Blobs/ImageContainer.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Blobs; public sealed class ImageContainer : Identifiable { [Attr] - public string FileName { get; set; } = null!; + public required string FileName { get; set; } [Attr] public byte[] Data { get; set; } = []; diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/Dealership.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/Dealership.cs index c8574b320e..15275a10fc 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/Dealership.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/Dealership.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.CompositeKeys; public sealed class Dealership : Identifiable { [Attr] - public string Address { get; set; } = null!; + public required string Address { get; set; } [HasMany] public ISet Inventory { get; set; } = new HashSet(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/Engine.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/Engine.cs index 428b65fbb7..11f33a5230 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/Engine.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/CompositeKeys/Engine.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.CompositeKeys; public sealed class Engine : Identifiable { [Attr] - public string SerialCode { get; set; } = null!; + public required string SerialCode { get; set; } [HasOne] public Car? Car { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/Policy.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/Policy.cs index 745b137069..a49a2217fd 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/Policy.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ContentNegotiation/Policy.cs @@ -9,5 +9,5 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ContentNegotiation; public sealed class Policy : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/Civilian.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/Civilian.cs index bd8d401fcb..5c11d5b464 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/Civilian.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/Civilian.cs @@ -10,7 +10,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.CustomRoutes; public sealed class Civilian : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] [Range(1900, 2050)] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/Town.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/Town.cs index 5ef7dee922..c7d97e81ff 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/Town.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/CustomRoutes/Town.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.CustomRoutes; public sealed class Town : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public double Latitude { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/Building.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/Building.cs index 84cce7149c..3c45d68341 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/Building.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/Building.cs @@ -10,7 +10,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.EagerLoading; public sealed class Building : Identifiable { [Attr] - public string Number { get; set; } = null!; + public required string Number { get; set; } [Attr] [NotMapped] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/City.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/City.cs index 03ab50c832..bc302574a6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/City.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/City.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.EagerLoading; public sealed class City : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasMany] public IList Streets { get; set; } = new List(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/Door.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/Door.cs index 1e60b1bd71..5f564732a7 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/Door.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/Door.cs @@ -8,5 +8,5 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.EagerLoading; public sealed class Door { public int Id { get; set; } - public string Color { get; set; } = null!; + public required string Color { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/State.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/State.cs index 190c745988..1ce3840f5a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/State.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/State.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.EagerLoading; public sealed class State : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasMany] public IList Cities { get; set; } = new List(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/Street.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/Street.cs index 05673ec5d9..55b41020cf 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/Street.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/EagerLoading/Street.cs @@ -10,7 +10,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.EagerLoading; public sealed class Street : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr(Capabilities = AttrCapabilities.AllowView)] [NotMapped] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ConsumerArticle.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ConsumerArticle.cs index 64ba92a917..9695cabbf4 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ConsumerArticle.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ExceptionHandling/ConsumerArticle.cs @@ -9,5 +9,5 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ExceptionHandling; public sealed class ConsumerArticle : Identifiable { [Attr] - public string Code { get; set; } = null!; + public required string Code { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/ArtGallery.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/ArtGallery.cs index 7331130cf2..bdee0f3d01 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/ArtGallery.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/ArtGallery.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.HostingInIIS; public sealed class ArtGallery : Identifiable { [Attr] - public string Theme { get; set; } = null!; + public required string Theme { get; set; } [HasMany] public ISet Paintings { get; set; } = new HashSet(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/Painting.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/Painting.cs index 0053dc9c2b..c5cf50b2d6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/Painting.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/HostingInIIS/Painting.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.HostingInIIS; public sealed class Painting : Identifiable { [Attr] - public string Title { get; set; } = null!; + public required string Title { get; set; } [HasOne] public ArtGallery? ExposedAt { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/BankAccount.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/BankAccount.cs index 663b2a3bd6..b22a964547 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/BankAccount.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/BankAccount.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.IdObfuscation; public sealed class BankAccount : ObfuscatedIdentifiable { [Attr] - public string Iban { get; set; } = null!; + public required string Iban { get; set; } [HasMany] public IList Cards { get; set; } = new List(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/DebitCard.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/DebitCard.cs index 99f0154147..249d5f58e4 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/DebitCard.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/IdObfuscation/DebitCard.cs @@ -9,11 +9,11 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.IdObfuscation; public sealed class DebitCard : ObfuscatedIdentifiable { [Attr] - public string OwnerName { get; set; } = null!; + public required string OwnerName { get; set; } [Attr] public short PinCode { get; set; } [HasOne] - public BankAccount Account { get; set; } = null!; + public required BankAccount Account { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/SystemDirectory.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/SystemDirectory.cs index 4265dc688e..4b15539403 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/SystemDirectory.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/SystemDirectory.cs @@ -14,7 +14,7 @@ public sealed class SystemDirectory : Identifiable [Attr(PublicName = "directoryName")] [RegularExpression(@"^[\w\s]+$")] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] [Required] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/SystemFile.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/SystemFile.cs index d2845cca84..1dd249f80a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/SystemFile.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/SystemFile.cs @@ -11,7 +11,7 @@ public sealed class SystemFile : Identifiable { [Attr] [MinLength(1)] - public string FileName { get; set; } = null!; + public required string FileName { get; set; } [Attr] [Required] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/SystemVolume.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/SystemVolume.cs index b283b551b1..6622088531 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/SystemVolume.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/InputValidation/ModelState/SystemVolume.cs @@ -12,5 +12,5 @@ public sealed class SystemVolume : Identifiable public string? Name { get; set; } [HasOne] - public SystemDirectory RootDirectory { get; set; } = null!; + public required SystemDirectory RootDirectory { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/PhotoAlbum.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/PhotoAlbum.cs index 32bdf79a40..8669f37843 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/PhotoAlbum.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/PhotoAlbum.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Links; public sealed class PhotoAlbum : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasMany] public ISet Photos { get; set; } = new HashSet(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/PhotoLocation.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/PhotoLocation.cs index 092851fbdd..9ac9f51ac4 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Links/PhotoLocation.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Links/PhotoLocation.cs @@ -19,7 +19,7 @@ public sealed class PhotoLocation : Identifiable public double Longitude { get; set; } [HasOne] - public Photo Photo { get; set; } = null!; + public required Photo Photo { get; set; } [HasOne(Links = LinkTypes.None)] public PhotoAlbum? Album { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Logging/AuditEntry.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Logging/AuditEntry.cs index 827a8cf472..1a7835817f 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Logging/AuditEntry.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Logging/AuditEntry.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Logging; public sealed class AuditEntry : Identifiable { [Attr] - public string UserName { get; set; } = null!; + public required string UserName { get; set; } [Attr] public DateTimeOffset CreatedAt { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ProductFamily.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ProductFamily.cs index bb72fd5392..e750563843 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ProductFamily.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/ProductFamily.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Meta; public sealed class ProductFamily : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasMany] public IList Tickets { get; set; } = new List(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/SupportTicket.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/SupportTicket.cs index b04c0ec2ab..2e5a94fa31 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/SupportTicket.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Meta/SupportTicket.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Meta; public sealed class SupportTicket : Identifiable { [Attr] - public string Description { get; set; } = null!; + public required string Description { get; set; } [HasOne] public ProductFamily? ProductFamily { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/DomainGroup.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/DomainGroup.cs index dd87456892..cc4e33e4cd 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/DomainGroup.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/DomainGroup.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Microservices; public sealed class DomainGroup : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasMany] public ISet Users { get; set; } = new HashSet(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/DomainUser.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/DomainUser.cs index 0efb562355..d47d518e25 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/DomainUser.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Microservices/DomainUser.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Microservices; public sealed class DomainUser : Identifiable { [Attr] - public string LoginName { get; set; } = null!; + public required string LoginName { get; set; } [Attr] public string? DisplayName { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/WebProduct.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/WebProduct.cs index a2c41c5ede..dbcac94b7a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/WebProduct.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/WebProduct.cs @@ -9,11 +9,11 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.MultiTenancy; public sealed class WebProduct : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public decimal Price { get; set; } [HasOne] - public WebShop Shop { get; set; } = null!; + public required WebShop Shop { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/WebShop.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/WebShop.cs index f191344fcc..2da0d679f6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/WebShop.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/MultiTenancy/WebShop.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.MultiTenancy; public sealed class WebShop : Identifiable, IHasTenant { [Attr] - public string Url { get; set; } = null!; + public required string Url { get; set; } public Guid TenantId { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Appointment.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Appointment.cs index ba3ea783df..d9529099ea 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Appointment.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Appointment.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.QueryStrings; public sealed class Appointment : Identifiable { [Attr] - public string Title { get; set; } = null!; + public required string Title { get; set; } [Attr] public string? Description { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Blog.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Blog.cs index b58c446ced..3e23b11a38 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Blog.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Blog.cs @@ -9,10 +9,10 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.QueryStrings; public sealed class Blog : Identifiable { [Attr] - public string Title { get; set; } = null!; + public required string Title { get; set; } [Attr] - public string PlatformName { get; set; } = null!; + public required string PlatformName { get; set; } [Attr(Capabilities = AttrCapabilities.All & ~(AttrCapabilities.AllowCreate | AttrCapabilities.AllowChange))] public bool ShowAdvertisements => PlatformName.EndsWith("(using free account)", StringComparison.Ordinal); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/BlogPost.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/BlogPost.cs index f0382f90a4..c72ee7256a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/BlogPost.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/BlogPost.cs @@ -9,10 +9,10 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.QueryStrings; public sealed class BlogPost : Identifiable { [Attr] - public string Caption { get; set; } = null!; + public required string Caption { get; set; } [Attr] - public string Url { get; set; } = null!; + public required string Url { get; set; } [HasOne] public WebAccount? Author { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Comment.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Comment.cs index 2e78f4e999..c7442d8bc3 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Comment.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Comment.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.QueryStrings; public sealed class Comment : Identifiable { [Attr] - public string Text { get; set; } = null!; + public required string Text { get; set; } [Attr] public DateTime CreatedAt { get; set; } @@ -21,5 +21,5 @@ public sealed class Comment : Identifiable public WebAccount? Author { get; set; } [HasOne] - public BlogPost Parent { get; set; } = null!; + public required BlogPost Parent { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Human.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Human.cs index 1e2c01d73b..709e74e0c9 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Human.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Human.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.QueryStrings; public abstract class Human : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasOne] public Man? Father { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Label.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Label.cs index 9b22c051cf..6e69efd324 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Label.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Label.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.QueryStrings; public sealed class Label : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public LabelColor Color { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/WebAccount.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/WebAccount.cs index c32431ec84..02fa63124c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/WebAccount.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/WebAccount.cs @@ -9,19 +9,19 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.QueryStrings; public sealed class WebAccount : Identifiable { [Attr] - public string UserName { get; set; } = null!; + public required string UserName { get; set; } [Attr(Capabilities = AttrCapabilities.All & ~AttrCapabilities.AllowView)] - public string Password { get; set; } = null!; + public required string Password { get; set; } [Attr] - public string DisplayName { get; set; } = null!; + public required string DisplayName { get; set; } [Attr(Capabilities = AttrCapabilities.All & ~(AttrCapabilities.AllowFilter | AttrCapabilities.AllowSort))] public DateTime? DateOfBirth { get; set; } [Attr] - public string EmailAddress { get; set; } = null!; + public required string EmailAddress { get; set; } [HasOne(Capabilities = HasOneCapabilities.All & ~HasOneCapabilities.AllowView)] public Human? Person { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Woman.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Woman.cs index 8e1044b2de..29348c83c1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Woman.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/QueryStrings/Woman.cs @@ -8,7 +8,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.QueryStrings; public sealed class Woman : Human { [Attr] - public string MaidenName { get; set; } = null!; + public required string MaidenName { get; set; } [Attr] public int Age { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/RgbColor.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/RgbColor.cs index 28762384c9..9fd97e08df 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/RgbColor.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/RgbColor.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ReadWrite; public sealed class RgbColor : Identifiable { [Attr] - public string DisplayName { get; set; } = null!; + public required string DisplayName { get; set; } [HasOne] public WorkItemGroup? Group { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/WorkItemGroup.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/WorkItemGroup.cs index b5b94258f2..d65f8b8fa9 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/WorkItemGroup.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/WorkItemGroup.cs @@ -10,7 +10,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ReadWrite; public sealed class WorkItemGroup : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public bool IsPublic { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/WorkItemToWorkItem.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/WorkItemToWorkItem.cs index 23a62b0e4a..ffc574a551 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/WorkItemToWorkItem.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ReadWrite/WorkItemToWorkItem.cs @@ -7,6 +7,6 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ReadWrite; [NoResource] public sealed class WorkItemToWorkItem { - public WorkItem FromItem { get; set; } = null!; - public WorkItem ToItem { get; set; } = null!; + public required WorkItem FromItem { get; set; } + public required WorkItem ToItem { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/Customer.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/Customer.cs index 952eed4e1f..e4fad311c1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/Customer.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/Customer.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.RequiredRelationships; public sealed class Customer : Identifiable { [Attr] - public string EmailAddress { get; set; } = null!; + public required string EmailAddress { get; set; } [HasMany] public ISet Orders { get; set; } = new HashSet(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/Order.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/Order.cs index 390556bf9f..e4226257cf 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/Order.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/Order.cs @@ -12,8 +12,8 @@ public sealed class Order : Identifiable public decimal Amount { get; set; } [HasOne] - public Customer Customer { get; set; } = null!; + public required Customer Customer { get; set; } [HasOne] - public Shipment Shipment { get; set; } = null!; + public required Shipment Shipment { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/Shipment.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/Shipment.cs index ed14d0a946..8d6242b284 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/Shipment.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/RequiredRelationships/Shipment.cs @@ -11,11 +11,11 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.RequiredRelationships; public sealed class Shipment : Identifiable { [Attr] - public string TrackAndTraceCode { get; set; } = null!; + public required string TrackAndTraceCode { get; set; } [Attr] public DateTimeOffset ShippedAt { get; set; } [HasOne] - public Order Order { get; set; } = null!; + public required Order Order { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/InjectionFakers.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/InjectionFakers.cs index fc6cda269a..6db1321c55 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/InjectionFakers.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/InjectionFakers.cs @@ -28,8 +28,10 @@ public InjectionFakers(IServiceProvider serviceProvider) _lazyPostOfficeFaker = new Lazy>(() => new Faker() .MakeDeterministic(systemTimeUtc) - .CustomInstantiator(_ => new PostOffice(ResolveDbContext())) - .RuleFor(postOffice => postOffice.Address, faker => faker.Address.FullAddress())); + .CustomInstantiator(faker => new PostOffice(ResolveDbContext()) + { + Address = faker.Address.FullAddress() + })); _lazyGiftCertificateFaker = new Lazy>(() => new Faker() .MakeDeterministic(systemTimeUtc) diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/PostOffice.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/PostOffice.cs index ef91b2b1a6..70b3f4bb01 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/PostOffice.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceConstructorInjection/PostOffice.cs @@ -12,7 +12,7 @@ public sealed class PostOffice(InjectionDbContext injectionDbContext) : Identifi private readonly TimeProvider _timeProvider = injectionDbContext.TimeProvider; [Attr] - public string Address { get; set; } = null!; + public required string Address { get; set; } [Attr(Capabilities = AttrCapabilities.AllowView)] [NotMapped] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Constellation.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Constellation.cs index 72bd00a662..8b60a25fe1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Constellation.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Constellation.cs @@ -10,7 +10,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceDefinitions.Reading; public sealed class Constellation : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] [Required] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Moon.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Moon.cs index 3ce6cde44c..84b4ccef7c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Moon.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Moon.cs @@ -9,13 +9,13 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceDefinitions.Reading; public sealed class Moon : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public decimal SolarRadius { get; set; } [HasOne] - public Planet OrbitsAround { get; set; } = null!; + public required Planet OrbitsAround { get; set; } [HasOne] public Star? IsGivenLightBy { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Planet.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Planet.cs index 33a5fe1081..e41905eaa8 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Planet.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Planet.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceDefinitions.Reading; public sealed class Planet : Identifiable { [Attr] - public string PublicName { get; set; } = null!; + public required string PublicName { get; set; } [Attr] public string? PrivateName { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Star.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Star.cs index 48bc6f0e44..d1bdf69f1d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Star.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Reading/Star.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceDefinitions.Reading; public sealed class Star : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public StarKind Kind { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/Scholarship.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/Scholarship.cs index a5a75eb939..4db5f82dfe 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/Scholarship.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/Scholarship.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceDefinitions.Serializat public sealed class Scholarship : Identifiable { [Attr] - public string ProgramName { get; set; } = null!; + public required string ProgramName { get; set; } [Attr] public decimal Amount { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/Student.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/Student.cs index fa20cb05c6..e2c544310a 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/Student.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceDefinitions/Serialization/Student.cs @@ -9,10 +9,10 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceDefinitions.Serializat public sealed class Student : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] - public string SocialSecurityNumber { get; set; } = null!; + public required string SocialSecurityNumber { get; set; } [HasOne] public Scholarship? Scholarship { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/BicycleLight.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/BicycleLight.cs index f1d41f44af..e84c05b3d1 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/BicycleLight.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/BicycleLight.cs @@ -9,5 +9,5 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceInheritance.Models; public sealed class BicycleLight : Identifiable { [Attr] - public string Color { get; set; } = null!; + public required string Color { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/GenericFeature.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/GenericFeature.cs index 79de2d858e..1e34065aed 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/GenericFeature.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/GenericFeature.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceInheritance.Models; public sealed class GenericFeature : Identifiable { [Attr] - public string Description { get; set; } = null!; + public required string Description { get; set; } [HasMany] public ISet Properties { get; set; } = new HashSet(); diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/GenericProperty.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/GenericProperty.cs index e410b9a803..1c188a02e7 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/GenericProperty.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/GenericProperty.cs @@ -9,5 +9,5 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceInheritance.Models; public abstract class GenericProperty : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/MotorVehicle.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/MotorVehicle.cs index 2578d5d128..07170c6770 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/MotorVehicle.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/MotorVehicle.cs @@ -11,10 +11,10 @@ public abstract class MotorVehicle : Vehicle public override bool RequiresDriverLicense { get; set; } [Attr] - public string LicensePlate { get; set; } = null!; + public required string LicensePlate { get; set; } [HasOne] - public Engine Engine { get; set; } = null!; + public required Engine Engine { get; set; } [HasOne] public NavigationSystem? NavigationSystem { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/NavigationSystem.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/NavigationSystem.cs index 015c1089c7..64d67f8e8b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/NavigationSystem.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/NavigationSystem.cs @@ -9,5 +9,5 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceInheritance.Models; public sealed class NavigationSystem : Identifiable { [Attr] - public string ModelType { get; set; } = null!; + public required string ModelType { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/NumberProperty.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/NumberProperty.cs index e3d924f206..49c9978c8d 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/NumberProperty.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/NumberProperty.cs @@ -8,5 +8,5 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceInheritance.Models; public sealed class NumberProperty : GenericProperty { [HasOne] - public NumberValue Value { get; set; } = null!; + public required NumberValue Value { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/StringProperty.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/StringProperty.cs index a145d17978..13f33b10f5 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/StringProperty.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/StringProperty.cs @@ -8,5 +8,5 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceInheritance.Models; public sealed class StringProperty : GenericProperty { [HasOne] - public StringValue Value { get; set; } = null!; + public required StringValue Value { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/StringValue.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/StringValue.cs index fc620f7bd2..e620d71f1b 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/StringValue.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ResourceInheritance/Models/StringValue.cs @@ -9,5 +9,5 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ResourceInheritance.Models; public sealed class StringValue : Identifiable { [Attr] - public string Content { get; set; } = null!; + public required string Content { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/Pillow.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/Pillow.cs index 221555555f..bd78207bb5 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/Pillow.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/RestrictedControllers/Pillow.cs @@ -9,5 +9,5 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.RestrictedControllers; public sealed class Pillow : Identifiable { [Attr] - public string Color { get; set; } = null!; + public required string Color { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/Address.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/Address.cs index 97017706e0..45c9763762 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/Address.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/Address.cs @@ -5,8 +5,8 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Serialization; [UsedImplicitly(ImplicitUseTargetFlags.Members)] public sealed class Address { - public string Street { get; set; } = null!; + public required string Street { get; set; } public string? ZipCode { get; set; } - public string City { get; set; } = null!; - public string Country { get; set; } = null!; + public required string City { get; set; } + public required string Country { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/Meeting.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/Meeting.cs index f7599f6f01..0880d84e10 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/Meeting.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/Meeting.cs @@ -12,7 +12,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Serialization; public sealed class Meeting : Identifiable { [Attr] - public string Title { get; set; } = null!; + public required string Title { get; set; } [Attr] public DateTimeOffset StartTime { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/MeetingAttendee.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/MeetingAttendee.cs index 118e0c9df5..1351ed4ef3 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/MeetingAttendee.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/Serialization/MeetingAttendee.cs @@ -9,10 +9,10 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.Serialization; public sealed class MeetingAttendee : Identifiable { [Attr] - public string DisplayName { get; set; } = null!; + public required string DisplayName { get; set; } [Attr] - public Address HomeAddress { get; set; } = null!; + public required Address HomeAddress { get; set; } [HasOne] public Meeting? Meeting { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/Company.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/Company.cs index d1ea71a8d8..03edc14321 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/Company.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/Company.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.SoftDeletion; public sealed class Company : Identifiable, ISoftDeletable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } public DateTimeOffset? SoftDeletedAt { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/Department.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/Department.cs index f006ff015d..1ab79ccdde 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/Department.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/SoftDeletion/Department.cs @@ -9,7 +9,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.SoftDeletion; public sealed class Department : Identifiable, ISoftDeletable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } public DateTimeOffset? SoftDeletedAt { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/Game.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/Game.cs index a983c66d7b..9a7af8d98c 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/Game.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/Game.cs @@ -11,7 +11,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ZeroKeys; public sealed class Game : Identifiable { [Attr] - public string Title { get; set; } = null!; + public required string Title { get; set; } [Attr] [NotMapped] diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/Map.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/Map.cs index c8226a4009..25b7253fb8 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/Map.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/Map.cs @@ -10,7 +10,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ZeroKeys; public sealed class Map : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasOne] public Game? Game { get; set; } diff --git a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/Player.cs b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/Player.cs index 52f52d112c..ea6a2b6cf6 100644 --- a/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/Player.cs +++ b/test/JsonApiDotNetCoreTests/IntegrationTests/ZeroKeys/Player.cs @@ -10,7 +10,7 @@ namespace JsonApiDotNetCoreTests.IntegrationTests.ZeroKeys; public sealed class Player : Identifiable { [Attr] - public string EmailAddress { get; set; } = null!; + public required string EmailAddress { get; set; } [HasOne] public Game? ActiveGame { get; set; } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/FieldChains/FieldChainPatternInheritanceMatchTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/FieldChains/FieldChainPatternInheritanceMatchTests.cs index f5cd78f6ff..915a742bd2 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/FieldChains/FieldChainPatternInheritanceMatchTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/FieldChains/FieldChainPatternInheritanceMatchTests.cs @@ -173,7 +173,7 @@ private abstract class Base : Identifiable public string? Value { get; set; } [HasOne] - public Base SingleItem { get; set; } = null!; + public required Base SingleItem { get; set; } [HasMany] public ISet SetOfItems { get; set; } = new HashSet(); diff --git a/test/JsonApiDotNetCoreTests/UnitTests/ModelStateValidation/ModelStateValidationTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/ModelStateValidation/ModelStateValidationTests.cs index 17a62b3de3..d494eaa86f 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/ModelStateValidation/ModelStateValidationTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/ModelStateValidation/ModelStateValidationTests.cs @@ -118,13 +118,13 @@ private sealed class Parent : Identifiable public ComplexObject? ComplexObject { get; set; } [Attr(PublicName = "publicNameOfComplexList")] - public IList ComplexList { get; set; } = null!; + public required IList ComplexList { get; set; } [HasOne(PublicName = "publicNameOfPrimaryChild")] public Child? PrimaryChild { get; set; } [HasMany(PublicName = "publicNameOfChildren")] - public ISet Children { get; set; } = null!; + public required ISet Children { get; set; } } [UsedImplicitly(ImplicitUseTargetFlags.Members)] @@ -149,6 +149,6 @@ private sealed class ComplexObject public ComplexObject? ParentObject { get; set; } [JsonPropertyName("jsonElements")] - public IList Elements { get; set; } = null!; + public required IList Elements { get; set; } } } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs b/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs index dc59dbe907..fae2e9addd 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/ResourceDefinitions/CreateSortExpressionFromLambdaTests.cs @@ -358,10 +358,10 @@ public SortExpression GetSortExpressionFromLambda(PropertySortOrder sortOrder) private abstract class FileSystemEntry : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasOne] - public FileSystemEntry Parent { get; set; } = null!; + public required FileSystemEntry Parent { get; set; } [HasMany] public List Children { get; set; } = []; @@ -381,7 +381,7 @@ private sealed class DirectoryEntry : FileSystemEntry private sealed class FileEntry : FileSystemEntry { [Attr] - public string Content { get; set; } = null!; + public required string Content { get; set; } [Attr] public ulong Length { get; set; } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Article.cs b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Article.cs index dfb556bab3..236651abaf 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Article.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Article.cs @@ -8,11 +8,11 @@ namespace JsonApiDotNetCoreTests.UnitTests.Serialization.Response.Models; public sealed class Article : Identifiable { [Attr] - public string Title { get; set; } = null!; + public required string Title { get; set; } [HasOne] public Person? Reviewer { get; set; } [HasOne] - public Person Author { get; set; } = null!; + public required Person Author { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Blog.cs b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Blog.cs index 55d75af2fa..8096676d4b 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Blog.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Blog.cs @@ -8,11 +8,11 @@ namespace JsonApiDotNetCoreTests.UnitTests.Serialization.Response.Models; public sealed class Blog : Identifiable { [Attr] - public string Title { get; set; } = null!; + public required string Title { get; set; } [HasOne] - public Person Reviewer { get; set; } = null!; + public required Person Reviewer { get; set; } [HasOne] - public Person Author { get; set; } = null!; + public required Person Author { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Food.cs b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Food.cs index 3a06c037d7..1f966a99e8 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Food.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Food.cs @@ -8,5 +8,5 @@ namespace JsonApiDotNetCoreTests.UnitTests.Serialization.Response.Models; public sealed class Food : Identifiable { [Attr] - public string Dish { get; set; } = null!; + public required string Dish { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Person.cs b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Person.cs index a5b86ed950..7d8fd5eb0f 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Person.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Person.cs @@ -8,14 +8,14 @@ namespace JsonApiDotNetCoreTests.UnitTests.Serialization.Response.Models; public sealed class Person : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasMany] public ISet Blogs { get; set; } = new HashSet(); [HasOne] - public Food FavoriteFood { get; set; } = null!; + public required Food FavoriteFood { get; set; } [HasOne] - public Song FavoriteSong { get; set; } = null!; + public required Song FavoriteSong { get; set; } } diff --git a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Song.cs b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Song.cs index b9822f95a0..ab1e9e6c81 100644 --- a/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Song.cs +++ b/test/JsonApiDotNetCoreTests/UnitTests/Serialization/Response/Models/Song.cs @@ -8,5 +8,5 @@ namespace JsonApiDotNetCoreTests.UnitTests.Serialization.Response.Models; public sealed class Song : Identifiable { [Attr] - public string Title { get; set; } = null!; + public required string Title { get; set; } } diff --git a/test/OpenApiTests/AtomicOperations/Course.cs b/test/OpenApiTests/AtomicOperations/Course.cs index de193c6893..9d5c6deea8 100644 --- a/test/OpenApiTests/AtomicOperations/Course.cs +++ b/test/OpenApiTests/AtomicOperations/Course.cs @@ -12,7 +12,7 @@ namespace OpenApiTests.AtomicOperations; public sealed class Course : Identifiable { [Attr] - public string Subject { get; set; } = null!; + public required string Subject { get; set; } [Attr] public string? Description { get; set; } diff --git a/test/OpenApiTests/AtomicOperations/Enrollment.cs b/test/OpenApiTests/AtomicOperations/Enrollment.cs index c89cf2537c..977b2d56f9 100644 --- a/test/OpenApiTests/AtomicOperations/Enrollment.cs +++ b/test/OpenApiTests/AtomicOperations/Enrollment.cs @@ -22,8 +22,8 @@ public sealed class Enrollment(OperationsDbContext dbContext) : Identifiable GraduatedAt != null && GraduatedAt <= Today; [HasOne] - public Student Student { get; set; } = null!; + public required Student Student { get; set; } [HasOne] - public Course Course { get; set; } = null!; + public required Course Course { get; set; } } diff --git a/test/OpenApiTests/AtomicOperations/OperationsFakers.cs b/test/OpenApiTests/AtomicOperations/OperationsFakers.cs index c77e045faa..8f08e42d08 100644 --- a/test/OpenApiTests/AtomicOperations/OperationsFakers.cs +++ b/test/OpenApiTests/AtomicOperations/OperationsFakers.cs @@ -13,8 +13,11 @@ public sealed class OperationsFakers { private readonly Lazy> _lazyCourseFaker = new(() => new Faker() .MakeDeterministic() - .RuleFor(course => course.Subject, faker => faker.Lorem.Word()) - .RuleFor(course => course.Description, faker => faker.Lorem.Sentence())); + .CustomInstantiator(faker => new Course + { + Subject = faker.Lorem.Word(), + Description = faker.Lorem.Sentence() + })); private readonly Lazy> _lazyTeacherFaker = new(() => new Faker() .MakeDeterministic() @@ -23,8 +26,11 @@ public sealed class OperationsFakers private readonly Lazy> _lazyStudentFaker = new(() => new Faker() .MakeDeterministic() - .RuleFor(student => student.Name, faker => faker.Person.FullName) - .RuleFor(student => student.EmailAddress, faker => faker.Person.Email)); + .CustomInstantiator(faker => new Student + { + Name = faker.Person.FullName, + EmailAddress = faker.Person.Email + })); private readonly Lazy> _lazyEnrollmentFaker; @@ -37,9 +43,24 @@ public OperationsFakers(IServiceProvider serviceProvider) { _lazyEnrollmentFaker = new Lazy>(() => new Faker() .MakeDeterministic() - .CustomInstantiator(_ => new Enrollment(ResolveDbContext(serviceProvider))) - .RuleFor(enrollment => enrollment.EnrolledAt, faker => faker.Date.PastDateOnly()) - .RuleFor(enrollment => enrollment.GraduatedAt, faker => faker.Date.RecentDateOnly())); + .CustomInstantiator(faker => + { + OperationsDbContext dbContext = ResolveDbContext(serviceProvider); + + return new Enrollment(dbContext) + { + Student = new Student + { + Name = faker.Name.FullName() + }, + Course = new Course + { + Subject = faker.Commerce.Department() + }, + EnrolledAt = faker.Date.PastDateOnly(), + GraduatedAt = faker.Date.RecentDateOnly() + }; + })); } private OperationsDbContext ResolveDbContext(IServiceProvider serviceProvider) diff --git a/test/OpenApiTests/AtomicOperations/Student.cs b/test/OpenApiTests/AtomicOperations/Student.cs index 465fa52bc0..613919a432 100644 --- a/test/OpenApiTests/AtomicOperations/Student.cs +++ b/test/OpenApiTests/AtomicOperations/Student.cs @@ -10,7 +10,7 @@ namespace OpenApiTests.AtomicOperations; public sealed class Student : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public string? EmailAddress { get; set; } diff --git a/test/OpenApiTests/AtomicOperations/Teacher.cs b/test/OpenApiTests/AtomicOperations/Teacher.cs index 86ff5bb4d4..c7995a287d 100644 --- a/test/OpenApiTests/AtomicOperations/Teacher.cs +++ b/test/OpenApiTests/AtomicOperations/Teacher.cs @@ -9,7 +9,7 @@ namespace OpenApiTests.AtomicOperations; public sealed class Teacher : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public string? EmailAddress { get; set; } diff --git a/test/OpenApiTests/ClientIdGenerationModes/Game.cs b/test/OpenApiTests/ClientIdGenerationModes/Game.cs index c4880054c1..243b2be6e8 100644 --- a/test/OpenApiTests/ClientIdGenerationModes/Game.cs +++ b/test/OpenApiTests/ClientIdGenerationModes/Game.cs @@ -12,7 +12,7 @@ namespace OpenApiTests.ClientIdGenerationModes; public sealed class Game : Identifiable { [Attr] - public string Title { get; set; } = null!; + public required string Title { get; set; } [Attr] public decimal PurchasePrice { get; set; } diff --git a/test/OpenApiTests/ClientIdGenerationModes/Player.cs b/test/OpenApiTests/ClientIdGenerationModes/Player.cs index e150af5756..d121039bf3 100644 --- a/test/OpenApiTests/ClientIdGenerationModes/Player.cs +++ b/test/OpenApiTests/ClientIdGenerationModes/Player.cs @@ -12,7 +12,7 @@ namespace OpenApiTests.ClientIdGenerationModes; public sealed class Player : Identifiable { [Attr] - public string UserName { get; set; } = null!; + public required string UserName { get; set; } [HasMany] public List OwnedGames { get; set; } = []; diff --git a/test/OpenApiTests/ClientIdGenerationModes/PlayerGroup.cs b/test/OpenApiTests/ClientIdGenerationModes/PlayerGroup.cs index 9f2547a61f..925f4a99ba 100644 --- a/test/OpenApiTests/ClientIdGenerationModes/PlayerGroup.cs +++ b/test/OpenApiTests/ClientIdGenerationModes/PlayerGroup.cs @@ -12,7 +12,7 @@ namespace OpenApiTests.ClientIdGenerationModes; public sealed class PlayerGroup : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasMany] public List Players { get; set; } = []; diff --git a/test/OpenApiTests/Documentation/Elevator.cs b/test/OpenApiTests/Documentation/Elevator.cs index c739454c55..dc7de07842 100644 --- a/test/OpenApiTests/Documentation/Elevator.cs +++ b/test/OpenApiTests/Documentation/Elevator.cs @@ -22,5 +22,5 @@ public sealed class Elevator : Identifiable /// The skyscraper this elevator exists in. /// [HasOne] - public Skyscraper ExistsIn { get; set; } = null!; + public required Skyscraper ExistsIn { get; set; } } diff --git a/test/OpenApiTests/Documentation/Space.cs b/test/OpenApiTests/Documentation/Space.cs index 196780dd34..61f3e663db 100644 --- a/test/OpenApiTests/Documentation/Space.cs +++ b/test/OpenApiTests/Documentation/Space.cs @@ -27,5 +27,5 @@ public sealed class Space : Identifiable /// The skyscraper this space exists in. /// [HasOne] - public Skyscraper ExistsIn { get; set; } = null!; + public required Skyscraper ExistsIn { get; set; } } diff --git a/test/OpenApiTests/Headers/Country.cs b/test/OpenApiTests/Headers/Country.cs index a0398c03bc..cc38c2c444 100644 --- a/test/OpenApiTests/Headers/Country.cs +++ b/test/OpenApiTests/Headers/Country.cs @@ -9,7 +9,7 @@ namespace OpenApiTests.Headers; public sealed class Country : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public long Population { get; set; } diff --git a/test/OpenApiTests/Headers/Language.cs b/test/OpenApiTests/Headers/Language.cs index 3f2eae5ff3..cd43fa5f5d 100644 --- a/test/OpenApiTests/Headers/Language.cs +++ b/test/OpenApiTests/Headers/Language.cs @@ -9,8 +9,8 @@ namespace OpenApiTests.Headers; public sealed class Language : Identifiable { [Attr] - public string Code { get; set; } = null!; + public required string Code { get; set; } [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } } diff --git a/test/OpenApiTests/IdObfuscation/BankAccount.cs b/test/OpenApiTests/IdObfuscation/BankAccount.cs index 319b025856..9456c3351f 100644 --- a/test/OpenApiTests/IdObfuscation/BankAccount.cs +++ b/test/OpenApiTests/IdObfuscation/BankAccount.cs @@ -9,7 +9,7 @@ namespace OpenApiTests.IdObfuscation; public sealed class BankAccount : ObfuscatedIdentifiable { [Attr] - public string Iban { get; set; } = null!; + public required string Iban { get; set; } [HasMany] public IList Cards { get; set; } = new List(); diff --git a/test/OpenApiTests/IdObfuscation/DebitCard.cs b/test/OpenApiTests/IdObfuscation/DebitCard.cs index 7bbdb26a8e..694478f39e 100644 --- a/test/OpenApiTests/IdObfuscation/DebitCard.cs +++ b/test/OpenApiTests/IdObfuscation/DebitCard.cs @@ -9,11 +9,11 @@ namespace OpenApiTests.IdObfuscation; public sealed class DebitCard : ObfuscatedIdentifiable { [Attr] - public string OwnerName { get; set; } = null!; + public required string OwnerName { get; set; } [Attr] public short PinCode { get; set; } [HasOne] - public BankAccount Account { get; set; } = null!; + public required BankAccount Account { get; set; } } diff --git a/test/OpenApiTests/LegacyOpenApi/Airplane.cs b/test/OpenApiTests/LegacyOpenApi/Airplane.cs index aa89d99f61..df270b1243 100644 --- a/test/OpenApiTests/LegacyOpenApi/Airplane.cs +++ b/test/OpenApiTests/LegacyOpenApi/Airplane.cs @@ -11,7 +11,7 @@ public sealed class Airplane : Identifiable { [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowCreate | AttrCapabilities.AllowChange)] [MaxLength(255)] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowCreate | AttrCapabilities.AllowChange)] [MaxLength(16)] diff --git a/test/OpenApiTests/LegacyOpenApi/Flight.cs b/test/OpenApiTests/LegacyOpenApi/Flight.cs index 5baa315523..36e0a747cf 100644 --- a/test/OpenApiTests/LegacyOpenApi/Flight.cs +++ b/test/OpenApiTests/LegacyOpenApi/Flight.cs @@ -12,7 +12,7 @@ public sealed class Flight : Identifiable { [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowChange)] [MaxLength(40)] - public string FinalDestination { get; set; } = null!; + public required string FinalDestination { get; set; } [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowChange)] [MaxLength(2000)] @@ -31,7 +31,7 @@ public sealed class Flight : Identifiable public ISet CabinCrewMembers { get; set; } = new HashSet(); [HasOne] - public FlightAttendant Purser { get; set; } = null!; + public required FlightAttendant Purser { get; set; } [HasOne] public FlightAttendant? BackupPurser { get; set; } diff --git a/test/OpenApiTests/LegacyOpenApi/FlightAttendant.cs b/test/OpenApiTests/LegacyOpenApi/FlightAttendant.cs index 6eb6872072..497c5034a0 100644 --- a/test/OpenApiTests/LegacyOpenApi/FlightAttendant.cs +++ b/test/OpenApiTests/LegacyOpenApi/FlightAttendant.cs @@ -26,7 +26,7 @@ public sealed class FlightAttendant : Identifiable [Attr(Capabilities = AttrCapabilities.AllowView | AttrCapabilities.AllowCreate)] [Url] - public string ProfileImageUrl { get; set; } = null!; + public required string ProfileImageUrl { get; set; } [Attr] public long DistanceTraveledInKilometers { get; set; } diff --git a/test/OpenApiTests/LegacyOpenApi/Passenger.cs b/test/OpenApiTests/LegacyOpenApi/Passenger.cs index c939562447..f345f10e0d 100644 --- a/test/OpenApiTests/LegacyOpenApi/Passenger.cs +++ b/test/OpenApiTests/LegacyOpenApi/Passenger.cs @@ -11,7 +11,7 @@ public sealed class Passenger : Identifiable { [Attr(PublicName = "document-number", Capabilities = AttrCapabilities.AllowCreate | AttrCapabilities.AllowChange)] [MaxLength(9)] - public string PassportNumber { get; set; } = null!; + public required string PassportNumber { get; set; } [Attr] public string? FullName { get; set; } diff --git a/test/OpenApiTests/Links/Accommodation.cs b/test/OpenApiTests/Links/Accommodation.cs index 5a793da701..42e4ecb6b9 100644 --- a/test/OpenApiTests/Links/Accommodation.cs +++ b/test/OpenApiTests/Links/Accommodation.cs @@ -9,5 +9,5 @@ namespace OpenApiTests.Links; public sealed class Accommodation : Identifiable { [Attr] - public string Address { get; set; } = null!; + public required string Address { get; set; } } diff --git a/test/OpenApiTests/Links/Excursion.cs b/test/OpenApiTests/Links/Excursion.cs index 92143cab73..29add4bc5d 100644 --- a/test/OpenApiTests/Links/Excursion.cs +++ b/test/OpenApiTests/Links/Excursion.cs @@ -14,5 +14,5 @@ public sealed class Excursion : Identifiable public DateTime? OccursAt { get; set; } [Attr] - public string Description { get; set; } = null!; + public required string Description { get; set; } } diff --git a/test/OpenApiTests/Links/Vacation.cs b/test/OpenApiTests/Links/Vacation.cs index df592a4423..130b9eb5da 100644 --- a/test/OpenApiTests/Links/Vacation.cs +++ b/test/OpenApiTests/Links/Vacation.cs @@ -18,7 +18,7 @@ public sealed class Vacation : Identifiable public DateTime? EndsAt { get; set; } [HasOne] - public Accommodation Accommodation { get; set; } = null!; + public required Accommodation Accommodation { get; set; } [HasOne] public Transport? Transport { get; set; } diff --git a/test/OpenApiTests/ModelStateValidation/SocialMediaAccount.cs b/test/OpenApiTests/ModelStateValidation/SocialMediaAccount.cs index 28fbd7148d..ed167a1a47 100644 --- a/test/OpenApiTests/ModelStateValidation/SocialMediaAccount.cs +++ b/test/OpenApiTests/ModelStateValidation/SocialMediaAccount.cs @@ -25,7 +25,7 @@ public sealed class SocialMediaAccount : Identifiable [Attr] [Required(AllowEmptyStrings = true)] - public string LastName { get; set; } = null!; + public required string LastName { get; set; } [Attr] [StringLength(18, MinimumLength = 3)] diff --git a/test/OpenApiTests/NamingConventions/StaffMember.cs b/test/OpenApiTests/NamingConventions/StaffMember.cs index beeeb3f997..ff5c3bf9a3 100644 --- a/test/OpenApiTests/NamingConventions/StaffMember.cs +++ b/test/OpenApiTests/NamingConventions/StaffMember.cs @@ -9,7 +9,7 @@ namespace OpenApiTests.NamingConventions; public sealed class StaffMember : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public int Age { get; set; } diff --git a/test/OpenApiTests/NamingConventions/Supermarket.cs b/test/OpenApiTests/NamingConventions/Supermarket.cs index ea7a2cb8c4..39efa3f8d8 100644 --- a/test/OpenApiTests/NamingConventions/Supermarket.cs +++ b/test/OpenApiTests/NamingConventions/Supermarket.cs @@ -9,13 +9,13 @@ namespace OpenApiTests.NamingConventions; public sealed class Supermarket : Identifiable { [Attr] - public string NameOfCity { get; set; } = null!; + public required string NameOfCity { get; set; } [Attr] public SupermarketType Kind { get; set; } [HasOne] - public StaffMember StoreManager { get; set; } = null!; + public required StaffMember StoreManager { get; set; } [HasOne] public StaffMember? BackupStoreManager { get; set; } diff --git a/test/OpenApiTests/QueryStrings/NameValuePair.cs b/test/OpenApiTests/QueryStrings/NameValuePair.cs index ab7fd2f61e..a927920a13 100644 --- a/test/OpenApiTests/QueryStrings/NameValuePair.cs +++ b/test/OpenApiTests/QueryStrings/NameValuePair.cs @@ -9,11 +9,11 @@ namespace OpenApiTests.QueryStrings; public sealed class NameValuePair : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public string? Value { get; set; } [HasOne] - public Node Owner { get; set; } = null!; + public required Node Owner { get; set; } } diff --git a/test/OpenApiTests/QueryStrings/Node.cs b/test/OpenApiTests/QueryStrings/Node.cs index e9da915295..9ea72c7b9d 100644 --- a/test/OpenApiTests/QueryStrings/Node.cs +++ b/test/OpenApiTests/QueryStrings/Node.cs @@ -9,7 +9,7 @@ namespace OpenApiTests.QueryStrings; public sealed class Node : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [Attr] public string? Comment { get; set; } diff --git a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/NrtOnResource.cs b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/NrtOnResource.cs index 69056d716a..4022d6bdd1 100644 --- a/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/NrtOnResource.cs +++ b/test/OpenApiTests/ResourceFieldValidation/NullableReferenceTypesOn/NrtOnResource.cs @@ -10,11 +10,11 @@ namespace OpenApiTests.ResourceFieldValidation.NullableReferenceTypesOn; public sealed class NrtOnResource : Identifiable { [Attr] - public string NonNullableReferenceType { get; set; } = null!; + public required string NonNullableReferenceType { get; set; } [Attr] [Required] - public string RequiredNonNullableReferenceType { get; set; } = null!; + public required string RequiredNonNullableReferenceType { get; set; } [Attr] public string? NullableReferenceType { get; set; } @@ -38,11 +38,11 @@ public sealed class NrtOnResource : Identifiable public int? RequiredNullableValueType { get; set; } [HasOne] - public NrtOnEmpty NonNullableToOne { get; set; } = null!; + public required NrtOnEmpty NonNullableToOne { get; set; } [Required] [HasOne] - public NrtOnEmpty RequiredNonNullableToOne { get; set; } = null!; + public required NrtOnEmpty RequiredNonNullableToOne { get; set; } [HasOne] public NrtOnEmpty? NullableToOne { get; set; } diff --git a/test/OpenApiTests/ResourceInheritance/Models/District.cs b/test/OpenApiTests/ResourceInheritance/Models/District.cs index 3ef752e386..d826c84cc6 100644 --- a/test/OpenApiTests/ResourceInheritance/Models/District.cs +++ b/test/OpenApiTests/ResourceInheritance/Models/District.cs @@ -9,7 +9,7 @@ namespace OpenApiTests.ResourceInheritance.Models; public sealed class District : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } [HasMany] public ISet Buildings { get; set; } = new HashSet(); diff --git a/test/OpenApiTests/ResourceInheritance/Models/Mansion.cs b/test/OpenApiTests/ResourceInheritance/Models/Mansion.cs index acf87c8eee..cd9bcbc7b1 100644 --- a/test/OpenApiTests/ResourceInheritance/Models/Mansion.cs +++ b/test/OpenApiTests/ResourceInheritance/Models/Mansion.cs @@ -8,7 +8,7 @@ namespace OpenApiTests.ResourceInheritance.Models; public sealed class Mansion : Residence { [Attr] - public string OwnerName { get; set; } = null!; + public required string OwnerName { get; set; } [HasMany] public ISet Staff { get; set; } = new HashSet(); diff --git a/test/OpenApiTests/ResourceInheritance/Models/Room.cs b/test/OpenApiTests/ResourceInheritance/Models/Room.cs index 6cf38598b7..cb25ecdaad 100644 --- a/test/OpenApiTests/ResourceInheritance/Models/Room.cs +++ b/test/OpenApiTests/ResourceInheritance/Models/Room.cs @@ -14,5 +14,5 @@ public abstract class Room : Identifiable public int? SurfaceInSquareMeters { get; set; } [HasOne] - public Residence Residence { get; set; } = null!; + public required Residence Residence { get; set; } } diff --git a/test/OpenApiTests/ResourceInheritance/Models/StaffMember.cs b/test/OpenApiTests/ResourceInheritance/Models/StaffMember.cs index 0baa95db7e..1015891b43 100644 --- a/test/OpenApiTests/ResourceInheritance/Models/StaffMember.cs +++ b/test/OpenApiTests/ResourceInheritance/Models/StaffMember.cs @@ -9,5 +9,5 @@ namespace OpenApiTests.ResourceInheritance.Models; public sealed class StaffMember : Identifiable { [Attr] - public string Name { get; set; } = null!; + public required string Name { get; set; } } diff --git a/test/OpenApiTests/RestrictedControllers/Channel.cs b/test/OpenApiTests/RestrictedControllers/Channel.cs index a91555582d..9fa050de66 100644 --- a/test/OpenApiTests/RestrictedControllers/Channel.cs +++ b/test/OpenApiTests/RestrictedControllers/Channel.cs @@ -17,7 +17,7 @@ public abstract class Channel : Identifiable public bool? IsAdultOnly { get; set; } [HasOne] - public DataStream VideoStream { get; set; } = null!; + public required DataStream VideoStream { get; set; } [HasOne] public DataStream? UltraHighDefinitionVideoStream { get; set; }