Skip to content

Releases: RicoSuter/NSwag

NSwag v14.7.1 (NJsonSchema v11.6.1)

20 Apr 18:58
2389c07

Choose a tag to compare

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[] | 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

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

NSwag v14.7.0 (NJsonSchema v11.6.0)

08 Apr 19:05
b108f11

Choose a tag to compare

Caution

Do not use this release — upgrade to v14.7.1 or later.

v14.7.0 bundles NJsonSchema v11.6.0, which contained a regression that silently dropped nullability on required T? / [JsonRequired] T? DTO properties. Generated TypeScript and C# clients lost null-safety for fields the server can legitimately return as null (#5359). Fixed in v14.7.1.


What's Changed

  • Upgrade to NUKE 10 by @lahma in #5310
  • Upgrade to NUKE 10.1.0 by @lahma in #5314
  • Fix specifying runtime for NSwag.Npm resulting in a NConsole.UnusedArgumentException by @ptasev in #5320
  • fix: nullpointer by @MeikelLP in #5337
  • fix axios template: [object Object] is not valid JSON. by @adnanalbeda in #5283
  • Fix legacy document transformation by @copyleftproducts in #5315
  • Fix compile error in generated C# client when media type contains quotes by @bkoelman in #5345
  • Fix duplicate client/operation names when operation IDs contain multiple underscores by @Copilot in #5348
  • Update to NJsonSchema v11.6.0 and Namotion.Reflection v3.5.0 (v14.7.0) by @RicoSuter in #5357

NJsonSchema v11.6.0 (potentially breaking changes)

This release updates to NJsonSchema v11.6.0 and Namotion.Reflection v3.5.0, which include the following changes that may affect generated code:

  • C# 11 required keyword now correctly recognized: Properties using the C# 11 required keyword (via RequiredMemberAttribute / JsonRequiredAttribute) are now properly treated as required in the schema and generated code. Previously these were incorrectly treated as optional.
  • Removed extra blank line before class declarations in generated C# controller code (cosmetic).
  • New WriteAccessor setting to control property setter syntax (set vs init).
  • New JsonLibraryVersion setting for controlling enum attribute generation with System.Text.Json.
  • Fixed MinLength validation no longer incorrectly applied to DateTime properties.
  • Fixed nullable enum array detection for string enum converters.
  • Support for public fields with System.Text.Json when IncludeFields is enabled.

For the full list of changes, see the NJsonSchema v11.6.0 release notes.

New Contributors

Full Changelog: v14.6.3...v14.7.0

NSwag v14.6.3 (NJsonSchema v11.5.2)

20 Nov 19:20
b595e3b

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v14.6.2...v14.6.3

NSwag v14.6.2 (NJsonSchema v11.5.2)

05 Nov 13:56

Choose a tag to compare

Fixes EnumValue regression in v14.6.1 by introducing a new JsonLibraryVersion configuration (default 8.0)

What's Changed

image

Full Changelog: v14.6.1...v14.6.2

NSwag v14.6.1 (NJsonSchema v11.5.1)

30 Sep 20:49

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v14.6.0...v14.6.1

NSwag v14.6.0 (NJsonSchema v11.5.0)

18 Sep 18:36

Choose a tag to compare

What's Changed

  • Update NJS v11.5.0, breaking: minimum TypeScript output version is now 4.3 by @RicoSuter in #5268
  • Add .NET 10 support by @RicoSuter in #5271
  • Fix generating typescript fetch client interfaces when useAbortSignal is false by @htuomola in #5243
  • Add test coverage for some APIs by @lahma in #5244
  • Issue-5239 - Adding K6 template to TypeScript Code Generator by @jsclifford in #5240
  • Fix NPM CLI argument handling by @lahma in #5245
  • #5250 - K6 template for Typescript has errors when void is return type by @jsclifford in #5251
  • Add option to generate code only for selected operation IDs by @amayouf in #5248
  • Add credentials and mode attributes to fetch template generation by @etriebe in #5235
  • Fix for Reusable request bodies are not handled correctly #2747 by @Doomic in #5196
  • Refactor: Inline NConsole with fixes by @RicoSuter in #5272

New Contributors

Full Changelog: v14.5.0...v14.6.0

NSwag v14.5.0 (NJsonSchema v11.4.0)

02 Aug 22:36
bc75a1e

Choose a tag to compare

