diff options
| author | crobibero <cody@robibe.ro> | 2020-10-01 08:10:47 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-10-01 08:10:47 -0600 |
| commit | 5ee6f4920497ec9f4d6c305e9d0828d21074a773 (patch) | |
| tree | ea53558713191bf295844b134ff7f07dc79103ec | |
| parent | c7b3d4a90c946f9a2438622cc0ca43d19b84bef8 (diff) | |
Manually register models used in websocket messages.
| -rw-r--r-- | Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs | 1 | ||||
| -rw-r--r-- | Jellyfin.Server/Filters/WebsocketModelFilter.cs | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs index 5bcf6d5f0..e180d0cd7 100644 --- a/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs +++ b/Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs @@ -260,6 +260,7 @@ namespace Jellyfin.Server.Extensions c.AddSwaggerTypeMappings(); c.OperationFilter<FileResponseFilter>(); + c.DocumentFilter<WebsocketModelFilter>(); }); } diff --git a/Jellyfin.Server/Filters/WebsocketModelFilter.cs b/Jellyfin.Server/Filters/WebsocketModelFilter.cs new file mode 100644 index 000000000..90fca5583 --- /dev/null +++ b/Jellyfin.Server/Filters/WebsocketModelFilter.cs @@ -0,0 +1,31 @@ +using MediaBrowser.Common.Plugins; +using MediaBrowser.Controller.LiveTv; +using MediaBrowser.Model.Entities; +using MediaBrowser.Model.Session; +using MediaBrowser.Model.SyncPlay; +using Microsoft.OpenApi.Models; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace Jellyfin.Server.Filters +{ + /// <summary> + /// Add models used in websocket messaging. + /// </summary> + public class WebsocketModelFilter : IDocumentFilter + { + /// <inheritdoc /> + public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) + { + context.SchemaGenerator.GenerateSchema(typeof(LibraryUpdateInfo), context.SchemaRepository); + context.SchemaGenerator.GenerateSchema(typeof(IPlugin), context.SchemaRepository); + context.SchemaGenerator.GenerateSchema(typeof(PlayRequest), context.SchemaRepository); + context.SchemaGenerator.GenerateSchema(typeof(TimerEventInfo), context.SchemaRepository); + context.SchemaGenerator.GenerateSchema(typeof(SendCommand), context.SchemaRepository); + context.SchemaGenerator.GenerateSchema(typeof(GeneralCommandType), context.SchemaRepository); + + context.SchemaGenerator.GenerateSchema(typeof(GroupUpdate<string>), context.SchemaRepository); + context.SchemaGenerator.GenerateSchema(typeof(GroupUpdate<PlayRequest>), context.SchemaRepository); + context.SchemaGenerator.GenerateSchema(typeof(GroupUpdate<long>), context.SchemaRepository); + } + } +} |
