using Microsoft.OpenApi.Models;
using Swashbuckle.AspNetCore.SwaggerGen;
namespace LBPUnion.ProjectLighthouse.Servers.API;
///
///
/// A filter for the swagger documentation endpoint.
///
///
/// Makes sure that only endpoints under /api/v1 show up.
///
///
public class SwaggerFilter : IDocumentFilter
{
public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context)
{
List> nonApiRoutes = swaggerDoc.Paths.Where(x => !x.Key.ToLower().StartsWith("/api/v1")).ToList();
nonApiRoutes.ForEach(x => swaggerDoc.Paths.Remove(x.Key));
}
}