Rwing / OcelotSwagger

This library makes ocelot easy to integrate swagger
MIT License
16 stars 5 forks source link

Missing API dropdownlist #1

Open secret-agent-B opened 5 years ago

secret-agent-B commented 5 years ago

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

Rwing commented 5 years ago

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