You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EDIT: wow, weird. At some places in the code, string? IS used correctly:
/// <summary>
/// The name of the institution that provides the income.
/// </summary>
[Newtonsoft.Json.JsonProperty("institutionName", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
[System.ComponentModel.DataAnnotations.StringLength(30)]
public string? InstitutionName { get; set; } = default!;
Help for finding were to fix it:
It seems that if a property has a <summary>, then it is generated correctly (as nullable, with ?).
If there is no summary, it is generated wrongly (without ?, as non-nullable).
I have more than 15 cases of both and without exception!
The text was updated successfully, but these errors were encountered:
NSwagStudio v13.16.1.0
Runtime: Net60
Outputs: CSharpClient
Settings:
According to its docs, the
Newtonsoft.Json.Required.DisallowNull
enum value means:so then properties that are marked that way are "optional".
For (EDIT: some) value type properties, the generated outputs is:
This is wrong:
string
should bestring?
andint
should beint?
for these optional properties.For nullable reference types and
enum
s it always looks OK:EDIT: wow, weird. At some places in the code,
string?
IS used correctly:Help for finding were to fix it:
<summary>
, then it is generated correctly (as nullable, with?
).?
, as non-nullable).I have more than 15 cases of both and without exception!
The text was updated successfully, but these errors were encountered: