From f74cb400f5964bc1ab54c5ce6827cf5b7b4af2be Mon Sep 17 00:00:00 2001 From: Brendan Szymanski Date: Sat, 8 Aug 2026 15:21:08 -0400 Subject: [PATCH] Filter generated Jellyfin API operations --- .../LuminateAPI/openapi-generator-config.yaml | 39 +++++++++++++++++++ .../Session/JellyfinAPI.swift | 10 +++-- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/Sources/LuminateAPI/openapi-generator-config.yaml b/Sources/LuminateAPI/openapi-generator-config.yaml index 8e60f91..80e4859 100644 --- a/Sources/LuminateAPI/openapi-generator-config.yaml +++ b/Sources/LuminateAPI/openapi-generator-config.yaml @@ -3,3 +3,42 @@ generate: - client accessModifier: public namingStrategy: idiomatic +# Only the operations Luminate calls are generated. The Jellyfin specification defines 388 +# operations and 357 schemas; generating all of them produced roughly 258,000 lines of Swift and +# dominated build time. The generator additionally includes the transitive closure of every +# component the listed operations reference, so no `schemas:` additions are needed. +# +# Keep this list in sync with the `JellyfinAPI` protocol in +# Sources/LuminateServices/Session/JellyfinAPI.swift. An operation that is not listed here is not +# generated, and a call to it fails to compile with "value of type 'Client' has no member". +filter: + operations: + # Discovery and system + - GetPublicSystemInfo + - GetSystemInfo + # Auth + - GetPublicUsers + - AuthenticateUserByName + - UpdateUserPassword + - GetQuickConnectEnabled + - InitiateQuickConnect + - GetQuickConnectState + - AuthenticateWithQuickConnect + # Home and browse + - GetUserViews + - GetItems + - GetItem + - GetResumeItems + - GetNextUp + - GetLatestMedia + - GetSeasons + - GetEpisodes + - GetSearchHints + # Images + - GetItemImage + - GetItemImageByIndex + # User state + - MarkPlayedItem + - MarkUnplayedItem + - MarkFavoriteItem + - UnmarkFavoriteItem diff --git a/Sources/LuminateServices/Session/JellyfinAPI.swift b/Sources/LuminateServices/Session/JellyfinAPI.swift index 5271a3d..cad7df2 100644 --- a/Sources/LuminateServices/Session/JellyfinAPI.swift +++ b/Sources/LuminateServices/Session/JellyfinAPI.swift @@ -23,10 +23,12 @@ import LuminateAPI /// The slice of the generated Jellyfin API that ``JellyfinClient`` actually calls. /// -/// The generated `APIProtocol` declares all 388 operations in the Jellyfin specification, which -/// makes it impossible to conform a test double to. This protocol names only the operations -/// Luminate uses, so a test can implement a handful of methods instead of hundreds. The generated -/// `Client` already has matching signatures, so it conforms with an empty extension. +/// The seam exists so a test double conforms to a protocol this module owns rather than to the +/// generated `APIProtocol`, whose shape is decided by +/// `Sources/LuminateAPI/openapi-generator-config.yaml`. Adding an operation here also requires +/// adding its `operationId` to that file's `filter.operations` list, or the generated `Client` +/// will not have the method. The generated `Client` already has matching signatures, so it +/// conforms with an empty extension. /// /// This is a service-layer seam and nothing more: it deals in generated `Operations.*` types, which /// never travel above ``JellyfinClient``.