From 156d1a580873ab3cb7ed95775bcbeb95ee2f1554 Mon Sep 17 00:00:00 2001 From: Javier Cicchelli Date: Fri, 27 Mar 2026 17:44:58 +0100 Subject: [PATCH] Removed the force-unwrapped inside the "init(transport:)" initializer for the AmiiboLiveClient client in the library target. --- .../AmiiboService/Public/Clients/AmiiboLiveClient.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Sources/AmiiboService/Public/Clients/AmiiboLiveClient.swift b/Sources/AmiiboService/Public/Clients/AmiiboLiveClient.swift index 08be7f7..0ba560b 100644 --- a/Sources/AmiiboService/Public/Clients/AmiiboLiveClient.swift +++ b/Sources/AmiiboService/Public/Clients/AmiiboLiveClient.swift @@ -29,9 +29,12 @@ public struct AmiiboLiveClient: Sendable { /// Initializes this client with a transport for performing HTTP operations. /// - Parameter transport: A transport that performs HTTP operations. Defaults to a `URLSessionTransport` using the shared session. public init(transport: any ClientTransport = URLSessionTransport()) { + guard let serverURL = try? Servers.Server1.url() else { + fatalError("The server URL defined in the OpenAPI specification could not be resolved. Verify that the 'openapi.yaml' server definition is valid.") + } + self.client = .init( - // The force unwrapping implemented below assumes that the server definition from the OpenAPI specification is correct. - serverURL: try! Servers.Server1.url(), + serverURL: serverURL, configuration: .init(dateTranscoder: ISOTimestampTranscoder()), transport: transport )