Remove versioned API

pull/2925/head
crobibero 5 years ago
parent d491b1b45f
commit 806ae1bc07

@ -26,7 +26,7 @@ namespace Emby.Server.Implementations.Browser
/// <param name="appHost">The app host.</param> /// <param name="appHost">The app host.</param>
public static void OpenSwaggerPage(IServerApplicationHost appHost) public static void OpenSwaggerPage(IServerApplicationHost appHost)
{ {
TryOpenUrl(appHost, "/api-docs/v1/swagger"); TryOpenUrl(appHost, "/api-docs/swagger");
} }
/// <summary> /// <summary>

@ -1,5 +1,4 @@
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using Jellyfin.Server.Middleware;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
namespace Jellyfin.Server.Extensions namespace Jellyfin.Server.Extensions
@ -31,19 +30,20 @@ namespace Jellyfin.Server.Extensions
return applicationBuilder return applicationBuilder
.UseSwagger(c => .UseSwagger(c =>
{ {
c.RouteTemplate = $"/{baseUrl}api-docs/{{documentName}}/openapi.json"; // Custom path requires {documentName}, SwaggerDoc documentName is 'api-docs'
c.RouteTemplate = $"/{baseUrl}{{documentName}}/openapi.json";
}) })
.UseSwaggerUI(c => .UseSwaggerUI(c =>
{ {
c.DocumentTitle = "Jellyfin API v1"; c.DocumentTitle = "Jellyfin API";
c.SwaggerEndpoint($"/{baseUrl}api-docs/v1/openapi.json", "Jellyfin API v1"); c.SwaggerEndpoint($"/{baseUrl}api-docs/openapi.json", "Jellyfin API");
c.RoutePrefix = $"{baseUrl}api-docs/v1/swagger"; c.RoutePrefix = $"{baseUrl}api-docs/swagger";
}) })
.UseReDoc(c => .UseReDoc(c =>
{ {
c.DocumentTitle = "Jellyfin API v1"; c.DocumentTitle = "Jellyfin API";
c.SpecUrl($"/{baseUrl}api-docs/v1/openapi.json"); c.SpecUrl($"/{baseUrl}api-docs/openapi.json");
c.RoutePrefix = $"{baseUrl}api-docs/v1/redoc"; c.RoutePrefix = $"{baseUrl}api-docs/redoc";
}); });
} }
} }

@ -96,7 +96,7 @@ namespace Jellyfin.Server.Extensions
{ {
return serviceCollection.AddSwaggerGen(c => return serviceCollection.AddSwaggerGen(c =>
{ {
c.SwaggerDoc("v1", new OpenApiInfo { Title = "Jellyfin API", Version = "v1" }); c.SwaggerDoc("api-docs", new OpenApiInfo { Title = "Jellyfin API" });
// Add all xml doc files to swagger generator. // Add all xml doc files to swagger generator.
var xmlFiles = Directory.GetFiles( var xmlFiles = Directory.GetFiles(

@ -529,7 +529,7 @@ namespace Jellyfin.Server
var inMemoryDefaultConfig = ConfigurationOptions.DefaultConfiguration; var inMemoryDefaultConfig = ConfigurationOptions.DefaultConfiguration;
if (startupConfig != null && !startupConfig.HostWebClient()) if (startupConfig != null && !startupConfig.HostWebClient())
{ {
inMemoryDefaultConfig[HttpListenerHost.DefaultRedirectKey] = "api-docs/v1/swagger"; inMemoryDefaultConfig[HttpListenerHost.DefaultRedirectKey] = "api-docs/swagger";
} }
return config return config

Loading…
Cancel
Save