Skip to content

NSwag v10.0 (Build 813)

Compare
Choose a tag to compare
@RicoSuter RicoSuter released this 07 Apr 16:41

Breaking changes (TS generator):

  • Important: Extended classes (defined in ExtensionCode) are now copied into the generated classes (extension is no longer based on inheritance), see NJS/TypeScriptGenerator for more information. If you use extension code, you probably have to do some minor changes.
  • ko and jquery are now automatically imported in the generated file (to use old behavior, set ImportRequiredTypes to false)
  • Non-JSON results (i.e. images, binary data, etc.) are now streamed and returned as blobs instead of any (except with the JQuery templates, they do not support blob download).
  • Renamed TypeScriptTemplate.Angular2 to Angular: NSwag Documents are automatically migrated, otherwise you have to change the setting Template from Angular2 to Angular
  • MarkOptionalProperties is now by default true

NJsonSchema (DTOs)

  • DTO objects are now initialized with the init() method instead of the constructor. If you rely on that, you have to refactor your code (NJsonSchema change).
  • The toJS() method has been renamed to toJSON() (the original toJSON() method has been removed, use JSON.stringify(dto.toJSON()) instead)
  • The clone() methods in DTOs are not generated by default anymore (added GenerateCloneMethod setting)

Breaking changes (WebApiToSwagger generator):

  • IDocumentProcessor and ITypeMapper are now async: #684

Changes (TS generator):

  • Reduced file size by nearly 20 % when using undefined as Null value.
  • Added support to handle $ref, $id and $values when deserializing DTOs (circular references). Can be enabled with the HandleReferences setting (default: false, because more code is generated).
  • Improved all templates so that you can enable strictNullChecks in your tsconfig.json (may still require improvements)
  • Added GenerateConstructorInterface setting (default: true) for simpler DTO class initialization

Changes (WebApiToSwagger generator):

  • Improved Web API routing handling: 2d8ec06
  • Support for multiple success responses with the same type, #700