diff --git a/Sources/SwiftAPIClient/Extensions/URLComponentBuilder.swift b/Sources/SwiftAPIClient/Extensions/URLComponentBuilder.swift index b540070..2fe7424 100644 --- a/Sources/SwiftAPIClient/Extensions/URLComponentBuilder.swift +++ b/Sources/SwiftAPIClient/Extensions/URLComponentBuilder.swift @@ -71,7 +71,7 @@ public extension URLComponentBuilder { /// - percentEncoded: A Boolean to determine whether to percent encode the components. Default is `false`. /// - Returns: An instance with updated path. func path(_ components: any CustomStringConvertible..., percentEncoded: Bool = false) -> BuildResult { - path(components, percentEncoded: percentEncoded) + path(components.map(\.description), percentEncoded: percentEncoded) } /// Appends an array of path components to the URL. @@ -79,7 +79,7 @@ public extension URLComponentBuilder { /// - components: An array of components that conform to `CustomStringConvertible`. /// - percentEncoded: A Boolean to determine whether to percent encode the components. Default is `false`. /// - Returns: An instance with updated path. - func path(_ components: [any CustomStringConvertible], percentEncoded: Bool = false) -> BuildResult { + func path(_ components: [T], percentEncoded: Bool = false) -> BuildResult { configureURLComponents { guard !components.isEmpty else { return } let items = components.flatMap { diff --git a/Sources/SwiftAPIClient/Modifiers/RequestModifiers.swift b/Sources/SwiftAPIClient/Modifiers/RequestModifiers.swift index fc8e92d..2466b87 100644 --- a/Sources/SwiftAPIClient/Modifiers/RequestModifiers.swift +++ b/Sources/SwiftAPIClient/Modifiers/RequestModifiers.swift @@ -23,7 +23,7 @@ public extension RequestBuilder where Request == HTTPRequestComponents { /// - percentEncoded: A Boolean to determine whether to percent encode the components. Default is `false`. /// - Returns: An instance with updated path. func path(_ components: any CustomStringConvertible..., percentEncoded: Bool = false) -> Self { - path(components, percentEncoded: percentEncoded) + path(components.map(\.description), percentEncoded: percentEncoded) } /// Appends an array of path components to the URL of the request. @@ -31,7 +31,7 @@ public extension RequestBuilder where Request == HTTPRequestComponents { /// - components: An array of components that conform to `CustomStringConvertible`. /// - percentEncoded: A Boolean to determine whether to percent encode the components. Default is `false`. /// - Returns: An instance with updated path. - func path(_ components: [any CustomStringConvertible], percentEncoded: Bool = false) -> Self { + func path(_ components: [T], percentEncoded: Bool = false) -> Self { modifyRequest { $0 = $0.path(components, percentEncoded: percentEncoded) }