Last active
September 4, 2018 13:07
-
-
Save tugcearar/340c0150263dabc3c288ed241bddce9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ConfigureServices(IServiceCollection services) | |
{ | |
//Helper için | |
services.AddSwaggerGen(c => | |
{ | |
c.SwaggerDoc("v1", new Swashbuckle.AspNetCore.Swagger.Info | |
{ | |
Version = "v1", | |
Title = "My Web API", | |
Description = "Awesome WEB API", | |
TermsOfService = "None", | |
}); | |
//Eğer servisimizde herhangi bir Authorization yapısı kullandıysak belirtiyoruz | |
c.AddSecurityDefinition("Bearer", new ApiKeyScheme | |
{ | |
Description = "Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"", | |
Name = "Authorization", | |
In = "header", | |
Type = "apiKey" | |
}); | |
// Swagger JSON ve UI'ında görünecek yorumların çekileceği xml dosyasını belirtiyoruz. | |
c.IncludeXmlComments(Path.Combine(PlatformServices.Default.Application.ApplicationBasePath, "SwaggerSample.xml")); | |
}); | |
services.AddMvc(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment