Skip to content

Instantly share code, notes, and snippets.

@romipetrelis
Created February 27, 2017 21:54
Show Gist options
  • Save romipetrelis/6c4eba79d961408189324a54f2ea96b7 to your computer and use it in GitHub Desktop.
Save romipetrelis/6c4eba79d961408189324a54f2ea96b7 to your computer and use it in GitHub Desktop.
private static void ConfigureSwagger(HttpConfiguration config)
{
config.EnableSwagger(
c => {
c.SingleApiVersion("all", "Some API");
c.IncludeXmlComments(string.Format(@"{0}\bin\Your.Assembly.XmlComments.xml",
AppDomain.CurrentDomain.BaseDirectory));
c.RootUrl(req =>
req.RequestUri.GetLeftPart(UriPartial.Authority) +
req.GetRequestContext().VirtualPathRoot.TrimEnd('/'));
})
.EnableSwaggerUi(c => {
c.DisableValidator();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment