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=1on non-nullable strings. - DataAnnotations
[Required]semantics remain unchanged (still suppresses nullability and addsMinLength=1to 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[] | null ✅
| public 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
- Upgrade to NJsonSchema v11.6.1 (NSwag v14.7.1) by @RicoSuter in #5367 (fixes #5359)
Full Changelog: v14.7.0...v14.7.1