Skip to content

Commit ab062bb

Browse files
authored
Merge pull request #529 from do-it-ger/master
Swagger full OpenApiInfo and display request duration
2 parents 8fbc1a5 + 3a529c9 commit ab062bb

File tree

1 file changed

+19
-1
lines changed
  • aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/Startup

1 file changed

+19
-1
lines changed

aspnet-core/src/AbpCompanyName.AbpProjectName.Web.Host/Startup/Startup.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,24 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
7676
// Swagger - Enable this line and the related lines in Configure method to enable swagger UI
7777
services.AddSwaggerGen(options =>
7878
{
79-
options.SwaggerDoc("v1", new OpenApiInfo() { Title = "AbpProjectName API", Version = "v1" });
79+
options.SwaggerDoc("v1", new OpenApiInfo
80+
{
81+
Version = "v1",
82+
Title = "AbpProjectName API",
83+
Description = "AbpProjectName",
84+
// uncomment if needed TermsOfService = new Uri("https://example.com/terms"),
85+
Contact = new OpenApiContact
86+
{
87+
Name = "AbpProjectName",
88+
Email = string.Empty,
89+
Url = new Uri("https://twitter.com/aspboilerplate"),
90+
},
91+
License = new OpenApiLicense
92+
{
93+
Name = "MIT License",
94+
Url = new Uri("https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/LICENSE"),
95+
}
96+
});
8097
options.DocInclusionPredicate((docName, description) => true);
8198

8299
// Define the BearerAuth scheme that's in use
@@ -128,6 +145,7 @@ public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
128145
options.SwaggerEndpoint(_appConfiguration["App:ServerRootAddress"].EnsureEndsWith('/') + "swagger/v1/swagger.json", "AbpProjectName API V1");
129146
options.IndexStream = () => Assembly.GetExecutingAssembly()
130147
.GetManifestResourceStream("AbpCompanyName.AbpProjectName.Web.Host.wwwroot.swagger.ui.index.html");
148+
options.DisplayRequestDuration(); // Controls the display of the request duration (in milliseconds) for "Try it out" requests.
131149
}); // URL: /swagger
132150
}
133151
}

0 commit comments

Comments
 (0)