As far as I know, if you want to modify the nswagtitle. You should modify AddSwaggerDocument config setting in the ConfigureServices method as below:
Details you could refer to below codes:
services.AddSwaggerDocument(config =>
{
config.PostProcess = document =>
{
//document.Info.Version = "v1";
document.Info.Title = "ToDo API";
//document.Info.Description = "A simple ASP.NET Core web API";
//document.Info.TermsOfService = "None";
//document.Info.Contact = new NSwag.OpenApiContact
//{
// Name = "Shayne Boyer",
// Email = string.Empty,
// Url = "https://twitter.com/spboyer"
//};
//document.Info.License = new NSwag.OpenApiLicense
//{
// Name = "Use under LICX",
// Url = "https://example.com/license"
//};
};
});
Details startup.cs codes:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.Negotiate;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace CoreNormalIssue
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
.AddNegotiate();
services.AddControllersWithViews();
services.AddSwaggerDocument(config =>
{
config.PostProcess = document =>
{
//document.Info.Version = "v1";
document.Info.Title = "ToDo API";
//document.Info.Description = "A simple ASP.NET Core web API";
//document.Info.TermsOfService = "None";
//document.Info.Contact = new NSwag.OpenApiContact
//{
// Name = "Shayne Boyer",
// Email = string.Empty,
// Url = "https://twitter.com/spboyer"
//};
//document.Info.License = new NSwag.OpenApiLicense
//{
// Name = "Use under LICX",
// Url = "https://example.com/license"
//};
};
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseOpenApi();
app.UseSwaggerUi3();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Default}/{action=Index}/{id?}");
});
}
}
}
Result: