Skip to content

Commit

Permalink
fix: Swift.DecodingError.keyNotFound when decoding Traits (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
khvn26 authored Nov 18, 2024
1 parent fcf746e commit 5caabcf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion FlagsmithClient/Classes/Identity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ public struct Identity: Decodable, Sendable {

public let flags: [Flag]
public let traits: [Trait]
public let transient: Bool
public let transient: Bool?
}
2 changes: 1 addition & 1 deletion FlagsmithClient/Classes/Trait.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public struct Trait: Codable, Sendable {
/// - note: In the future, this can be renamed back to 'value' as major/feature-breaking
/// updates are released.
public var typedValue: TypedValue
public let transient: Bool
public let transient: Bool?
/// The identity of the `Trait` when creating.
internal let identifier: String?

Expand Down
3 changes: 2 additions & 1 deletion FlagsmithClient/Classes/Traits.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public struct Traits: Codable, Sendable {
public let traits: [Trait]
public let identifier: String?
public let flags: [Flag]
public let transient: Bool
public let transient: Bool?

init(traits: [Trait], identifier: String?, flags: [Flag] = [], transient: Bool = false) {
self.traits = traits
Expand All @@ -30,3 +30,4 @@ public struct Traits: Codable, Sendable {
try container.encode(transient, forKey: .transient)
}
}

Check warning on line 33 in FlagsmithClient/Classes/Traits.swift

View workflow job for this annotation

GitHub Actions / swift-lint

Trailing Newline Violation: Files should have a single trailing newline (trailing_newline)

0 comments on commit 5caabcf

Please sign in to comment.