aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordkanada <dkanada@users.noreply.github.com>2020-05-17 00:08:54 +0900
committerGitHub <noreply@github.com>2020-05-17 00:08:54 +0900
commitebc24470e34a7ba12b64ca30d4c6e67d21dbad91 (patch)
tree1e1908feb6cf3b4a9bb26d3c07e2da1f6c0705b7
parent6e1120c623719fcbdfbc0905b0efe0caa542d055 (diff)
parent2b1b9a64b6b7a3bac4d96642cda7a0c55d5cae74 (diff)
Merge pull request #3075 from crobibero/api-operationid
Add OperationId to SwaggerGen
-rw-r--r--Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
index a354f45aa..344ef6a5f 100644
--- a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
+++ b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using System.Reflection;
using System.Text.Json.Serialization;
using Jellyfin.Api;
using Jellyfin.Api.Auth;
@@ -14,6 +15,7 @@ using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Models;
+using Swashbuckle.AspNetCore.SwaggerGen;
namespace Jellyfin.Server.Extensions
{
@@ -112,6 +114,10 @@ namespace Jellyfin.Server.Extensions
// Order actions by route path, then by http method.
c.OrderActionsBy(description =>
$"{description.ActionDescriptor.RouteValues["controller"]}_{description.HttpMethod}");
+
+ // Use method name as operationId
+ c.CustomOperationIds(description =>
+ description.TryGetMethodInfo(out MethodInfo methodInfo) ? methodInfo.Name : null);
});
}
}