Skip to content

Commit

Permalink
Merge pull request #77 from NSwag/master
Browse files Browse the repository at this point in the history
Release v2.13
  • Loading branch information
RicoSuter committed May 1, 2016
2 parents 33b6126 + 1c976a3 commit ed10f53
Show file tree
Hide file tree
Showing 28 changed files with 819 additions and 778 deletions.
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, 2015")]
[assembly: AssemblyVersion("2.12.*")]
[assembly: AssemblyVersion("2.13.*")]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Diagnostics;
using System;
using System.Diagnostics;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;

Expand All @@ -11,28 +12,62 @@ public class WebApiCommandLineTests
public void When_webapi2swagger_is_called_then_file_is_created()
{
//// Arrange
if (File.Exists("MyWebService.json"))
File.Delete("MyWebService.json");

var command = "webapi2swagger " +
"/assembly:" + Path.GetFullPath("../../../NSwag.Demo.Web/bin/NSwag.Demo.Web.dll") + " " +
"/controller:NSwag.Demo.Web.Controllers.PersonsController " +
"/output:MyWebService.json";
"/output:" + OutputFile;

//// Act
var output = RunCommandLine(command);
var service = SwaggerService.FromJson(output);

//// Assert
Assert.IsNotNull(service);
}

[TestMethod]
public void When_swagger2typescript_is_called_then_file_is_created()
{
//// Arrange
var command = "swagger2tsclient " +
@"/input:""{ \""swagger\"": \""2.0\"", \""paths\"": {}, \""definitions\"": { \""Test\"": { typeName: \""Test\"", type: \""Object\"" } } }"" " +
"/output:" + OutputFile;

//// Act
var output = RunCommandLine(command);

//// Assert
Assert.IsTrue(output.Contains("export interface Test {"));
}

private const string OutputFile = "Output.json";

