mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 03:48:06 +02:00
Add OperationId to SwaggerGen
This commit is contained in:
parent
6e1120c623
commit
2b1b9a64b6
1 changed files with 6 additions and 0 deletions
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using Jellyfin.Api;
|
using Jellyfin.Api;
|
||||||
using Jellyfin.Api.Auth;
|
using Jellyfin.Api.Auth;
|
||||||
|
@ -14,6 +15,7 @@ using Microsoft.AspNetCore.Authentication;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.OpenApi.Models;
|
using Microsoft.OpenApi.Models;
|
||||||
|
using Swashbuckle.AspNetCore.SwaggerGen;
|
||||||
|
|
||||||
namespace Jellyfin.Server.Extensions
|
namespace Jellyfin.Server.Extensions
|
||||||
{
|
{
|
||||||
|
@ -112,6 +114,10 @@ namespace Jellyfin.Server.Extensions
|
||||||
// Order actions by route path, then by http method.
|
// Order actions by route path, then by http method.
|
||||||
c.OrderActionsBy(description =>
|
c.OrderActionsBy(description =>
|
||||||
$"{description.ActionDescriptor.RouteValues["controller"]}_{description.HttpMethod}");
|
$"{description.ActionDescriptor.RouteValues["controller"]}_{description.HttpMethod}");
|
||||||
|
|
||||||
|
// Use method name as operationId
|
||||||
|
c.CustomOperationIds(description =>
|
||||||
|
description.TryGetMethodInfo(out MethodInfo methodInfo) ? methodInfo.Name : null);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue