[PR #13821] [MERGED] Explicitly set default value for enums used in API models #13725

Closed
opened 2026-02-07 07:18:05 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/13821
Author: @gnattu
Created: 3/31/2025
Status: Merged
Merged: 4/1/2025
Merged by: @crobibero

Base: masterHead: explicit-api-model-default


📝 Commits (1)

  • c25bd5e Explicitly set default value for enums used in API models

📊 Changes

5 files changed (+9 additions, -0 deletions)

View changed files

📝 MediaBrowser.Model/Dto/BaseItemDto.cs (+2 -0)
📝 MediaBrowser.Model/Dto/BaseItemPerson.cs (+2 -0)
📝 MediaBrowser.Model/Entities/MediaStream.cs (+1 -0)
📝 MediaBrowser.Model/MediaSegments/MediaSegmentDto.cs (+2 -0)
📝 MediaBrowser.Model/Search/SearchHint.cs (+2 -0)

📄 Description

Enums in response model with no nullability or default value will make the API very fragile as each extension to the enum will break the API for some clients, but a lot of enums actually do have an unknown value which should be used as a default. This set all model properties that are non-nullable using an enum that has an Unknown member in 10.10, except MediaStream.VideoRangeType which is refactored in #13277

Changes

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/13821 **Author:** [@gnattu](https://github.com/gnattu) **Created:** 3/31/2025 **Status:** ✅ Merged **Merged:** 4/1/2025 **Merged by:** [@crobibero](https://github.com/crobibero) **Base:** `master` ← **Head:** `explicit-api-model-default` --- ### 📝 Commits (1) - [`c25bd5e`](https://github.com/jellyfin/jellyfin/commit/c25bd5e38908b0a7de10f1677dd7e0faa6ca9725) Explicitly set default value for enums used in API models ### 📊 Changes **5 files changed** (+9 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `MediaBrowser.Model/Dto/BaseItemDto.cs` (+2 -0) 📝 `MediaBrowser.Model/Dto/BaseItemPerson.cs` (+2 -0) 📝 `MediaBrowser.Model/Entities/MediaStream.cs` (+1 -0) 📝 `MediaBrowser.Model/MediaSegments/MediaSegmentDto.cs` (+2 -0) 📝 `MediaBrowser.Model/Search/SearchHint.cs` (+2 -0) </details> ### 📄 Description Enums in response model with no nullability or default value will make the API very fragile as each extension to the enum will break the API for some clients, but a lot of enums actually do have an unknown value which should be used as a default. This set all model properties that are non-nullable using an enum that has an Unknown member in 10.10, except MediaStream.VideoRangeType which is refactored in #13277 <!-- Ensure your title is short, descriptive, and in the imperative mood (Fix X, Change Y, instead of Fixed X, Changed Y). For a good inspiration of what to write in commit messages and PRs please review https://chris.beams.io/posts/git-commit/ and our documentation. --> **Changes** <!-- Describe your changes here in 1-5 sentences. --> **Issues** <!-- Tag any issues that this PR solves here. ex. Fixes # --> --- <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 07:18:05 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#13725