Skip to content

Instantly share code, notes, and snippets.

@wellingtonjhn
Created June 10, 2018 06:58
Show Gist options
  • Select an option

  • Save wellingtonjhn/2268a10d57bb55b9b74046df6de0c899 to your computer and use it in GitHub Desktop.

Select an option

Save wellingtonjhn/2268a10d57bb55b9b74046df6de0c899 to your computer and use it in GitHub Desktop.
Swagger XML Documentation
public void ConfigureServices(IServiceCollection services)
{
services.AddSwaggerGen(options =>
{
// ... código omitido
var applicationBasePath = PlatformServices.Default.Application.ApplicationBasePath;
var applicationName = PlatformServices.Default.Application.ApplicationName;
var xmlDocumentPath = Path.Combine(applicationBasePath, $"{applicationName}.xml");
if (File.Exists(xmlDocumentPath))
{
options.IncludeXmlComments(xmlDocumentPath);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment