[PR #4252] [MERGED] Convert supportedCommands strings to enums #9976

Closed
opened 2026-02-07 06:11:52 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/4252
Author: @skyfrk
Created: 10/1/2020
Status: Merged
Merged: 10/4/2020
Merged by: @Bond-009

Base: masterHead: 4214-supported-commands-enum


📝 Commits (10+)

  • dd4f3a7 feat: convert supportedCommands strings to enums
  • f314be9 chore(CONTRIBUTORS.md): add skyfrk
  • 0655928 feat: add CommaDelimitedArrayModelBinder
  • ba12ea7 feat: use CommaDelimitedArrayModelBinder to retain API
  • 4b4c74b feat: extend CommaDelimitedArrayModelBinder to support auto generated openAPI spec
  • d10090b fix: remove unused null check
  • 21b39a2 refactor: simplify null check
  • 9aad772 feat: implement CommaDelimitedArrayModelBinderProvider
  • c3e7eb3 Merge branch '4214-supported-commands-enum' of https://github.com/skyfrk/jellyfin into 4214-supported-commands-enum
  • 33f80dc feat(CommaDelimitedArrayModelBinder): add none result check

📊 Changes

10 files changed (+359 additions, -15 deletions)

View changed files

📝 CONTRIBUTORS.md (+1 -0)
📝 Emby.Dlna/PlayTo/PlayToManager.cs (+9 -9)
📝 Jellyfin.Api/Controllers/SessionController.cs (+3 -2)
Jellyfin.Api/ModelBinders/CommaDelimitedArrayModelBinder.cs (+64 -0)
Jellyfin.Api/ModelBinders/CommaDelimitedArrayModelBinderProvider.cs (+29 -0)
📝 Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs (+3 -0)
📝 MediaBrowser.Controller/Session/SessionInfo.cs (+2 -2)
📝 MediaBrowser.Model/Session/ClientCapabilities.cs (+2 -2)
tests/Jellyfin.Api.Tests/ModelBinders/CommaDelimitedArrayModelBinderTests.cs (+229 -0)
tests/Jellyfin.Api.Tests/ModelBinders/TestType.cs (+17 -0)

📄 Description

This PR converts supportedCommands strings to enums as part of #4214.

There is a breaking change: Before my changes one could pass a comma separated list of supportedCommands to the PostCapabilities() function in the SessionController. Because the supportedCommands is an array of enums this is no longer possible. See below how ASP.NET Core handles an array of enums as a query parameter:

  • Example request URL before: https://example.com/Sessions/Capabilities?supportedCommands=Mute,Unmute
  • Example request URL 1 after: https://example.com/Sessions/Capabilities?supportedCommands=Mute&supportedCommands=Unmute
  • Example request URL 2 after: https://example.com/Sessions/Capabilities?supportedCommands[0]=Mute&supportedCommands[1]=Unmute

There are ways to retain the old interface using a ModelBinder or an ActionFilter. Should I implement one of them?

Changes

  • use GeneralCommandType[] instead of string[] for supportedCommands.
  • add myself as contributor.

Issues


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jellyfin/jellyfin/pull/4252 **Author:** [@skyfrk](https://github.com/skyfrk) **Created:** 10/1/2020 **Status:** ✅ Merged **Merged:** 10/4/2020 **Merged by:** [@Bond-009](https://github.com/Bond-009) **Base:** `master` ← **Head:** `4214-supported-commands-enum` --- ### 📝 Commits (10+) - [`dd4f3a7`](https://github.com/jellyfin/jellyfin/commit/dd4f3a7c5184afbada50a038564c95fa780e04f8) feat: convert supportedCommands strings to enums - [`f314be9`](https://github.com/jellyfin/jellyfin/commit/f314be9d8513829a5de21eeb2ef19e10943b2a0e) chore(CONTRIBUTORS.md): add skyfrk - [`0655928`](https://github.com/jellyfin/jellyfin/commit/0655928ab14452dde97192ead66b33c927a75d5a) feat: add CommaDelimitedArrayModelBinder - [`ba12ea7`](https://github.com/jellyfin/jellyfin/commit/ba12ea7f4a0bb4804bafa335d374d45bac37ea84) feat: use CommaDelimitedArrayModelBinder to retain API - [`4b4c74b`](https://github.com/jellyfin/jellyfin/commit/4b4c74bdcd2ffd119f930226179360907c15fd74) feat: extend CommaDelimitedArrayModelBinder to support auto generated openAPI spec - [`d10090b`](https://github.com/jellyfin/jellyfin/commit/d10090b394371e6b588a08b453a1dfb177e90ca1) fix: remove unused null check - [`21b39a2`](https://github.com/jellyfin/jellyfin/commit/21b39a207dd4a6864e9d7bfe1c1e9253cbfc0f06) refactor: simplify null check - [`9aad772`](https://github.com/jellyfin/jellyfin/commit/9aad772288145645d51f93b26a2493782f55f2d3) feat: implement CommaDelimitedArrayModelBinderProvider - [`c3e7eb3`](https://github.com/jellyfin/jellyfin/commit/c3e7eb3a6f1ba5eb77841ef4e3c350204e12cb20) Merge branch '4214-supported-commands-enum' of https://github.com/skyfrk/jellyfin into 4214-supported-commands-enum - [`33f80dc`](https://github.com/jellyfin/jellyfin/commit/33f80dc3c167f07348cd817f38a33a78302bda6b) feat(CommaDelimitedArrayModelBinder): add none result check ### 📊 Changes **10 files changed** (+359 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `CONTRIBUTORS.md` (+1 -0) 📝 `Emby.Dlna/PlayTo/PlayToManager.cs` (+9 -9) 📝 `Jellyfin.Api/Controllers/SessionController.cs` (+3 -2) ➕ `Jellyfin.Api/ModelBinders/CommaDelimitedArrayModelBinder.cs` (+64 -0) ➕ `Jellyfin.Api/ModelBinders/CommaDelimitedArrayModelBinderProvider.cs` (+29 -0) 📝 `Jellyfin.Server/Extensions/ApiServiceCollectionExtensions.cs` (+3 -0) 📝 `MediaBrowser.Controller/Session/SessionInfo.cs` (+2 -2) 📝 `MediaBrowser.Model/Session/ClientCapabilities.cs` (+2 -2) ➕ `tests/Jellyfin.Api.Tests/ModelBinders/CommaDelimitedArrayModelBinderTests.cs` (+229 -0) ➕ `tests/Jellyfin.Api.Tests/ModelBinders/TestType.cs` (+17 -0) </details> ### 📄 Description This PR converts `supportedCommands` strings to enums as part of #4214. There is a **breaking change**: Before my changes one could pass a comma separated list of `supportedCommands` to the `PostCapabilities()` function in the `SessionController`. Because the `supportedCommands` is an array of enums this is no longer possible. See below how ASP.NET Core handles an array of enums as a query parameter: - Example request URL before: `https://example.com/Sessions/Capabilities?supportedCommands=Mute,Unmute` - Example request URL 1 after: `https://example.com/Sessions/Capabilities?supportedCommands=Mute&supportedCommands=Unmute` - Example request URL 2 after: `https://example.com/Sessions/Capabilities?supportedCommands[0]=Mute&supportedCommands[1]=Unmute` There are ways to retain the old interface using [a ModelBinder or an ActionFilter](https://stackoverflow.com/questions/9981330/). Should I implement one of them? **Changes** - use `GeneralCommandType[]` instead of `string[]` for `supportedCommands`. - add myself as contributor. **Issues** - #4214 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-07 06:11:52 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#9976