What's Changed

  • Better support for reading yaml from a stream by @simonthum in #5170
  • #4821 Cleanup packages to use those provided by framework by @thompson-tomo in #4831
  • Set GH actions target .NET SDK to 9.0.204 by @lahma in #5172
  • Better support for reading yaml from a stream (part two) by @simonthum in #5171
  • Avoid multiple enumeration of array typed path parameters by @Khyalis in #5149
  • Restores all disabled compiler warnings. 649 and 8765 were missing. by @carlbjorknas in #4962
  • Fix to explode array parameters implicitly when SchemaType is OpenAPI 3.0 by @Phoosha in #5176
  • Adding cancellationToken to all calls to ReadAsStringAsync() and ReadAsStreamAsync() by @arshrp in #5187
  • Remove requirement for specific NET SDK in GH Actions by @lahma in #5188
  • Adjusted cancellationToken to work for all NSwag supported frameworks by @arshrp in #5190
  • Allow setting of the client interface access modifier based on the model access modifier by @pbolduc in #4820
  • Prioritize wildcard over json over first entry for accept content-type by @mdi1984 in #5198
  • Reduce interface dispatch to improve performance by @lahma in #5199
  • Surface ExtensionData in CSharpControllerTemplateModel by @hirudan in #5204
  • Expose the UseRequiredKeyword on CSharpClientGeneratorSettings for CSharp client generator by @r-englund in #5205
  • Fix to expose an optional param for AbortSignal (for axios) / CancelToken (for fetch) when GenerateClientInterfaces = true by @tomvdk in #5202
  • Sort client operation responses by status code by @lahma in #5206
  • TSC UpdateUseDtoClassAndDataConversionCodeProperties cleanup by @lahma in #5212
  • Update Microsoft.AspNetCore.* references to target 2.3.0 by @lahma in #5214
  • Convert to using Central Package Management by @lahma in #5217
  • Convert NSwagStudio setup to use WiX 6 by @lahma in #5218
  • Add support for TypeScript compilation testing by @lahma in #5219
  • Replace TypeScript string contain asserts with Verify tests by @lahma in #5220
  • Replace C# string contain asserts with Verify tests by @lahma in #5221
  • Remove deprecated tslint suppression by @CaringDev in #5020
  • Fix empty enumerable parameter handling in C# client by @lahma in #5222
  • Fix: C# Code Generation generates method with return default(void) by @nzeemin in #4826
  • Optimize DefaultParameterNameGenerator and add some more char cleanup by @lahma in #5223
  • Convert more tests to use verify by @lahma in #5224
  • Convert to xUnit v3 by @lahma in #5225
  • Ensure operation names start with alphanumeric character by @lahma in #5227
  • Change GenerateSampleSpecificationTests to auto verify mode by @lahma in #5228
  • Show DisplayName for conflicting actions by @Saibamen in #5057
  • Fix: When generated TS class name is "Error", it is conflicting with TS Error class by @doruk-info in #5032
  • Update NJsonSchema to 11.4.0, update testsuite to reflect a change in class name generation by @WolfgangHG in #5177
  • Improve nswag.js parameter handling by @KaterSchnurz in #5232
  • Use TypeScript 4.3 as default testing version by @lahma in #5234
  • v14.5.0 by @RicoSuter in #5236

New Contributors

Full Changelog: v14.4.0...v14.5.0

NSwag v14.4.0 (NJsonSchema v11.3.2)

28 Apr 22:03

Choose a tag to compare

What's Changed

  • Fix optional parameter ordering in generated TS/CS clients by @lahma in #5135
  • Add MSBuildProjectDirectory fallback to ProjectDir resolution by @lahma in #5146
  • Tolerate missing schema in OperationModelBase.GetActualParameters by @lahma in #5147
  • Improve OpenApiOperation ActualResponses and Responses performance by @lahma in #5148
  • Optimize OpenApiDocument.GenerateOperationIds by @lahma in #5150
  • Optimize MultipleClientsFromOperationIdOperationNameGenerator duplicate checks by @lahma in #5151
  • Fix some string API usage by @lahma in #5152
  • Add NET 8 targets to core libraries by @lahma in #5153
  • Optimize ObservableDictionary.CollectionChanged by @lahma in #5154
  • Fix array parameter explosion check by @lahma in #5158
  • Include each client type in JIRA OpenAPI Verify testing by @lahma in #5160
  • Update to NJsonSchema v11.3.2 & Namotion.Reflection v3.4.2 by @RicoSuter in #5161
  • Upgraded Microsoft.Extensions.ApiDescription.* to 8.0.14 by @ntyrrell in #5121
  • Add support for STJ-native C# code gen by @mac-michael in #5155
  • Update to Swagger UI v5.21.0 by @RicoSuter in #5162

New Contributors

Full Changelog: v14.3.0...v14.4.0

NSwag v14.3.0 (NJsonSchema v11.2.0)

29 Mar 16:17

Choose a tag to compare

Updated to NJsonSchema v11.2.0, see https://github.com/RicoSuter/NJsonSchema/releases/tag/v11.2.0

What's Changed

New Contributors

Full Changelog: v14.2.0...v14.3.0

NSwag v14.2.0 (.NET 9)

19 Nov 15:20
2888363

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v14.1.0...v14.2.0