diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/Startup.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/Startup.mustache index 07b1b221621b..f34e2a6b2557 100644 --- a/modules/openapi-generator/src/main/resources/aspnetcore/Startup.mustache +++ b/modules/openapi-generator/src/main/resources/aspnetcore/Startup.mustache @@ -93,7 +93,10 @@ namespace {{packageName}} .UseMvc() .UseDefaultFiles() .UseStaticFiles() - .UseSwagger() + .UseSwagger(c => + { + c.RouteTemplate = "swagger/{documentName}/openapi.json"; + }) .UseSwaggerUI(c => { //TODO: Either use the SwaggerGen generated Swagger contract (generated from C# classes) diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs index 193985f69650..05d5ff5bee11 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs @@ -100,7 +100,10 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF .UseMvc() .UseDefaultFiles() .UseStaticFiles() - .UseSwagger() + .UseSwagger(c => + { + c.RouteTemplate = "swagger/{documentName}/openapi.json"; + }) .UseSwaggerUI(c => { //TODO: Either use the SwaggerGen generated Swagger contract (generated from C# classes)