From e66f49e54a1927064cfcba77a7b53a4877e3effc Mon Sep 17 00:00:00 2001 From: Timothy Date: Thu, 2 Jul 2026 21:37:00 +0200 Subject: [PATCH] fix(api): make channel state NowPlaying nullable in DTO MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An off-air channel has no current playout item, so the handler returns null for NowPlaying; the DTO now declares that (file-scoped #nullable — ErsatzTV.Core has NRT disabled project-wide). Regenerated OpenAPI and web types: nowPlaying keeps its nullable oneOf schema (matching the schema contract test) and channelNumber loses a spurious nullable annotation left over from an earlier draft — the field is required. Co-Authored-By: Claude Fable 5 --- .../Api/Channels/ChannelStateResponseModel.cs | 4 +++- ErsatzTV/wwwroot/openapi/v1.json | 5 +---- web/src/api/generated/v1.d.ts | 11 +++++++++++ 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ErsatzTV.Core/Api/Channels/ChannelStateResponseModel.cs b/ErsatzTV.Core/Api/Channels/ChannelStateResponseModel.cs index 3a57cfade..44c306078 100644 --- a/ErsatzTV.Core/Api/Channels/ChannelStateResponseModel.cs +++ b/ErsatzTV.Core/Api/Channels/ChannelStateResponseModel.cs @@ -1,7 +1,9 @@ namespace ErsatzTV.Core.Api.Channels; +#nullable enable + public record ChannelStateResponseModel( int ChannelId, string ChannelNumber, bool OnAir, - ChannelNowPlayingResponseModel NowPlaying); + ChannelNowPlayingResponseModel? NowPlaying); diff --git a/ErsatzTV/wwwroot/openapi/v1.json b/ErsatzTV/wwwroot/openapi/v1.json index a8393a7cc..107d1ec89 100644 --- a/ErsatzTV/wwwroot/openapi/v1.json +++ b/ErsatzTV/wwwroot/openapi/v1.json @@ -3559,10 +3559,7 @@ "format": "int32" }, "channelNumber": { - "type": [ - "null", - "string" - ] + "type": "string" }, "onAir": { "type": "boolean" diff --git a/web/src/api/generated/v1.d.ts b/web/src/api/generated/v1.d.ts index c420f1238..7a5773e82 100644 --- a/web/src/api/generated/v1.d.ts +++ b/web/src/api/generated/v1.d.ts @@ -38,6 +38,11 @@ export interface components { }; "ChannelIdleBehavior": "StopOnDisconnect" | "KeepRunning"; "ChannelMusicVideoCreditsMode": "None" | "GenerateSubtitles"; + "ChannelNowPlayingResponseModel": { + "title": null | string; + "startUtc": string; + "finishUtc": string; + }; "ChannelPlayoutMode": "Continuous" | "OnDemand"; "ChannelPlayoutSource": "Generated" | "Mirror"; "ChannelResponseModel": { @@ -54,6 +59,12 @@ export interface components { "showInEpg": boolean; }; "ChannelSongVideoMode": "Default" | "WithProgress"; + "ChannelStateResponseModel": { + "channelId": number; + "channelNumber": string; + "onAir": boolean; + "nowPlaying": null | components["schemas"]["ChannelNowPlayingResponseModel"]; + }; "ChannelStreamSelectorMode": "Default" | "Custom" | "Troubleshooting"; "ChannelSubtitleMode": "None" | "Forced" | "Default" | "Any"; "ChannelTranscodeMode": "OnDemand";