Remove versioned API

This commit is contained in:
crobibero 2020-04-29 08:04:05 -06:00
parent d491b1b45f
commit 806ae1bc07
4 changed files with 11 additions and 11 deletions

View file

@ -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>

View file

@ -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";
}); });
} }
} }

View file

@ -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(

View file

@ -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