From 72a4c4542b9e19de2e6c327f05ce168b791c5cce Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Tue, 8 Oct 2024 20:00:03 +0000 Subject: [PATCH] fix: Fix some source schemas to reflect documentation WRT optional properties --- .../infrastructure/config/source/deezer.ts | 2 +- .../infrastructure/config/source/jellyfin.ts | 3 +++ .../infrastructure/config/source/spotify.ts | 2 +- .../infrastructure/config/source/vlc.ts | 2 +- src/backend/common/schema/aio-source.json | 23 +++++++++++-------- src/backend/common/schema/aio.json | 23 +++++++++++-------- src/backend/common/schema/source.json | 23 +++++++++++-------- 7 files changed, 48 insertions(+), 30 deletions(-) diff --git a/src/backend/common/infrastructure/config/source/deezer.ts b/src/backend/common/infrastructure/config/source/deezer.ts index 93832b55..23839b18 100644 --- a/src/backend/common/infrastructure/config/source/deezer.ts +++ b/src/backend/common/infrastructure/config/source/deezer.ts @@ -19,7 +19,7 @@ export interface DeezerData extends CommonSourceData { * @default "http://localhost:9078/deezer/callback" * @examples ["http://localhost:9078/deezer/callback"] * */ - redirectUri: string + redirectUri?: string /** * optional, how long to wait before calling spotify for new tracks (in seconds) * diff --git a/src/backend/common/infrastructure/config/source/jellyfin.ts b/src/backend/common/infrastructure/config/source/jellyfin.ts index 2ecfc02b..b3bd29bf 100644 --- a/src/backend/common/infrastructure/config/source/jellyfin.ts +++ b/src/backend/common/infrastructure/config/source/jellyfin.ts @@ -89,3 +89,6 @@ export interface JellyApiSourceConfig extends CommonSourceConfig { export interface JellyApiSourceAIOConfig extends JellyApiSourceConfig { type: 'jellyfin' } + + +export type JellyfinCompatConfig = JellyApiSourceConfig | JellySourceConfig; \ No newline at end of file diff --git a/src/backend/common/infrastructure/config/source/spotify.ts b/src/backend/common/infrastructure/config/source/spotify.ts index 742e0daf..6feae73e 100644 --- a/src/backend/common/infrastructure/config/source/spotify.ts +++ b/src/backend/common/infrastructure/config/source/spotify.ts @@ -20,7 +20,7 @@ export interface SpotifySourceData extends CommonSourceData, PollingOptions { * @default "http://localhost:9078/callback" * @examples ["http://localhost:9078/callback"] * */ - redirectUri: string + redirectUri?: string /** * How long to wait before polling the source API for new tracks (in seconds) * diff --git a/src/backend/common/infrastructure/config/source/vlc.ts b/src/backend/common/infrastructure/config/source/vlc.ts index 43261cfa..45f8caf3 100644 --- a/src/backend/common/infrastructure/config/source/vlc.ts +++ b/src/backend/common/infrastructure/config/source/vlc.ts @@ -25,7 +25,7 @@ export interface VLCSourceOptions extends CommonSourceOptions { * * Used when VLC reports only the filename for the current audio track * */ - filenamePatterns?: string[] + filenamePatterns?: string | string[] /** * Log to DEBUG when a filename-only track is matched or not matched by filenamePatterns * diff --git a/src/backend/common/schema/aio-source.json b/src/backend/common/schema/aio-source.json index 997e3bd5..a3417b09 100644 --- a/src/backend/common/schema/aio-source.json +++ b/src/backend/common/schema/aio-source.json @@ -374,8 +374,7 @@ }, "required": [ "clientId", - "clientSecret", - "redirectUri" + "clientSecret" ], "title": "DeezerData", "type": "object" @@ -2230,8 +2229,7 @@ }, "required": [ "clientId", - "clientSecret", - "redirectUri" + "clientSecret" ], "title": "SpotifySourceData", "type": "object" @@ -2507,12 +2505,19 @@ "type": "boolean" }, "filenamePatterns": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "string" + } + ], "description": "A list of regular expressions to use to extract metadata (title, album, artist) from a filename\n\nUsed when VLC reports only the filename for the current audio track", - "items": { - "type": "string" - }, - "title": "filenamePatterns", - "type": "array" + "title": "filenamePatterns" }, "logFilenamePatterns": { "default": false, diff --git a/src/backend/common/schema/aio.json b/src/backend/common/schema/aio.json index 2d15a1ae..d4ad4af6 100644 --- a/src/backend/common/schema/aio.json +++ b/src/backend/common/schema/aio.json @@ -651,8 +651,7 @@ }, "required": [ "clientId", - "clientSecret", - "redirectUri" + "clientSecret" ], "title": "DeezerData", "type": "object" @@ -3174,8 +3173,7 @@ }, "required": [ "clientId", - "clientSecret", - "redirectUri" + "clientSecret" ], "title": "SpotifySourceData", "type": "object" @@ -3451,12 +3449,19 @@ "type": "boolean" }, "filenamePatterns": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "string" + } + ], "description": "A list of regular expressions to use to extract metadata (title, album, artist) from a filename\n\nUsed when VLC reports only the filename for the current audio track", - "items": { - "type": "string" - }, - "title": "filenamePatterns", - "type": "array" + "title": "filenamePatterns" }, "logFilenamePatterns": { "default": false, diff --git a/src/backend/common/schema/source.json b/src/backend/common/schema/source.json index 7252576a..79e5d83d 100644 --- a/src/backend/common/schema/source.json +++ b/src/backend/common/schema/source.json @@ -425,8 +425,7 @@ }, "required": [ "clientId", - "clientSecret", - "redirectUri" + "clientSecret" ], "title": "DeezerData", "type": "object" @@ -2082,8 +2081,7 @@ }, "required": [ "clientId", - "clientSecret", - "redirectUri" + "clientSecret" ], "title": "SpotifySourceData", "type": "object" @@ -2335,12 +2333,19 @@ "type": "boolean" }, "filenamePatterns": { + "anyOf": [ + { + "items": { + "type": "string" + }, + "type": "array" + }, + { + "type": "string" + } + ], "description": "A list of regular expressions to use to extract metadata (title, album, artist) from a filename\n\nUsed when VLC reports only the filename for the current audio track", - "items": { - "type": "string" - }, - "title": "filenamePatterns", - "type": "array" + "title": "filenamePatterns" }, "logFilenamePatterns": { "default": false, -- 2.51.2