3636public struct OpenAPIValueContainer : Codable , Equatable , Hashable , Sendable {
3737
3838 /// The underlying dynamic value.
39- public var value : Sendable ?
39+ public var value : ( any Sendable ) ?
4040
4141 /// Creates a new container with the given validated value.
4242 /// - Parameter value: A value of a JSON-compatible type, such as `String`,
4343 /// `[Any]`, and `[String: Any]`.
44- init ( validatedValue value: Sendable ? ) {
44+ init ( validatedValue value: ( any Sendable ) ? ) {
4545 self . value = value
4646 }
4747
@@ -62,7 +62,7 @@ public struct OpenAPIValueContainer: Codable, Equatable, Hashable, Sendable {
6262 /// - Parameter value: An untyped value.
6363 /// - Returns: A cast value if supported.
6464 /// - Throws: When the value is not supported.
65- static func tryCast( _ value: ( any Sendable ) ? ) throws -> Sendable ? {
65+ static func tryCast( _ value: ( any Sendable ) ? ) throws -> ( any Sendable ) ? {
6666 guard let value = value else {
6767 return nil
6868 }
@@ -98,7 +98,7 @@ public struct OpenAPIValueContainer: Codable, Equatable, Hashable, Sendable {
9898
9999 // MARK: Decodable
100100
101- public init ( from decoder: Decoder ) throws {
101+ public init ( from decoder: any Decoder ) throws {
102102 let container = try decoder. singleValueContainer ( )
103103 if container. decodeNil ( ) {
104104 self . init ( validatedValue: nil )
@@ -124,7 +124,7 @@ public struct OpenAPIValueContainer: Codable, Equatable, Hashable, Sendable {
124124
125125 // MARK: Encodable
126126
127- public func encode( to encoder: Encoder ) throws {
127+ public func encode( to encoder: any Encoder ) throws {
128128 var container = encoder. singleValueContainer ( )
129129 guard let value = value else {
130130 try container. encodeNil ( )
@@ -171,15 +171,15 @@ public struct OpenAPIValueContainer: Codable, Equatable, Hashable, Sendable {
171171 return lhs == rhs
172172 case let ( lhs as String , rhs as String ) :
173173 return lhs == rhs
174- case let ( lhs as [ Sendable ? ] , rhs as [ Sendable ? ] ) :
174+ case let ( lhs as [ ( any Sendable ) ? ] , rhs as [ ( any Sendable ) ? ] ) :
175175 guard lhs. count == rhs. count else {
176176 return false
177177 }
178178 return zip ( lhs, rhs)
179179 . allSatisfy { lhs, rhs in
180180 OpenAPIValueContainer ( validatedValue: lhs) == OpenAPIValueContainer ( validatedValue: rhs)
181181 }
182- case let ( lhs as [ String : Sendable ? ] , rhs as [ String : Sendable ? ] ) :
182+ case let ( lhs as [ String : ( any Sendable ) ? ] , rhs as [ String : ( any Sendable ) ? ] ) :
183183 guard lhs. count == rhs. count else {
184184 return false
185185 }
@@ -211,11 +211,11 @@ public struct OpenAPIValueContainer: Codable, Equatable, Hashable, Sendable {
211211 hasher. combine ( value)
212212 case let value as String :
213213 hasher. combine ( value)
214- case let value as [ Sendable ] :
214+ case let value as [ any Sendable ] :
215215 for item in value {
216216 hasher. combine ( OpenAPIValueContainer ( validatedValue: item) )
217217 }
218- case let value as [ String : Sendable ] :
218+ case let value as [ String : any Sendable ] :
219219 for (key, itemValue) in value {
220220 hasher. combine ( key)
221221 hasher. combine ( OpenAPIValueContainer ( validatedValue: itemValue) )
@@ -281,11 +281,11 @@ extension OpenAPIValueContainer: ExpressibleByFloatLiteral {
281281public struct OpenAPIObjectContainer : Codable , Equatable , Hashable , Sendable {
282282
283283 /// The underlying dynamic dictionary value.
284- public var value : [ String : Sendable ? ]
284+ public var value : [ String : ( any Sendable ) ? ]
285285
286286 /// Creates a new container with the given validated dictionary.
287287 /// - Parameter value: A dictionary value.
288- init ( validatedValue value: [ String : Sendable ? ] ) {
288+ init ( validatedValue value: [ String : ( any Sendable ) ? ] ) {
289289 self . value = value
290290 }
291291
@@ -311,21 +311,21 @@ public struct OpenAPIObjectContainer: Codable, Equatable, Hashable, Sendable {
311311 /// - Parameter value: A dictionary with untyped values.
312312 /// - Returns: A cast dictionary if values are supported.
313313 /// - Throws: If an unsupported value is found.
314- static func tryCast( _ value: [ String : Any ? ] ) throws -> [ String : Sendable ? ] {
314+ static func tryCast( _ value: [ String : Any ? ] ) throws -> [ String : ( any Sendable ) ? ] {
315315 return try value. mapValues ( OpenAPIValueContainer . tryCast ( _: ) )
316316 }
317317
318318 // MARK: Decodable
319319
320- public init ( from decoder: Decoder ) throws {
320+ public init ( from decoder: any Decoder ) throws {
321321 let container = try decoder. singleValueContainer ( )
322322 let item = try container. decode ( [ String : OpenAPIValueContainer ] . self)
323323 self . init ( validatedValue: item. mapValues ( \. value) )
324324 }
325325
326326 // MARK: Encodable
327327
328- public func encode( to encoder: Encoder ) throws {
328+ public func encode( to encoder: any Encoder ) throws {
329329 var container = encoder. singleValueContainer ( )
330330 try container. encode ( value. mapValues ( OpenAPIValueContainer . init ( validatedValue: ) ) )
331331 }
@@ -385,11 +385,11 @@ public struct OpenAPIObjectContainer: Codable, Equatable, Hashable, Sendable {
385385public struct OpenAPIArrayContainer : Codable , Equatable , Hashable , Sendable {
386386
387387 /// The underlying dynamic array value.
388- public var value : [ Sendable ? ]
388+ public var value : [ ( any Sendable ) ? ]
389389
390390 /// Creates a new container with the given validated array.
391391 /// - Parameter value: An array value.
392- init ( validatedValue value: [ Sendable ? ] ) {
392+ init ( validatedValue value: [ ( any Sendable ) ? ] ) {
393393 self . value = value
394394 }
395395
@@ -414,21 +414,21 @@ public struct OpenAPIArrayContainer: Codable, Equatable, Hashable, Sendable {
414414 /// Returns the specified value cast to an array of supported values.
415415 /// - Parameter value: An array with untyped values.
416416 /// - Returns: A cast value if values are supported, nil otherwise.
417- static func tryCast( _ value: [ Any ? ] ) throws -> [ Sendable ? ] {
417+ static func tryCast( _ value: [ Any ? ] ) throws -> [ ( any Sendable ) ? ] {
418418 return try value. map ( OpenAPIValueContainer . tryCast ( _: ) )
419419 }
420420
421421 // MARK: Decodable
422422
423- public init ( from decoder: Decoder ) throws {
423+ public init ( from decoder: any Decoder ) throws {
424424 let container = try decoder. singleValueContainer ( )
425425 let item = try container. decode ( [ OpenAPIValueContainer ] . self)
426426 self . init ( validatedValue: item. map ( \. value) )
427427 }
428428
429429 // MARK: Encodable
430430
431- public func encode( to encoder: Encoder ) throws {
431+ public func encode( to encoder: any Encoder ) throws {
432432 var container = encoder. singleValueContainer ( )
433433 try container. encode ( value. map ( OpenAPIValueContainer . init ( validatedValue: ) ) )
434434 }
0 commit comments