OcelotSwagger icon indicating copy to clipboard operation
OcelotSwagger copied to clipboard

Missing API dropdownlist

Open secret-agent-B opened this issue 5 years ago • 1 comments

Any idea why I am not getting the dropdownlist in swagger UI?

            var consulUri = this.Configuration["ConsulConfiguration:ConsulUri"];

            app
                .UseMvc()
                .UseCors(options => options.WithOrigins("http://localhost:8080")
                    .AllowAnyMethod()
                    .AllowAnyHeader()
                    .AllowCredentials())
                .UseOcelotSwagger(async x =>
                    {
                        var consulClient = new ConsulClient(c => c.Address = new Uri(consulUri));
                        var services = await consulClient.Agent.Services();

                        foreach (var (key, value) in services.Response)
                        {
                            x.SwaggerEndPoints.Add(new SwaggerEndPoint
                            {
                                Name = key,
                                Url = $"/{value.Service}/swagger/v1/swagger.json",
                            });
                        }
                    })
                .UseOcelot()
                .Wait();

image

secret-agent-B avatar Jul 07 '19 07:07 secret-agent-B

Thank you for your interest in this project. This code looks good, could you provide more information?

Rwing avatar Jul 08 '19 03:07 Rwing