Is there any effort to generate correct types for null reference types?
For example:
public class CommentDto
{
public int CommentID { get; set; }
public int BusinessCaseID { get; set; }
public int SenderID { get; set; }
public string Text { get; set; } = string.Empty;
public UserDto? Sender { get; set; }
}
public class UserDto
{
public UserDto()
{
Login = string.Empty;
FirstName = string.Empty;
LastName = string.Empty;
}
public int UserID { get; set; }
public string Login { get; set; }
public string? Phone { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime? LastSignInDate { get; set; }
public string? AvatarUrl { get; set; }
}
will be generated as:

There are multiple problems in this generated code:
I saw some hacks/extensions like this #1487, but in my opinion, this is a pretty basic feature and should be implemented in this library.
Thank you for your answer.
Unfortunately, we have moved to nswag. It works correctly and migration have taken us only a few hours.
Thanks for the feedback, and sorry to see you go. For anyone else reading this thread, rest assured support for Nullable Reference Types is top of the list for Swashbuckle and something I hope to get out very soon.
This actually warrants some careful consideration with regards to how this is implemented.
System.Text.Json currently blows up when attempting to deserialize a null struct, but permits a nulls for non-null reference types - despite the fact that default(T) is (arguably) a valid instance of a struct T, but not for reference type T (dotnet/runtime#1256).
Under the current behavior, there's an argument that all reference types in your serialization model are required to be nullable.
(I think this issue is a duplicate of https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1686)
Closing because (as stated by @Zero3) this is a dup of #1686
Most helpful comment
Thanks for the feedback, and sorry to see you go. For anyone else reading this thread, rest assured support for Nullable Reference Types is top of the list for Swashbuckle and something I hope to get out very soon.