File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
src/Aliencube.AzureFunctions.Extensions.OpenApi.CLI Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -80,7 +80,10 @@ public void Generate(
8080 var helper = new DocumentHelper ( filter ) ;
8181 var document = new Document ( helper ) ;
8282
83- var swagger = document . InitialiseDocument ( )
83+ var swagger = default ( string ) ;
84+ try
85+ {
86+ swagger = document . InitialiseDocument ( )
8487 . AddMetadata ( pi . OpenApiInfo )
8588#if NET461
8689 . AddServer ( req , pi . HostJsonHttpSettings . RoutePrefix )
@@ -90,6 +93,15 @@ public void Generate(
9093 . Build ( assembly )
9194 . RenderAsync ( version . ToOpenApiSpecVersion ( ) , format . ToOpenApiFormat ( ) )
9295 . Result ;
96+ }
97+ catch ( Exception ex )
98+ {
99+ Console . WriteLine ( ex . Message ) ;
100+ Console . WriteLine ( ex . StackTrace ) ;
101+ #if NET461
102+ req . Dispose ( ) ;
103+ #endif
104+ }
93105#if NET461
94106 req . Dispose ( ) ;
95107#endif
Original file line number Diff line number Diff line change @@ -253,7 +253,7 @@ private void SetOpenApiInfo()
253253 this . OpenApiSettingsJsonPath . ThrowIfNullOrWhiteSpace ( ) ;
254254 this . LocalSettingsJsonPath . ThrowIfNullOrWhiteSpace ( ) ;
255255
256- var openApiInfo = this . HostSettings . Get < OpenApiInfo > ( "openApi" ) ;
256+ var openApiInfo = this . HostSettings . Get < OpenApiInfo > ( "openApi:info " ) ;
257257 if ( this . IsValidOpenApiInfo ( openApiInfo ) )
258258 {
259259 this . OpenApiInfo = openApiInfo ;
@@ -264,7 +264,7 @@ private void SetOpenApiInfo()
264264 if ( File . Exists ( this . OpenApiSettingsJsonPath ) )
265265 {
266266 var openapiSettings = File . ReadAllText ( this . OpenApiSettingsJsonPath , Encoding . UTF8 ) ;
267- openApiInfo = JsonConvert . DeserializeObject < OpenApiInfo > ( openapiSettings ) ;
267+ openApiInfo = JsonConvert . DeserializeObject < OpenApiSettings > ( openapiSettings ) . Info ;
268268 if ( this . IsValidOpenApiInfo ( openApiInfo ) )
269269 {
270270 this . OpenApiInfo = openApiInfo ;
You can’t perform that action at this time.
0 commit comments