You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If you configure Swagger Endpoints dynamically in ConfigureServices(IServiceCollection services), those are not used when calling UseSwaggerForOcelotUI and you are getting the error "SwaggerEndPoints configuration section is missing or empty".
Expected behavior
The programmatic configuration is used.
Possible fix
Do not re-read the configuration section in UseSwaggerForOcelotUI and read from configured options instead.
publicstaticIApplicationBuilderUseSwaggerForOcelotUI(thisIApplicationBuilderapp,// no need to use a configuration section hereAction<SwaggerForOcelotUIOptions>setupAction){varoptions=app.ApplicationServices.GetService<IOptions<SwaggerForOcelotUIOptions>>().Value;setupAction?.Invoke(options);UseSwaggerForOcelot(app,options);app.UseSwaggerUI(c =>{InitUIOption(c,options);IEnumerable<SwaggerEndPointOptions>endPoints=app.ApplicationServices.GetService<IOptions<List<SwaggerEndPointOptions>>>().Value;AddSwaggerEndPoints(c,endPoints,options.DownstreamSwaggerEndPointBasePath);});returnapp;}
This also works for file based configuration as the options are already configured in AddSwaggerForOcelot().
The text was updated successfully, but these errors were encountered:
Use configured options in UseSwaggerForOcelotUI to allow programmatic configuration of services.
Overloads of UseSwaggerForOcelotUI with IConfiguration parameter become deprecated.
FixesBurgyn#104
* Allow programmatic configuration of SwaggerEndpoints
Use configured options in UseSwaggerForOcelotUI to allow programmatic configuration of services.
Overloads of UseSwaggerForOcelotUI with IConfiguration parameter become deprecated.
Fixes#104
* Updated Readme to use new UseSwaggerForOcelotUI
Updated Readme to use UseSwaggerForOcelotUI without configuration parameter
Co-authored-by: Robin Kaulfuß <[email protected]>
Describe the bug
If you configure Swagger Endpoints dynamically in ConfigureServices(IServiceCollection services), those are not used when calling UseSwaggerForOcelotUI and you are getting the error "SwaggerEndPoints configuration section is missing or empty".
Expected behavior
The programmatic configuration is used.
Possible fix
Do not re-read the configuration section in UseSwaggerForOcelotUI and read from configured options instead.
This also works for file based configuration as the options are already configured in AddSwaggerForOcelot().
The text was updated successfully, but these errors were encountered: