aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-08-03 14:38:51 -0600
committercrobibero <cody@robibe.ro>2020-08-03 14:38:51 -0600
commit9e00aa3014c0044c0918a775c3394763666b30af (patch)
treeaaa4705547693af4f2e298e7a6481d7c77a67cb4 /Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
parent1535f363b28ab7e57354f2724f5f1900a000b5cc (diff)
fix openapi validation errors
Diffstat (limited to 'Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs')
-rw-r--r--Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs11
1 files changed, 9 insertions, 2 deletions
diff --git a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
index cfbabf795..6e91042df 100644
--- a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
+++ b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs
@@ -198,8 +198,15 @@ namespace Jellyfin.Server.Extensions
$"{description.ActionDescriptor.RouteValues["controller"]}_{description.RelativePath}");
// Use method name as operationId
- c.CustomOperationIds(description =>
- description.TryGetMethodInfo(out MethodInfo methodInfo) ? methodInfo.Name : null);
+ c.CustomOperationIds(
+ description =>
+ {
+ description.TryGetMethodInfo(out MethodInfo methodInfo);
+ // Attribute name, method name, none.
+ return description?.ActionDescriptor?.AttributeRouteInfo?.Name
+ ?? methodInfo?.Name
+ ?? null;
+ });
// TODO - remove when all types are supported in System.Text.Json
c.AddSwaggerTypeMappings();