using System;
using System.IO;
using System.Reflection;
using BlueWest.WebApi.Tools;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
namespace BlueWest.WebApi.Extensions
{
public static class SwaggerExtensions
{
///
/// Swagger documentation provider options
///
///
public static void ConfigureSwaggerOptions(this SwaggerGenOptions swaggerGenOptions)
{
swaggerGenOptions.SchemaFilter();
swaggerGenOptions.SwaggerDoc("v1", new OpenApiInfo
{
Title = "BlueWest.Api.App",
Version = "v1",
Description = "BlueWest.Api.App",
TermsOfService = new Uri("https://git.codeliturgy.com/terms-of-service"),
Contact = new OpenApiContact
{
Name = "Benny",
Email = string.Empty,
Url = new Uri("https://git.codeliturgy.com"),
},
License = new OpenApiLicense
{
Name = "Use under LICX",
Url = new Uri("https://git.codeliturgy.com/license"),
}
});
// Set the comments path for the Swagger JSON and UI.
var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml";
var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile);
swaggerGenOptions.IncludeXmlComments(xmlPath);
}
}
}