diff --git a/src/NSwag.Annotations/Properties/AssemblyInfo.cs b/src/NSwag.Annotations/Properties/AssemblyInfo.cs index 3424e2a180..4ac89caf7a 100644 --- a/src/NSwag.Annotations/Properties/AssemblyInfo.cs +++ b/src/NSwag.Annotations/Properties/AssemblyInfo.cs @@ -5,4 +5,4 @@ [assembly: AssemblyCompany("Rico Suter")] [assembly: AssemblyProduct("NSwag.Annotations")] [assembly: AssemblyCopyright("Copyright © Rico Suter, 2015")] -[assembly: AssemblyVersion("2.8.*")] +[assembly: AssemblyVersion("2.9.*")] diff --git a/src/NSwag.CodeGeneration.Tests/NSwag.CodeGeneration.Tests.csproj b/src/NSwag.CodeGeneration.Tests/NSwag.CodeGeneration.Tests.csproj index 7b6213442b..29b53a02d5 100644 --- a/src/NSwag.CodeGeneration.Tests/NSwag.CodeGeneration.Tests.csproj +++ b/src/NSwag.CodeGeneration.Tests/NSwag.CodeGeneration.Tests.csproj @@ -43,12 +43,12 @@ ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll True - - ..\packages\NJsonSchema.2.7.5954.13235\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll + + ..\packages\NJsonSchema.2.9.5956.34078\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll True - - ..\packages\NJsonSchema.CodeGeneration.2.7.5954.13236\lib\net45\NJsonSchema.CodeGeneration.dll + + ..\packages\NJsonSchema.CodeGeneration.2.9.5956.34079\lib\net45\NJsonSchema.CodeGeneration.dll True diff --git a/src/NSwag.CodeGeneration.Tests/Properties/AssemblyInfo.cs b/src/NSwag.CodeGeneration.Tests/Properties/AssemblyInfo.cs index 11002e6e40..49666bc458 100644 --- a/src/NSwag.CodeGeneration.Tests/Properties/AssemblyInfo.cs +++ b/src/NSwag.CodeGeneration.Tests/Properties/AssemblyInfo.cs @@ -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.8.*")] +// [assembly: AssemblyVersion("2.9.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/NSwag.CodeGeneration.Tests/packages.config b/src/NSwag.CodeGeneration.Tests/packages.config index cd60ea2eb1..a14553bfdb 100644 --- a/src/NSwag.CodeGeneration.Tests/packages.config +++ b/src/NSwag.CodeGeneration.Tests/packages.config @@ -4,6 +4,6 @@ - - + + \ No newline at end of file diff --git a/src/NSwag.CodeGeneration/CodeGenerators/TypeScript/SwaggerToTypeScriptClientGenerator.cs b/src/NSwag.CodeGeneration/CodeGenerators/TypeScript/SwaggerToTypeScriptClientGenerator.cs index 557e8b38cf..76a62c67ea 100644 --- a/src/NSwag.CodeGeneration/CodeGenerators/TypeScript/SwaggerToTypeScriptClientGenerator.cs +++ b/src/NSwag.CodeGeneration/CodeGenerators/TypeScript/SwaggerToTypeScriptClientGenerator.cs @@ -37,7 +37,7 @@ public SwaggerToTypeScriptClientGenerator(SwaggerService service, SwaggerToTypeS foreach (var definition in _service.Definitions) definition.Value.TypeName = definition.Key; - _resolver = new TypeScriptTypeResolver(_service.Definitions.Select(p => p.Value).ToArray()); + _resolver = new TypeScriptTypeResolver(_service.Definitions.Select(p => p.Value).ToArray(), Settings.TypeScriptGeneratorSettings); } /// Gets or sets the generator settings. diff --git a/src/NSwag.CodeGeneration/CodeGenerators/TypeScript/SwaggerToTypeScriptClientGeneratorSettings.cs b/src/NSwag.CodeGeneration/CodeGenerators/TypeScript/SwaggerToTypeScriptClientGeneratorSettings.cs index 0a284d022b..6b6a383997 100644 --- a/src/NSwag.CodeGeneration/CodeGenerators/TypeScript/SwaggerToTypeScriptClientGeneratorSettings.cs +++ b/src/NSwag.CodeGeneration/CodeGenerators/TypeScript/SwaggerToTypeScriptClientGeneratorSettings.cs @@ -6,6 +6,8 @@ // Rico Suter, mail@rsuter.com //----------------------------------------------------------------------- +using NJsonSchema.CodeGeneration.TypeScript; + namespace NSwag.CodeGeneration.CodeGenerators.TypeScript { /// Settings for the . @@ -18,8 +20,12 @@ public SwaggerToTypeScriptClientGeneratorSettings() ClassName = "{controller}Client"; Template = TypeScriptTemplate.JQueryCallbacks; PromiseType = PromiseType.Promise; + TypeScriptGeneratorSettings = new TypeScriptGeneratorSettings(); } + /// Gets or sets the TypeScript generator settings. + public TypeScriptGeneratorSettings TypeScriptGeneratorSettings { get; set; } + /// Gets or sets the class name of the service client. public string ClassName { get; set; } diff --git a/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj b/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj index 07bc9b7284..47b8abfa27 100644 --- a/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj +++ b/src/NSwag.CodeGeneration/NSwag.CodeGeneration.csproj @@ -41,12 +41,12 @@ ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll True - - ..\packages\NJsonSchema.2.7.5954.13235\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll + + ..\packages\NJsonSchema.2.9.5956.34078\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll True - - ..\packages\NJsonSchema.CodeGeneration.2.7.5954.13236\lib\net45\NJsonSchema.CodeGeneration.dll + + ..\packages\NJsonSchema.CodeGeneration.2.9.5956.34079\lib\net45\NJsonSchema.CodeGeneration.dll True diff --git a/src/NSwag.CodeGeneration/Properties/AssemblyInfo.cs b/src/NSwag.CodeGeneration/Properties/AssemblyInfo.cs index b734f2ae6e..7484f0f83d 100644 --- a/src/NSwag.CodeGeneration/Properties/AssemblyInfo.cs +++ b/src/NSwag.CodeGeneration/Properties/AssemblyInfo.cs @@ -5,4 +5,4 @@ [assembly: AssemblyCompany("Rico Suter")] [assembly: AssemblyProduct("NSwag.CodeGeneration")] [assembly: AssemblyCopyright("Copyright © Rico Suter, 2015")] -[assembly: AssemblyVersion("2.8.*")] +[assembly: AssemblyVersion("2.9.*")] diff --git a/src/NSwag.CodeGeneration/packages.config b/src/NSwag.CodeGeneration/packages.config index 7f92b6653f..00c1c94f0b 100644 --- a/src/NSwag.CodeGeneration/packages.config +++ b/src/NSwag.CodeGeneration/packages.config @@ -2,6 +2,6 @@ - - + + \ No newline at end of file diff --git a/src/NSwag.Core/NSwag.Core.csproj b/src/NSwag.Core/NSwag.Core.csproj index 8353165651..a345488c16 100644 --- a/src/NSwag.Core/NSwag.Core.csproj +++ b/src/NSwag.Core/NSwag.Core.csproj @@ -46,8 +46,8 @@ ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll True - - ..\packages\NJsonSchema.2.7.5954.13235\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll + + ..\packages\NJsonSchema.2.9.5956.34078\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll True diff --git a/src/NSwag.Core/Properties/AssemblyInfo.cs b/src/NSwag.Core/Properties/AssemblyInfo.cs index 73961d2515..765a7d8d29 100644 --- a/src/NSwag.Core/Properties/AssemblyInfo.cs +++ b/src/NSwag.Core/Properties/AssemblyInfo.cs @@ -5,4 +5,4 @@ [assembly: AssemblyCompany("Rico Suter")] [assembly: AssemblyProduct("NSwag")] [assembly: AssemblyCopyright("Copyright © Rico Suter, 2015")] -[assembly: AssemblyVersion("2.8.*")] +[assembly: AssemblyVersion("2.9.*")] diff --git a/src/NSwag.Core/packages.config b/src/NSwag.Core/packages.config index eb0f3927d6..6b459ee62a 100644 --- a/src/NSwag.Core/packages.config +++ b/src/NSwag.Core/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/NSwag.Demo.Client/Properties/AssemblyInfo.cs b/src/NSwag.Demo.Client/Properties/AssemblyInfo.cs index e85d07c5aa..7aa8454fc0 100644 --- a/src/NSwag.Demo.Client/Properties/AssemblyInfo.cs +++ b/src/NSwag.Demo.Client/Properties/AssemblyInfo.cs @@ -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.8.*")] +// [assembly: AssemblyVersion("2.9.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/NSwag.Demo.Web/Models/Car.cs b/src/NSwag.Demo.Web/Models/Car.cs index e22994d419..dc81297bd3 100644 --- a/src/NSwag.Demo.Web/Models/Car.cs +++ b/src/NSwag.Demo.Web/Models/Car.cs @@ -8,6 +8,7 @@ public class Car { public string Name { get; set; } + [ReadOnly(true)] public Person Driver { get; set; } [JsonConverter(typeof(StringEnumConverter))] diff --git a/src/NSwag.Demo.Web/NSwag.Demo.Web.csproj b/src/NSwag.Demo.Web/NSwag.Demo.Web.csproj index 4cab1b18ee..d98cf84143 100644 --- a/src/NSwag.Demo.Web/NSwag.Demo.Web.csproj +++ b/src/NSwag.Demo.Web/NSwag.Demo.Web.csproj @@ -47,8 +47,8 @@ ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll True - - ..\packages\NJsonSchema.2.7.5954.13235\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll + + ..\packages\NJsonSchema.2.9.5956.34078\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll True diff --git a/src/NSwag.Demo.Web/Swagger.nswag b/src/NSwag.Demo.Web/Swagger.nswag index 6ed5f67ab4..b6bf7af2b8 100644 --- a/src/NSwag.Demo.Web/Swagger.nswag +++ b/src/NSwag.Demo.Web/Swagger.nswag @@ -29,10 +29,11 @@ "ModuleName": "", "Template": 0, "PromiseType": 0, - "GenerateClientClasses": true, + "GenerateClientClasses": false, "GenerateClientInterfaces": true, "GenerateDtoTypes": true, "OperationGenerationMode": 0, + "GenerateReadOnlyKeywords": false, "Input": null, "OutputFilePath": null }, diff --git a/src/NSwag.Demo.Web/Web.config b/src/NSwag.Demo.Web/Web.config index d0920c4bd1..5f8ffe0574 100644 --- a/src/NSwag.Demo.Web/Web.config +++ b/src/NSwag.Demo.Web/Web.config @@ -58,7 +58,7 @@ - + diff --git a/src/NSwag.Demo.Web/packages.config b/src/NSwag.Demo.Web/packages.config index 97dd2dbb61..12beb1fa3e 100644 --- a/src/NSwag.Demo.Web/packages.config +++ b/src/NSwag.Demo.Web/packages.config @@ -7,5 +7,5 @@ - + \ No newline at end of file diff --git a/src/NSwag.Tests/NSwag.Tests.csproj b/src/NSwag.Tests/NSwag.Tests.csproj index 015ec699cc..d4e54729d3 100644 --- a/src/NSwag.Tests/NSwag.Tests.csproj +++ b/src/NSwag.Tests/NSwag.Tests.csproj @@ -39,8 +39,8 @@ ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll True - - ..\packages\NJsonSchema.2.7.5954.13235\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll + + ..\packages\NJsonSchema.2.9.5956.34078\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll True diff --git a/src/NSwag.Tests/Properties/AssemblyInfo.cs b/src/NSwag.Tests/Properties/AssemblyInfo.cs index 5dc1113c7b..b154d3e08a 100644 --- a/src/NSwag.Tests/Properties/AssemblyInfo.cs +++ b/src/NSwag.Tests/Properties/AssemblyInfo.cs @@ -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.8.*")] +// [assembly: AssemblyVersion("2.9.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/NSwag.Tests/app.config b/src/NSwag.Tests/app.config index c4aff804e0..529efa4fd0 100644 --- a/src/NSwag.Tests/app.config +++ b/src/NSwag.Tests/app.config @@ -8,7 +8,7 @@ - + diff --git a/src/NSwag.Tests/packages.config b/src/NSwag.Tests/packages.config index e4ee3f5efb..8cbc8658d4 100644 --- a/src/NSwag.Tests/packages.config +++ b/src/NSwag.Tests/packages.config @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/src/NSwag/Commands/SwaggerToTypeScriptCommand.cs b/src/NSwag/Commands/SwaggerToTypeScriptCommand.cs index 7580edebdd..41228a480e 100644 --- a/src/NSwag/Commands/SwaggerToTypeScriptCommand.cs +++ b/src/NSwag/Commands/SwaggerToTypeScriptCommand.cs @@ -83,6 +83,14 @@ public OperationGenerationMode OperationGenerationMode set { Settings.OperationGenerationMode = value; } } + [Description("Specifies whether to generate readonly keywords (only available in TS 2.0+, default: true).")] + [Argument(Name = "GenerateReadOnlyKeywords", DefaultValue = true)] + public bool GenerateReadOnlyKeywords + { + get { return Settings.TypeScriptGeneratorSettings.GenerateReadOnlyKeywords; } + set { Settings.TypeScriptGeneratorSettings.GenerateReadOnlyKeywords = value; } + } + public override async Task RunAsync(CommandLineProcessor processor, IConsoleHost host) { var output = await RunAsync(); diff --git a/src/NSwag/NSwag.csproj b/src/NSwag/NSwag.csproj index d8c94c308a..c8098ba2b5 100644 --- a/src/NSwag/NSwag.csproj +++ b/src/NSwag/NSwag.csproj @@ -46,12 +46,12 @@ ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll True - - ..\packages\NJsonSchema.2.7.5954.13235\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll + + ..\packages\NJsonSchema.2.9.5956.34078\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll True - - ..\packages\NJsonSchema.CodeGeneration.2.7.5954.13236\lib\net45\NJsonSchema.CodeGeneration.dll + + ..\packages\NJsonSchema.CodeGeneration.2.9.5956.34079\lib\net45\NJsonSchema.CodeGeneration.dll True diff --git a/src/NSwag/Properties/AssemblyInfo.cs b/src/NSwag/Properties/AssemblyInfo.cs index ef2d9b9b63..3c89328b9a 100644 --- a/src/NSwag/Properties/AssemblyInfo.cs +++ b/src/NSwag/Properties/AssemblyInfo.cs @@ -5,4 +5,4 @@ [assembly: AssemblyCompany("Rico Suter")] [assembly: AssemblyProduct("NSwag.Console")] [assembly: AssemblyCopyright("Copyright © Rico Suter, 2015")] -[assembly: AssemblyVersion("2.8.*")] +[assembly: AssemblyVersion("2.9.*")] diff --git a/src/NSwag/packages.config b/src/NSwag/packages.config index 3d20ed66d5..06a4bbf476 100644 --- a/src/NSwag/packages.config +++ b/src/NSwag/packages.config @@ -3,6 +3,6 @@ - - + + \ No newline at end of file diff --git a/src/NSwagStudio.Installer/Generated.wxs b/src/NSwagStudio.Installer/Generated.wxs index ad5a2ae977..528c3699d2 100644 --- a/src/NSwagStudio.Installer/Generated.wxs +++ b/src/NSwagStudio.Installer/Generated.wxs @@ -522,60 +522,76 @@ - - + + - + - - + + - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -584,231 +600,231 @@ - + + + + - + - - - - - - - + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -817,516 +833,528 @@ - - - - - - - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - + - - - - + - - + + - - + + + + + - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + - - + + - - + + - + - + - - + + - - + + - + - - - - - + + - + - + + + + - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/NSwagStudio/NSwagStudio.csproj b/src/NSwagStudio/NSwagStudio.csproj index 03844c41af..4369ea7f94 100644 --- a/src/NSwagStudio/NSwagStudio.csproj +++ b/src/NSwagStudio/NSwagStudio.csproj @@ -74,12 +74,12 @@ ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll True - - ..\packages\NJsonSchema.2.7.5954.13235\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll + + ..\packages\NJsonSchema.2.9.5956.34078\lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\NJsonSchema.dll True - - ..\packages\NJsonSchema.CodeGeneration.2.7.5954.13236\lib\net45\NJsonSchema.CodeGeneration.dll + + ..\packages\NJsonSchema.CodeGeneration.2.9.5956.34079\lib\net45\NJsonSchema.CodeGeneration.dll True diff --git a/src/NSwagStudio/Properties/AssemblyInfo.cs b/src/NSwagStudio/Properties/AssemblyInfo.cs index 1070604d97..e26174714a 100644 --- a/src/NSwagStudio/Properties/AssemblyInfo.cs +++ b/src/NSwagStudio/Properties/AssemblyInfo.cs @@ -5,4 +5,4 @@ [assembly: AssemblyCompany("Rico Suter")] [assembly: AssemblyProduct("NSwagStudio")] [assembly: AssemblyCopyright("Copyright © Rico Suter, 2015")] -[assembly: AssemblyVersion("2.8.*")] +[assembly: AssemblyVersion("2.9.*")] diff --git a/src/NSwagStudio/Views/CodeGenerators/TypeScriptClientGeneratorView.xaml b/src/NSwagStudio/Views/CodeGenerators/TypeScriptClientGeneratorView.xaml index 3f67c1c210..22ad35c3a0 100644 --- a/src/NSwagStudio/Views/CodeGenerators/TypeScriptClientGeneratorView.xaml +++ b/src/NSwagStudio/Views/CodeGenerators/TypeScriptClientGeneratorView.xaml @@ -38,6 +38,10 @@ + + - - + + \ No newline at end of file