From 9b72c24b3356a87c2da1a363a6c57a6b8fa740e2 Mon Sep 17 00:00:00 2001 From: Chebotov Nikolay Date: Thu, 16 Apr 2020 12:53:00 +0300 Subject: [PATCH] 1) Update dependencies: add support for "NSwag.Commands v13.4.0"; 2) Add feature: Add option to set "Genereated file name" on the first wizard page; 3) Disable some fields when updating. --- CHANGELOG.md | 10 + src/CodeGeneration/NSwagCodeGenDescriptor.cs | 18 +- src/Constants.cs | 1 + src/Models/ServiceConfiguration.cs | 2 + src/Models/UserSettings.cs | 4 + src/Properties/AssemblyInfo.cs | 4 +- src/Unchase.OpenAPI.ConnectedService.csproj | 44 +- .../ConfigOpenApiEndpointViewModel.cs | 3 + src/Views/CSharpClientExcludedClasses.xaml | 39 +- src/Views/CSharpClientSettings.xaml | 1256 +++++++++++------ src/Views/CSharpControllerSettings.xaml | 824 +++++++---- src/Views/ConfigOpenApiEndpoint.xaml | 42 +- src/Views/TypeScriptClientSettings.xaml | 3 +- src/Wizard.cs | 29 +- src/app.config | 2 +- src/packages.config | 22 +- src/source.extension.vsixmanifest | 2 +- 17 files changed, 1539 insertions(+), 766 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e55e07d..b29090d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,16 @@ These are the changes to each version that has been released on the official [Visual Studio extension gallery](https://marketplace.visualstudio.com/items?itemName=unchase.UnchaseOpenAPIConnectedService). +## v1.4.4 `(2020-04-16)` + +- [x] Update dependencies: add support for [NSwag.Commands v13.4.0](https://github.com/RicoSuter/NSwag/pull/2799) + - [x] [New option: define a base interface for C# client interfaces.](https://github.com/RicoSuter/NSwag/pull/2775) + - [x] [Use enums value (underlying type) rather than enum name](https://github.com/RicoSuter/NSwag/pull/2758) + - [x] Inline param refs if AllowReferencesWithProperties is set + - [x] Removed .NET Core 1.0, 1.1 and 2.0 support. +- [x] Add feature: Add option to set `Genereated file name` on the first wizard page +- [x] Disable some fields when updating + ## v1.4.3 `(2020-04-10)` - [x] Fix [issue #18](https://github.com/unchase/Unchase.OpenAPI.Connectedservice/issues/18) diff --git a/src/CodeGeneration/NSwagCodeGenDescriptor.cs b/src/CodeGeneration/NSwagCodeGenDescriptor.cs index 902cb43..8838a01 100644 --- a/src/CodeGeneration/NSwagCodeGenDescriptor.cs +++ b/src/CodeGeneration/NSwagCodeGenDescriptor.cs @@ -148,7 +148,7 @@ internal async Task GenerateCodeAsync(ConnectedServiceHandlerContext con var rootFolder = context.HandlerHelper.GetServiceArtifactsRootFolder(); var folderPath = context.ProjectHierarchy.GetProject().GetServiceFolderPath(rootFolder, serviceFolder); - var nswagFilePath = Path.Combine(folderPath, $"{serviceFolder}.nswag"); + var nswagFilePath = Path.Combine(folderPath, $"{instance.ServiceConfig.GeneratedFileName}.nswag"); var document = await NSwagDocument.LoadWithTransformationsAsync(nswagFilePath, instance.ServiceConfig.Variables); document.Runtime = instance.ServiceConfig.Runtime; @@ -246,7 +246,7 @@ internal async Task GenerateNswagFileAsync(ConnectedServiceHandlerContex var document = NSwagDocument.Create(); if (instance.ServiceConfig.GenerateCSharpClient) { - instance.ServiceConfig.OpenApiToCSharpClientCommand.OutputFilePath = $"{serviceFolder}Client.Generated.cs"; + instance.ServiceConfig.OpenApiToCSharpClientCommand.OutputFilePath = $"{instance.ServiceConfig.GeneratedFileName}.cs"; if (string.IsNullOrWhiteSpace(instance.ServiceConfig.OpenApiToCSharpClientCommand.Namespace)) { instance.ServiceConfig.OpenApiToCSharpClientCommand.Namespace = $"{nameSpace}.{serviceFolder}"; @@ -255,12 +255,16 @@ internal async Task GenerateNswagFileAsync(ConnectedServiceHandlerContex } if (instance.ServiceConfig.GenerateTypeScriptClient) { - instance.ServiceConfig.OpenApiToTypeScriptClientCommand.OutputFilePath = $"{serviceFolder}Client.Generated.ts"; + instance.ServiceConfig.OpenApiToTypeScriptClientCommand.OutputFilePath = $"{instance.ServiceConfig.GeneratedFileName}.ts"; document.CodeGenerators.OpenApiToTypeScriptClientCommand = instance.ServiceConfig.OpenApiToTypeScriptClientCommand; } if (instance.ServiceConfig.GenerateCSharpController) { - instance.ServiceConfig.OpenApiToCSharpControllerCommand.OutputFilePath = $"{serviceFolder}Controller.Generated.cs"; + instance.ServiceConfig.OpenApiToCSharpControllerCommand.OutputFilePath = + instance.ServiceConfig.GenerateCSharpClient + ? $"{instance.ServiceConfig.GeneratedFileName}Controller.cs" + : $"{instance.ServiceConfig.GeneratedFileName}.cs"; + if (string.IsNullOrWhiteSpace(instance.ServiceConfig.OpenApiToCSharpControllerCommand.Namespace)) instance.ServiceConfig.OpenApiToCSharpControllerCommand.Namespace = $"{nameSpace}.{serviceFolder}"; document.CodeGenerators.OpenApiToCSharpControllerCommand = instance.ServiceConfig.OpenApiToCSharpControllerCommand; @@ -268,7 +272,7 @@ internal async Task GenerateNswagFileAsync(ConnectedServiceHandlerContex document.SelectedSwaggerGenerator = new FromDocumentCommand { - OutputFilePath = $"{serviceFolder}.nswag.json", + OutputFilePath = $"{instance.ServiceConfig.GeneratedFileName}.nswag.json", Url = serviceUrl, Json = instance.ServiceConfig.CopySpecification ? File.ReadAllText(instance.SpecificationTempPath) : null }; @@ -276,7 +280,7 @@ internal async Task GenerateNswagFileAsync(ConnectedServiceHandlerContex var json = document.ToJson(); var tempFileName = Path.GetTempFileName(); File.WriteAllText(tempFileName, json); - var targetPath = Path.Combine(rootFolder, serviceFolder, $"{serviceFolder}.nswag"); + var targetPath = Path.Combine(rootFolder, serviceFolder, $"{instance.ServiceConfig.GeneratedFileName}.nswag"); var nswagFilePath = await context.HandlerHelper.AddFileAsync(tempFileName, targetPath); if (File.Exists(tempFileName)) File.Delete(tempFileName); @@ -291,7 +295,7 @@ internal async Task ReGenerateCSharpFileAsync(ConnectedServiceHandlerCon var rootFolder = context.HandlerHelper.GetServiceArtifactsRootFolder(); var folderPath = context.ProjectHierarchy.GetProject().GetServiceFolderPath(rootFolder, serviceFolder); - var nswagFilePath = Path.Combine(folderPath, $"{serviceFolder}.nswag"); + var nswagFilePath = Path.Combine(folderPath, $"{instance.ServiceConfig.GeneratedFileName}.nswag"); var document = await NSwagDocument.LoadWithTransformationsAsync(nswagFilePath, instance.ServiceConfig.Variables); document.Runtime = instance.ServiceConfig.Runtime; await document.ExecuteAsync(); diff --git a/src/Constants.cs b/src/Constants.cs index c1eabae..3663a0e 100644 --- a/src/Constants.cs +++ b/src/Constants.cs @@ -12,6 +12,7 @@ public static class Constants public const string NuGetOnlineRepository = "https://www.nuget.org/api/v2/"; public const string DefaultServiceName = "OpenAPIService"; + public const string DefaultGeneratedFileName = "OpenAPI"; public const string NewtonsoftJsonNuGetPackage = "Newtonsoft.Json"; public const string SystemNetHttpNuGetPackage = "System.Net.Http"; diff --git a/src/Models/ServiceConfiguration.cs b/src/Models/ServiceConfiguration.cs index 8c39baf..42961d9 100644 --- a/src/Models/ServiceConfiguration.cs +++ b/src/Models/ServiceConfiguration.cs @@ -8,6 +8,8 @@ internal class ServiceConfiguration #region Properties public string ServiceName { get; set; } + public string GeneratedFileName { get; set; } + public string Endpoint { get; set; } public string GeneratedFileNamePrefix { get; set; } diff --git a/src/Models/UserSettings.cs b/src/Models/UserSettings.cs index f68158a..bf45e2b 100644 --- a/src/Models/UserSettings.cs +++ b/src/Models/UserSettings.cs @@ -46,6 +46,9 @@ internal class UserSettings [DataMember] public string ServiceName { get; set; } + [DataMember] + public string GeneratedFileName { get; set; } + [DataMember] public bool OpenGeneratedFilesOnComplete { get; set; } = false; @@ -77,6 +80,7 @@ internal void SetFromServiceConfiguration(ServiceConfiguration serviceConfigurat this.OpenGeneratedFilesOnComplete = serviceConfiguration.OpenGeneratedFilesOnComplete; this.Runtime = serviceConfiguration.Runtime; this.ServiceName = serviceConfiguration.ServiceName; + this.GeneratedFileName = serviceConfiguration.GeneratedFileName; this.UseRelativePath = serviceConfiguration.UseRelativePath; this.Variables = serviceConfiguration.Variables; } diff --git a/src/Properties/AssemblyInfo.cs b/src/Properties/AssemblyInfo.cs index e12a715..02c0d8a 100644 --- a/src/Properties/AssemblyInfo.cs +++ b/src/Properties/AssemblyInfo.cs @@ -30,7 +30,7 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.2.*")] -[assembly: AssemblyVersion("1.4.3")] -[assembly: AssemblyFileVersion("1.4.3.0")] +[assembly: AssemblyVersion("1.4.4")] +[assembly: AssemblyFileVersion("1.4.4.0")] [assembly: NeutralResourcesLanguage("en-US")] diff --git a/src/Unchase.OpenAPI.ConnectedService.csproj b/src/Unchase.OpenAPI.ConnectedService.csproj index 81c73a6..b7736ab 100644 --- a/src/Unchase.OpenAPI.ConnectedService.csproj +++ b/src/Unchase.OpenAPI.ConnectedService.csproj @@ -462,38 +462,38 @@ packages\NJsonSchema.Yaml.10.1.11\lib\net45\NJsonSchema.Yaml.dll - - packages\NSwag.Annotations.13.3.0\lib\net45\NSwag.Annotations.dll + + packages\NSwag.Annotations.13.4.0\lib\net45\NSwag.Annotations.dll - - packages\NSwag.AssemblyLoader.13.3.0\lib\net451\NSwag.AssemblyLoader.dll + + packages\NSwag.AssemblyLoader.13.4.0\lib\net451\NSwag.AssemblyLoader.dll - - packages\NSwag.CodeGeneration.13.3.0\lib\net451\NSwag.CodeGeneration.dll + + packages\NSwag.CodeGeneration.13.4.0\lib\net451\NSwag.CodeGeneration.dll - - packages\NSwag.CodeGeneration.CSharp.13.3.0\lib\net451\NSwag.CodeGeneration.CSharp.dll + + packages\NSwag.CodeGeneration.CSharp.13.4.0\lib\net451\NSwag.CodeGeneration.CSharp.dll - - packages\NSwag.CodeGeneration.TypeScript.13.3.0\lib\net451\NSwag.CodeGeneration.TypeScript.dll + + packages\NSwag.CodeGeneration.TypeScript.13.4.0\lib\net451\NSwag.CodeGeneration.TypeScript.dll - - packages\NSwag.Commands.13.3.0\lib\net461\NSwag.Commands.dll + + packages\NSwag.Commands.13.4.0\lib\net461\NSwag.Commands.dll - - packages\NSwag.Core.13.3.0\lib\net45\NSwag.Core.dll + + packages\NSwag.Core.13.4.0\lib\net45\NSwag.Core.dll - - packages\NSwag.Core.Yaml.13.3.0\lib\net45\NSwag.Core.Yaml.dll + + packages\NSwag.Core.Yaml.13.4.0\lib\net45\NSwag.Core.Yaml.dll - - packages\NSwag.Generation.13.3.0\lib\net45\NSwag.Generation.dll + + packages\NSwag.Generation.13.4.0\lib\net45\NSwag.Generation.dll - - packages\NSwag.Generation.AspNetCore.13.3.0\lib\net451\NSwag.Generation.AspNetCore.dll + + packages\NSwag.Generation.AspNetCore.13.4.0\lib\net451\NSwag.Generation.AspNetCore.dll - - packages\NSwag.Generation.WebApi.13.3.0\lib\net45\NSwag.Generation.WebApi.dll + + packages\NSwag.Generation.WebApi.13.4.0\lib\net45\NSwag.Generation.WebApi.dll packages\NSwag.SwaggerGeneration.12.3.1\lib\net45\NSwag.SwaggerGeneration.dll diff --git a/src/ViewModels/ConfigOpenApiEndpointViewModel.cs b/src/ViewModels/ConfigOpenApiEndpointViewModel.cs index e99e4b6..6ce4c42 100644 --- a/src/ViewModels/ConfigOpenApiEndpointViewModel.cs +++ b/src/ViewModels/ConfigOpenApiEndpointViewModel.cs @@ -21,6 +21,8 @@ internal class ConfigOpenApiEndpointViewModel : ConnectedServiceWizardPage public string ServiceName { get; set; } + public string GeneratedFileName { get; set; } + public string SpecificationTempPath { get; set; } public UserSettings UserSettings { get; } @@ -66,6 +68,7 @@ public ConfigOpenApiEndpointViewModel(UserSettings userSettings, Wizard wizard) this.View = new ConfigOpenApiEndpoint(this.InternalWizard) {DataContext = this}; this.UserSettings = userSettings; this.ServiceName = string.IsNullOrWhiteSpace(userSettings.ServiceName) ? Constants.DefaultServiceName : userSettings.ServiceName; + this.GeneratedFileName = string.IsNullOrWhiteSpace(userSettings.GeneratedFileName) ? Constants.DefaultGeneratedFileName : userSettings.GeneratedFileName; this.Endpoint = userSettings.Endpoint; this.UseNetworkCredentials = false; this.UseWebProxy = false; diff --git a/src/Views/CSharpClientExcludedClasses.xaml b/src/Views/CSharpClientExcludedClasses.xaml index 409c7d8..3b2782b 100644 --- a/src/Views/CSharpClientExcludedClasses.xaml +++ b/src/Views/CSharpClientExcludedClasses.xaml @@ -1,18 +1,20 @@ - + - + - diff --git a/src/Views/CSharpClientSettings.xaml b/src/Views/CSharpClientSettings.xaml index 3d3a9a0..01551f4 100644 --- a/src/Views/CSharpClientSettings.xaml +++ b/src/Views/CSharpClientSettings.xaml @@ -1,522 +1,918 @@ - + - - + + - + You can use default settings to generate client code file or click on hyperlinks to choose custom settings : - - Main Settings ( - ) - - - - - - - - - - - - - - + + Main Settings + ( + + + ) + + + + + + + + + + + + + - - - - + + + + - - Client ( - - ) - - - - - + + Client + ( + + + ) + + + - + - The {controller} placeholder of the Class Name is replaced by generated client name (depends on the OperationGenerationMode strategy). - - - - - - - - - - - - - - - - - + The {controller} placeholder of the Class Name is replaced by generated client name (depends on the OperationGenerationMode strategy). + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - Base Class and Configuration Class ( - - ) - + + + + + + + + + + + + + + Base Class and Configuration Class ( + + + ) - - - - - + + + + + - + - - - + + + - - Response wrapping ( - - ) - + + Response wrapping ( + + + ) - - - - - - - - - + + + + + + + + + - - + + - - Parameter types ( - - ) - + + Parameter types ( + + + ) - - - - - + + + + + - - Response types ( - - ) - + + Response types ( + + + ) - - - - - + + + + + - - DTO classes ( - - ) - - - - + + DTO classes + ( + + + ) + + + - - + + - - - - - - - + + + + + + + - + - + - + - + - + - + - + - + - + - - - - - Serialization ( - - ) - + + + + + Serialization ( + + + ) - + - - - - - - - + + + + + + + - - Primitive Types ( - - ) - + + Primitive Types ( + + + ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - Swagger Information ( - - ) - - - - - - - + + Swagger Information + ( + + + ) + + + + + + - - Templating ( - - ) - - - - + + Templating + ( + + + ) + + + diff --git a/src/Views/CSharpControllerSettings.xaml b/src/Views/CSharpControllerSettings.xaml index ba8f6bd..17954a3 100644 --- a/src/Views/CSharpControllerSettings.xaml +++ b/src/Views/CSharpControllerSettings.xaml @@ -1,330 +1,634 @@ - + - - + + - + You can use default settings to generate client code file or click on hyperlinks to choose custom settings : - - Main Settings ( - ) - - - - - - - + + Main Settings + ( + + + ) + + + + + + - - Controller ( - - ) - - - - - - - - - - - - - - - - - - + + Controller + ( + + + ) + + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - + + + + - - + + - - Web API Controller ( - - ) - - - - - - - - - - - - - + + Web API Controller + ( + + + ) + + + + + + + + + + + + - The {controller} placeholder of the Class Name is replaced by generated client name (depends on the OperationGenerationMode strategy). - - + The {controller} placeholder of the Class Name is replaced by generated client name (depends on the OperationGenerationMode strategy). + - - Parameter Types ( - - ) - - - - - - - + + Parameter Types + ( + + + ) + + + + + + - - Response Types ( - - ) - - - - - - - + + Response Types + ( + + + ) + + + + + + - - DTO classes ( - - ) - - - - + + DTO classes + ( + + + ) + + + - - - - - - - - + + + + + + + + - + - + - + - + - + - + - + - + - + - - - - - Serialization ( - - ) - + + + + + Serialization ( + + + ) - + - - - - - - - + + + + + + + - - Primitive Types ( - - ) - + + Primitive Types ( + + + ) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - Templating ( - - ) - - - - + + Templating + ( + + + ) + + + diff --git a/src/Views/ConfigOpenApiEndpoint.xaml b/src/Views/ConfigOpenApiEndpoint.xaml index 3daa9a8..3e408dd 100644 --- a/src/Views/ConfigOpenApiEndpoint.xaml +++ b/src/Views/ConfigOpenApiEndpoint.xaml @@ -8,7 +8,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:viewModels="clr-namespace:Unchase.OpenAPI.ConnectedService.ViewModels" d:DataContext="{d:DesignInstance Type=viewModels:ConfigOpenApiEndpointViewModel}" - d:DesignHeight="400" + d:DesignHeight="420" d:DesignWidth="768" mc:Ignorable="d"> @@ -95,6 +95,18 @@ HorizontalAlignment="Stretch" Text="{Binding Path=UserSettings.ServiceName, Mode=TwoWay}" /> + + + - - + - - + + + Text="will combine with :" + TextWrapping="WrapWithOverflow" /> diff --git a/src/Views/TypeScriptClientSettings.xaml b/src/Views/TypeScriptClientSettings.xaml index 3b51fb5..645d45e 100644 --- a/src/Views/TypeScriptClientSettings.xaml +++ b/src/Views/TypeScriptClientSettings.xaml @@ -7,7 +7,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:viewModels="clr-namespace:Unchase.OpenAPI.ConnectedService.ViewModels" - d:DesignHeight="400" + d:DesignHeight="420" d:DesignWidth="768" mc:Ignorable="d"> @@ -63,6 +63,7 @@ Text="Namespace (empty for no namespace declaration) :" TextWrapping="WrapWithOverflow" /> diff --git a/src/Wizard.cs b/src/Wizard.cs index bbd29aa..6f6f478 100644 --- a/src/Wizard.cs +++ b/src/Wizard.cs @@ -61,6 +61,7 @@ public Wizard(ConnectedServiceProviderContext context) var serviceConfig = this.Context.GetExtendedDesignerData(); ConfigOpenApiEndpointViewModel.Endpoint = serviceConfig.Endpoint; ConfigOpenApiEndpointViewModel.ServiceName = serviceConfig.ServiceName; + ConfigOpenApiEndpointViewModel.GeneratedFileName = serviceConfig.GeneratedFileName; ConfigOpenApiEndpointViewModel.UseWebProxy = serviceConfig.UseWebProxy; ConfigOpenApiEndpointViewModel.NetworkCredentialsDomain = serviceConfig.NetworkCredentialsDomain; ConfigOpenApiEndpointViewModel.NetworkCredentialsUserName = serviceConfig.NetworkCredentialsUserName; @@ -74,17 +75,38 @@ public Wizard(ConnectedServiceProviderContext context) "An OpenAPI (Swagger) specification endpoint and generation options was regenerated"; if (ConfigOpenApiEndpointViewModel.View is ConfigOpenApiEndpoint сonfigOpenApiEndpoint) { - //сonfigOpenApiEndpoint.Endpoint.IsEnabled = false; - //сonfigOpenApiEndpoint.ServiceName.IsEnabled = false; + сonfigOpenApiEndpoint.Endpoint.IsEnabled = false; + сonfigOpenApiEndpoint.ServiceName.IsEnabled = false; + сonfigOpenApiEndpoint.GeneratedFileName.IsEnabled = false; + сonfigOpenApiEndpoint.OpenEndpointFileButton.IsEnabled = false; + сonfigOpenApiEndpoint.GenerateCSharpClient.IsEnabled = false; + сonfigOpenApiEndpoint.GenerateTypeScriptClient.IsEnabled = false; + сonfigOpenApiEndpoint.GenerateCSharpController.IsEnabled = false; } CSharpClientSettingsViewModel.Command = serviceConfig.OpenApiToCSharpClientCommand; CSharpClientSettingsViewModel.ExcludeTypeNamesLater = serviceConfig.ExcludeTypeNamesLater; CSharpClientSettingsViewModel.Description = "Settings for generating CSharp client (regenerated)"; + if (CSharpClientSettingsViewModel.View is CSharpClientSettings cSharpClientSettings) + { + cSharpClientSettings.Namespace.IsEnabled = false; + cSharpClientSettings.AdditionalNamespaceUsages.IsEnabled = false; + } + TypeScriptClientSettingsViewModel.Command = serviceConfig.OpenApiToTypeScriptClientCommand; TypeScriptClientSettingsViewModel.Description = "Settings for generating TypeScript client (regenerated)"; + if (TypeScriptClientSettingsViewModel.View is TypeScriptClientSettings typeScriptClientSettings) + { + typeScriptClientSettings.Namespace.IsEnabled = false; + } + CSharpControllerSettingsViewModel.Command = serviceConfig.OpenApiToCSharpControllerCommand; CSharpControllerSettingsViewModel.Description = "Settings for generating CSharp controller (regenerated)"; + if (CSharpControllerSettingsViewModel.View is CSharpControllerSettings cSharpControllerSettings) + { + cSharpControllerSettings.Namespace.IsEnabled = false; + cSharpControllerSettings.AdditionalNamespaceUsages.IsEnabled = false; + } } this.Pages.Add(ConfigOpenApiEndpointViewModel); @@ -175,6 +197,7 @@ private ServiceConfiguration CreateServiceConfiguration() var serviceConfiguration = new ServiceConfiguration { ServiceName = string.IsNullOrWhiteSpace(ConfigOpenApiEndpointViewModel.UserSettings.ServiceName) ? Constants.DefaultServiceName : ConfigOpenApiEndpointViewModel.UserSettings.ServiceName, + GeneratedFileName = string.IsNullOrWhiteSpace(ConfigOpenApiEndpointViewModel.UserSettings.GeneratedFileName) ? Constants.DefaultGeneratedFileName : ConfigOpenApiEndpointViewModel.UserSettings.GeneratedFileName, Endpoint = GetEndpointPath(ConfigOpenApiEndpointViewModel.UserSettings.Endpoint, ConfigOpenApiEndpointViewModel.UserSettings.UseRelativePath), GeneratedFileNamePrefix = CSharpClientSettingsViewModel.GeneratedFileName, GenerateCSharpClient = ConfigOpenApiEndpointViewModel.UserSettings.GenerateCSharpClient, @@ -207,7 +230,7 @@ private ServiceConfiguration CreateServiceConfiguration() /// Endpoint path (relative or avsolute). internal string GetEndpointPath(string endpoint, bool useRelativePath = false) { - if (endpoint.StartsWith("http://", StringComparison.Ordinal) + if (endpoint.StartsWith("http://", StringComparison.Ordinal) || endpoint.StartsWith("https://", StringComparison.Ordinal) || File.Exists(endpoint) || !useRelativePath) diff --git a/src/app.config b/src/app.config index f7ade25..2906a94 100644 --- a/src/app.config +++ b/src/app.config @@ -88,7 +88,7 @@ - + diff --git a/src/packages.config b/src/packages.config index cdd15c6..797ae06 100644 --- a/src/packages.config +++ b/src/packages.config @@ -111,17 +111,17 @@ - - - - - - - - - - - + + + + + + + + + + + diff --git a/src/source.extension.vsixmanifest b/src/source.extension.vsixmanifest index 818fc1d..5997623 100644 --- a/src/source.extension.vsixmanifest +++ b/src/source.extension.vsixmanifest @@ -1,7 +1,7 @@  - + Unchase OpenAPI (Swagger) Connected Service Connected service for Visual Studio to generate OpenAPI (Swagger) web service reference. https://github.com/unchase/Unchase.OpenAPI.Connectedservice