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
NSwag seems unable to correctly generate API clients for dictionary properties with nullable reference type values, such as public Dictionary<string, object?> { get; set; } and I think I've tracked this down to an issue with NJsonSchema not supporting this.
I've made a small change that shows when the schema generation is changed to set the property as nullable the C# code generation does correctly generate a Dictionary<string, object?> as expected. The commit is here: 5f52e9d
This change doesn't result in the exact same code as shown above for nullable primitives though so perhaps this isn't the correct way to fix this.
NSwag seems unable to correctly generate API clients for dictionary properties with nullable reference type values, such as
public Dictionary<string, object?> { get; set; }
and I think I've tracked this down to an issue with NJsonSchema not supporting this.Generating a schema for this class:
incorrectly generates the following schema which lacks the
nullable
additional property:Nullable primitives don't exhibit the same issue however:
correctly generates the following:
I've made a small change that shows when the schema generation is changed to set the property as nullable the C# code generation does correctly generate a
Dictionary<string, object?>
as expected. The commit is here: 5f52e9dThis change doesn't result in the exact same code as shown above for nullable primitives though so perhaps this isn't the correct way to fix this.
The text was updated successfully, but these errors were encountered: