You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
decoding(Swift.DecodingError.keyNotFound(CodingKeys(stringValue: "transient", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: "transient", intValue: nil) ("transient").",
Transient should be option key for decoder in
public struct Traits: Codable, Sendable {
public let traits: [Trait]
public let identifier: String?
public let flags: [Flag]
public let transient: Bool?
init(traits: [Trait], identifier: String?, flags: [Flag] = [], transient: Bool = false) {
self.traits = traits
self.identifier = identifier
self.flags = flags
self.transient = transient
}
public func encode(to encoder: any Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(traits, forKey: .traits)
try container.encode(identifier, forKey: .identifier)
try container.encode(transient, forKey: .transient)
}
}
public struct Identity: Decodable, Sendable {
enum CodingKeys: String, CodingKey {
case flags
case traits
case transient
}
public let flags: [Flag]
public let traits: [Trait]
public let transient: Bool?
}
This needs fixing or the SDK won't work
The text was updated successfully, but these errors were encountered:
bukira
changed the title
CORE BUG in Decoder
Broken SDK CORE BUG in Decoder
Nov 18, 2024
Hi @bukira , I'm sorry but could you please be more descriptive here? From the description of this issue it's very hard for me to understand what the issue is.
Also, if you're willing to submit a PR, we'd gratefully receive it.
ok sorry I thought it was self explanatory with the fix posted
The SDK errors because the coding key transient is optional or null so it cannot decode it to a non null value, not sure how anyone else has ever got the SDK to work but it won decode Traits or Identity
This is the swift error
decoding(Swift.DecodingError.keyNotFound(CodingKeys(stringValue: "transient", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: "transient", intValue: nil) ("transient").",
The fix in Traits and Identity is to change this line
decoding(Swift.DecodingError.keyNotFound(CodingKeys(stringValue: "transient", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: "transient", intValue: nil) ("transient").",
Transient should be option key for decoder in
This needs fixing or the SDK won't work
The text was updated successfully, but these errors were encountered: