Ocelat api gateway documentation with swagger

443 views Asked by At

I've developed a project based on microservices(11 microservices) and used Ocelat for api gateway but I'm struggling with generate microservice api documentation, Ocelat says use this way to generate document by create swagger json file in gateway project and add all api endpoint:

app.Map("/swagger/v1/swagger.json", b =>
                {
                    b.Run(x =>
                       File.ReadAllTextAsync(Path.Combine(AppContext.BaseDirectory,
                               "ApiDocumentation/Swagger.json"))
                           .ContinueWith(readTask => x.Response.WriteAsync(readTask.Result))
                        );

but every time that my microservice api was changed I have to edit this file and deploy gateway project again but I want to generate api gateway document automatically.

I've read this repository MMLib.SwaggerForOcelot but I think there should be a another better way.

I'm using .net core 3.1 and Swashbuckle.AspNetCore 5.4.1.

0

There are 0 answers