mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-04 18:09:12 +03:00
Convert strings to enums #2153
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nielsvanvelzen on GitHub (Sep 27, 2020).
A lot of our API uses strings to communicate where enums would be preferable. Converting those properties to enums will help the apiclient generation and automatically documents all valid values, causing less errors introduced via misspelling or wrong capitalization.
For example: the image API contains a parameter called "format". I know the value can be "png". But can it also be "bmp"? You won't know if the server just says it's a string, an enum will always make sure all available options are exposed and no more or less.
Missing types
Feel free to leave a comment (or edit this post directly) to add types not listed
File name - Property - Pull Request
Api
Common fields
Most of these are used in multiple controllers
Models
WebSockets
Helping out
Want to help fix these issues? Awesome! Please leave a comment which type you're working on (and check if no-one else it working on it already) and link to this issue when creating your pull request.
For questions about the code or discussing something else our Matrix channels are open 24/7!
@skyfrk commented on GitHub (Oct 1, 2020):
I'll take on
Jellyfin.Api/Controllers/SessionController PostCapabilities.supportedCommandsandMediaBrowser/Model/Session/ClientCapabilities - SupportedCommandsin one PR.@ConfusedPolarBear commented on GitHub (Oct 2, 2020):
I can convert
Jellyfin.Api/Controllers/ImageController - GetItemImage.format.@crobibero commented on GitHub (Oct 10, 2020):
Notes:
sortBy,orderBycan't be easily convertedincludeItemTypes,excludeItemTypes,mediaTypes,personTypes,collectionTypeneed to stay as string because they're used in the librarydb mess.
@nielsvanvelzen commented on GitHub (Oct 10, 2020):
It's unfortunate we can't convert those right now. Do you think it's possible when the database migration is done?
@crobibero commented on GitHub (Oct 10, 2020):
Yep, they can all be changed once database migration is done, or if we were to change how the query is generated (boooooo)
@crobibero commented on GitHub (Oct 10, 2020):
Todo- change all enum to be not-plural
@nielsvanvelzen commented on GitHub (May 16, 2021):
Closing this issue now as it became slightly outdated, most (but not all 😉) properties use enums now!