diff --git a/src/Aliencube.AzureFunctions.Extensions.OpenApi.CLI/Program.cs b/src/Aliencube.AzureFunctions.Extensions.OpenApi.CLI/Program.cs index 97d3979..cf51bb8 100644 --- a/src/Aliencube.AzureFunctions.Extensions.OpenApi.CLI/Program.cs +++ b/src/Aliencube.AzureFunctions.Extensions.OpenApi.CLI/Program.cs @@ -80,7 +80,10 @@ public void Generate( var helper = new DocumentHelper(filter); var document = new Document(helper); - var swagger = document.InitialiseDocument() + var swagger = default(string); + try + { + swagger = document.InitialiseDocument() .AddMetadata(pi.OpenApiInfo) #if NET461 .AddServer(req, pi.HostJsonHttpSettings.RoutePrefix) @@ -90,6 +93,15 @@ public void Generate( .Build(assembly) .RenderAsync(version.ToOpenApiSpecVersion(), format.ToOpenApiFormat()) .Result; + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + Console.WriteLine(ex.StackTrace); +#if NET461 + req.Dispose(); +#endif + } #if NET461 req.Dispose(); #endif diff --git a/src/Aliencube.AzureFunctions.Extensions.OpenApi.CLI/ProjectInfo.cs b/src/Aliencube.AzureFunctions.Extensions.OpenApi.CLI/ProjectInfo.cs index fe03523..c7ba376 100644 --- a/src/Aliencube.AzureFunctions.Extensions.OpenApi.CLI/ProjectInfo.cs +++ b/src/Aliencube.AzureFunctions.Extensions.OpenApi.CLI/ProjectInfo.cs @@ -253,7 +253,7 @@ private void SetOpenApiInfo() this.OpenApiSettingsJsonPath.ThrowIfNullOrWhiteSpace(); this.LocalSettingsJsonPath.ThrowIfNullOrWhiteSpace(); - var openApiInfo = this.HostSettings.Get("openApi"); + var openApiInfo = this.HostSettings.Get("openApi:info"); if (this.IsValidOpenApiInfo(openApiInfo)) { this.OpenApiInfo = openApiInfo; @@ -264,7 +264,7 @@ private void SetOpenApiInfo() if (File.Exists(this.OpenApiSettingsJsonPath)) { var openapiSettings = File.ReadAllText(this.OpenApiSettingsJsonPath, Encoding.UTF8); - openApiInfo = JsonConvert.DeserializeObject(openapiSettings); + openApiInfo = JsonConvert.DeserializeObject(openapiSettings).Info; if (this.IsValidOpenApiInfo(openApiInfo)) { this.OpenApiInfo = openApiInfo;