private static string RunCommandLine(string command)
{
if (File.Exists(OutputFile))
File.Delete(OutputFile);

var configuration = Directory.GetCurrentDirectory().Contains("bin\\Release") ? "Release" : "Debug";
var process = Process.Start(new ProcessStartInfo
{
FileName = Path.GetFullPath("../../../NSwag/bin/" + (Directory.GetCurrentDirectory().Contains("bin\\Release") ? "Release" : "Debug") + "/NSwag.exe"),
FileName = Path.GetFullPath("../../../NSwag/bin/" + configuration + "/NSwag.exe"),
Arguments = command,
CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden
});

if (!process.WaitForExit(5000))
{
process.Kill();
throw new InvalidOperationException("The process did not terminate.");
}

var json = File.ReadAllText("MyWebService.json");
var output = File.ReadAllText(OutputFile);

//// Assert
Assert.IsTrue(!string.IsNullOrEmpty(json));
if (File.Exists(OutputFile))
File.Delete(OutputFile);

return output;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NJsonSchema, Version=2.11.5963.474, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.2.11.5963.474\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll</HintPath>
<Reference Include="NJsonSchema, Version=2.12.5965.33914, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.2.12.5965.33914\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NJsonSchema.CodeGeneration, Version=2.11.5963.475, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.CodeGeneration.2.11.5963.475\lib\net45\NJsonSchema.CodeGeneration.dll</HintPath>
<Reference Include="NJsonSchema.CodeGeneration, Version=2.12.5965.33915, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.CodeGeneration.2.12.5965.33915\lib\net45\NJsonSchema.CodeGeneration.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion src/NSwag.CodeGeneration.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("2.12.*")]
// [assembly: AssemblyVersion("2.13.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
4 changes: 2 additions & 2 deletions src/NSwag.CodeGeneration.Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="NJsonSchema" version="2.11.5963.474" targetFramework="net45" />
<package id="NJsonSchema.CodeGeneration" version="2.11.5963.475" targetFramework="net45" />
<package id="NJsonSchema" version="2.12.5965.33914" targetFramework="net45" />
<package id="NJsonSchema.CodeGeneration" version="2.12.5965.33915" targetFramework="net45" />
</packages>
8 changes: 4 additions & 4 deletions src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NJsonSchema, Version=2.11.5963.474, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.2.11.5963.474\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll</HintPath>
<Reference Include="NJsonSchema, Version=2.12.5965.33914, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.2.12.5965.33914\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NJsonSchema.CodeGeneration, Version=2.11.5963.475, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.CodeGeneration.2.11.5963.475\lib\net45\NJsonSchema.CodeGeneration.dll</HintPath>
<Reference Include="NJsonSchema.CodeGeneration, Version=2.12.5965.33915, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.CodeGeneration.2.12.5965.33915\lib\net45\NJsonSchema.CodeGeneration.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion src/NSwag.CodeGeneration/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.CodeGeneration")]
[assembly: AssemblyCopyright("Copyright © Rico Suter, 2015")]
[assembly: AssemblyVersion("2.12.*")]
[assembly: AssemblyVersion("2.13.*")]
4 changes: 2 additions & 2 deletions src/NSwag.CodeGeneration/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<packages>
<package id="Antlr4.StringTemplate" version="4.0.6.9004" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="NJsonSchema" version="2.11.5963.474" targetFramework="net45" />
<package id="NJsonSchema.CodeGeneration" version="2.11.5963.475" targetFramework="net45" />
<package id="NJsonSchema" version="2.12.5965.33914" targetFramework="net45" />
<package id="NJsonSchema.CodeGeneration" version="2.12.5965.33915" targetFramework="net45" />
</packages>
4 changes: 2 additions & 2 deletions src/NSwag.Core/NSwag.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NJsonSchema, Version=2.11.5963.474, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.2.11.5963.474\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll</HintPath>
<Reference Include="NJsonSchema, Version=2.12.5965.33914, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.2.12.5965.33914\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion src/NSwag.Core/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")]
[assembly: AssemblyCopyright("Copyright © Rico Suter, 2015")]
[assembly: AssemblyVersion("2.12.*")]
[assembly: AssemblyVersion("2.13.*")]
5 changes: 3 additions & 2 deletions src/NSwag.Core/SwaggerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class SwaggerService
public SwaggerService()
{
Swagger = "2.0";
Info = new SwaggerInfo();
Schemes = new List<SwaggerSchema>();
Responses = new Dictionary<string, SwaggerResponse>();
SecurityDefinitions = new Dictionary<string, SwaggerSecurityScheme>();
Expand Down Expand Up @@ -54,11 +55,11 @@ public SwaggerService()
public static string ToolchainVersion => typeof(SwaggerService).GetTypeInfo().Assembly.GetName().Version.ToString();

/// <summary>Gets or sets the Swagger specification version being used.</summary>
[JsonProperty(PropertyName = "swagger", Required = Required.Always, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[JsonProperty(PropertyName = "swagger", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public string Swagger { get; set; }

/// <summary>Gets or sets the metadata about the API.</summary>
[JsonProperty(PropertyName = "info", Required = Required.Always, DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
[JsonProperty(PropertyName = "info", DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate)]
public SwaggerInfo Info { get; set; }

/// <summary>Gets or sets the host (name or ip) serving the API.</summary>
Expand Down
2 changes: 1 addition & 1 deletion src/NSwag.Core/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="NJsonSchema" version="2.11.5963.474" targetFramework="portable45-net45+win8+wp8+wpa81" />
<package id="NJsonSchema" version="2.12.5965.33914" targetFramework="portable45-net45+win8+wp8+wpa81" />
</packages>
2 changes: 1 addition & 1 deletion src/NSwag.Demo.Client/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("2.12.*")]
// [assembly: AssemblyVersion("2.13.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
4 changes: 2 additions & 2 deletions src/NSwag.Demo.Web/NSwag.Demo.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NJsonSchema, Version=2.11.5963.474, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.2.11.5963.474\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll</HintPath>
<Reference Include="NJsonSchema, Version=2.12.5965.33914, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.2.12.5965.33914\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http" />
Expand Down
2 changes: 1 addition & 1 deletion src/NSwag.Demo.Web/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NJsonSchema" publicKeyToken="c2f9c3bdfae56102" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.11.5963.474" newVersion="2.11.5963.474" />
<bindingRedirect oldVersion="0.0.0.0-2.12.5965.33914" newVersion="2.12.5965.33914" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
2 changes: 1 addition & 1 deletion src/NSwag.Demo.Web/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net45" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="NJsonSchema" version="2.11.5963.474" targetFramework="net45" />
<package id="NJsonSchema" version="2.12.5965.33914" targetFramework="net45" />
</packages>
4 changes: 2 additions & 2 deletions src/NSwag.Tests/NSwag.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NJsonSchema, Version=2.11.5963.474, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.2.11.5963.474\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll</HintPath>
<Reference Include="NJsonSchema, Version=2.12.5965.33914, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.2.12.5965.33914\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion src/NSwag.Tests/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("2.12.*")]
// [assembly: AssemblyVersion("2.13.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
2 changes: 1 addition & 1 deletion src/NSwag.Tests/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="NJsonSchema" publicKeyToken="c2f9c3bdfae56102" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.11.5963.474" newVersion="2.11.5963.474" />
<bindingRedirect oldVersion="0.0.0.0-2.12.5965.33914" newVersion="2.12.5965.33914" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
2 changes: 1 addition & 1 deletion src/NSwag.Tests/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net452" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net452" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net452" />
<package id="NJsonSchema" version="2.11.5963.474" targetFramework="net452" />
<package id="NJsonSchema" version="2.12.5965.33914" targetFramework="net452" />
</packages>
3 changes: 1 addition & 2 deletions src/NSwag/Commands/SwaggerToCSharpCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

namespace NSwag.Commands
{
public abstract class SwaggerToCSharpCommand<TSettings>
: InputOutputCommandBase
public abstract class SwaggerToCSharpCommand<TSettings> : InputOutputCommandBase
where TSettings : SwaggerToCSharpGeneratorSettings
{
protected SwaggerToCSharpCommand(TSettings settings)
Expand Down
8 changes: 4 additions & 4 deletions src/NSwag/NSwag.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NJsonSchema, Version=2.11.5963.474, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.2.11.5963.474\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll</HintPath>
<Reference Include="NJsonSchema, Version=2.12.5965.33914, Culture=neutral, PublicKeyToken=c2f9c3bdfae56102, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.2.12.5965.33914\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NJsonSchema.CodeGeneration, Version=2.11.5963.475, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.CodeGeneration.2.11.5963.475\lib\net45\NJsonSchema.CodeGeneration.dll</HintPath>
<Reference Include="NJsonSchema.CodeGeneration, Version=2.12.5965.33915, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\NJsonSchema.CodeGeneration.2.12.5965.33915\lib\net45\NJsonSchema.CodeGeneration.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
Expand Down
2 changes: 1 addition & 1 deletion src/NSwag/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.Console")]
[assembly: AssemblyCopyright("Copyright © Rico Suter, 2015")]
[assembly: AssemblyVersion("2.12.*")]
[assembly: AssemblyVersion("2.13.*")]
4 changes: 2 additions & 2 deletions src/NSwag/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<package id="Antlr4.StringTemplate" version="4.0.6.9004" targetFramework="net452" />
<package id="NConsole" version="1.3.5963.27533" targetFramework="net46" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="NJsonSchema" version="2.11.5963.474" targetFramework="net46" />
<package id="NJsonSchema.CodeGeneration" version="2.11.5963.475" targetFramework="net46" />
<package id="NJsonSchema" version="2.12.5965.33914" targetFramework="net46" />
<package id="NJsonSchema.CodeGeneration" version="2.12.5965.33915" targetFramework="net46" />
</packages>
Loading

0 comments on commit ed10f53

Please sign in to comment.