Skip to content

Commit

Permalink
Merge pull request #708 from NSwag/master
Browse files Browse the repository at this point in the history
Release v10.0
  • Loading branch information
RicoSuter authored Apr 7, 2017
2 parents 3cb2404 + 164027a commit c6c55e1
Show file tree
Hide file tree
Showing 171 changed files with 10,444 additions and 8,063 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ src/packages/**
/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsPetStoreFetch.js.map
/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsAngular2.extensions.js.map
/src/NSwag.Integration.TypeScriptWeb/scripts/serviceClientsAngular2.extensions.js
/src/dist
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Release v10 Announcement

**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](https://github.com/NJsonSchema/NJsonSchema/wiki/TypeScriptGenerator#extended-classes-and-extension-code) 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: https://github.com/NSwag/NSwag/issues/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: https://github.com/NSwag/NSwag/commit/2d8ec0629e302947cafdf776717d48e21d2dc736
- Support for multiple success responses with the same type, https://github.com/NSwag/NSwag/issues/700
286 changes: 144 additions & 142 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/NSwag.Annotations/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
[assembly: AssemblyCompany("Rico Suter")]
[assembly: AssemblyProduct("NSwag.Annotations")]
[assembly: AssemblyCopyright("Copyright © Rico Suter, 2016")]
[assembly: AssemblyVersion("9.12.*")]
[assembly: AssemblyVersion("10.0.*")]
10 changes: 9 additions & 1 deletion src/NSwag.Annotations/WillReadBodyAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
namespace NSwag.Annotations
//-----------------------------------------------------------------------
// <copyright file="WillReadBodyAttribute.cs" company="NSwag">
// Copyright (c) Rico Suter. All rights reserved.
// </copyright>
// <license>https://github.com/NSwag/NSwag/blob/master/LICENSE.md</license>
// <author>Rico Suter, [email protected]</author>
//-----------------------------------------------------------------------

namespace NSwag.Annotations
{
using System;

Expand Down
4 changes: 2 additions & 2 deletions src/NSwag.AspNet.Owin/NSwag.AspNet.Owin.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NJsonSchema, Version=8.11.6284.26855, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.8.11.6284.26855\lib\net45\NJsonSchema.dll</HintPath>
<Reference Include="NJsonSchema, Version=8.30.6304.31883, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.8.30.6304.31883\lib\net45\NJsonSchema.dll</HintPath>
</Reference>
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/NSwag.AspNet.Owin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
[assembly: AssemblyCompany("Rico Suter")]
[assembly: AssemblyProduct("NSwag.AspNet.Owin")]
[assembly: AssemblyCopyright("Copyright © Rico Suter, 2016")]
[assembly: AssemblyVersion("9.12.*")]
[assembly: AssemblyVersion("10.0.*")]
2 changes: 1 addition & 1 deletion src/NSwag.AspNet.Owin/SwaggerMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ protected virtual async Task<string> GenerateSwaggerAsync(IOwinContext context)

document.Host = context.Request.Host.Value ?? "";
document.Schemes.Add(context.Request.Scheme == "http" ? SwaggerSchema.Http : SwaggerSchema.Https);
document.BasePath = context.Request.PathBase.Value?.Substring(0, context.Request.PathBase.Value.Length - _settings.MiddlewareBasePath?.Length ?? 0) ?? "";
document.BasePath = context.Request.PathBase.Value?.Substring(0, context.Request.PathBase.Value.Length - (_settings.MiddlewareBasePath?.Length ?? 0)) ?? "";

_settings.PostProcess?.Invoke(document);
_swaggerJson = document.ToJson();
Expand Down
Loading

0 comments on commit c6c55e1

Please sign in to comment.