github RicoSuter/NSwag v14.7.1
NSwag v14.7.1 (NJsonSchema v11.6.1)

8 hours ago

Important

Upgrade directly from v14.6.3 to v14.7.1 — skip v14.7.0.

v14.7.0 bundled NJsonSchema v11.6.0, which contained a regression that silently dropped nullability on required T? / [JsonRequired] T? DTO properties. The resulting OpenAPI/JSON schema marked those properties as non-nullable, so generated TypeScript and C# clients lost null-safety for fields the server can legitimately return as null (#5359).

Corrections to v14.7.0

v14.7.1 updates to NJsonSchema v11.6.1, which corrects the handling of the C# required keyword and [JsonRequired]:

  • These are now treated as presence markers (the property must be present in the JSON) rather than value constraints.
  • Nullability from the declared type (string?, T?) is preserved.
  • No spurious MinLength=1 on non-nullable strings.
  • DataAnnotations [Required] semantics remain unchanged (still suppresses nullability and adds MinLength=1 to strings by default, matching its runtime behavior).

Observable client changes vs v14.7.0

For public required string[]? OptionList { get; init; } (#5359):

TypeScript client C# client
v14.7.0 (broken) optionList: string[]public string[] OptionList
v14.7.1 optionList: string[] | nullpublic string[]? OptionList

For full details and truth tables across all required / [Required] / [JsonRequired] / [JsonProperty(Required=*)] combinations, see the NJsonSchema v11.6.1 release notes and NJsonSchema #1919.

What's Changed

Full Changelog: v14.7.0...v14.7.1

Don't miss a new NSwag release

NewReleases is sending notifications on new releases.