0

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.

sa-es-ir
  • 3,722
  • 2
  • 13
  • 31
  • what's the problem exactly? when you have to deploy a service it infers that you have added new feature, therfore your api docs need to be updated. – mahdi mahzouni Oct 15 '20 at 17:22
  • I want to generate api gateway document automatically – sa-es-ir Oct 15 '20 at 17:24
  • Considering your swagger.json will contain documentation of all 11 micro-services. Can you share the process to generate this combined json file? – Saad Khan Sep 16 '22 at 15:21
  • @SaadKhan actually I concatinate all microservices swagger.json(routes and schema) which means it's not generated automatically – sa-es-ir Sep 16 '22 at 17:48

0 Answers0