RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.76k stars 1.29k forks source link

Is that anyway to build document after startup #2943

Open kugarliyifan opened 4 years ago

kugarliyifan commented 4 years ago

I want to generate all the swagger.json file on the website startup,,don't wait for the browser request the "/swagger/swagger.json" url,, I use the asp.net core 3.1,,is that anyway to do this?

RicoSuter commented 4 years ago

I think you can resolve the IOpenApiDocumentGenerator provider and generate the documents on demand: https://github.com/RicoSuter/NSwag/blob/master/src/NSwag.AspNetCore/OpenApiDocumentProvider.cs#L20