You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jellyfin/Jellyfin.Server/Extensions/ApiApplicationBuilderExtens...

35 lines
1.3 KiB

using Microsoft.AspNetCore.Builder;
namespace Jellyfin.Server.Extensions
{
/// <summary>
/// Extensions for adding API specific functionality to the application pipeline.
/// </summary>
public static class ApiApplicationBuilderExtensions
{
/// <summary>
/// Adds swagger and swagger UI to the application pipeline.
/// </summary>
/// <param name="applicationBuilder">The application builder.</param>
/// <returns>The updated application builder.</returns>
public static IApplicationBuilder UseJellyfinApiSwagger(this IApplicationBuilder applicationBuilder)
{
// Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.),
// specifying the Swagger JSON endpoint.
5 years ago
const string specEndpoint = "/swagger/v1/swagger.json";
5 years ago
return applicationBuilder
.UseSwagger()
5 years ago
.UseSwaggerUI(c =>
{
c.SwaggerEndpoint(specEndpoint, "Jellyfin API V1");
c.RoutePrefix = "api-docs/swagger";
5 years ago
})
.UseReDoc(c =>
{
c.SpecUrl(specEndpoint);
c.RoutePrefix = "api-docs/redoc";
5 years ago
});
}
}
}