fix: PublicDeckOwner.pseudonym ist Bool, nicht String?
Beim Öffnen eines Marketplace-Decks crashed JSON-Decoder mit typeMismatch (Expected String, found Bool) auf owner.pseudonym. Ursache: Server-Schema (cards/apps/api/src/db/schema/marketplace/ authors.ts) hat pseudonym als `boolean NOT NULL DEFAULT false` — ein Flag, dass der Autor pseudonym auftritt (Anzeigename verbergen). Native hatte das fälschlich als String? (Anzeige-Pseudonym) interpretiert. Fix: - PublicDeckOwner.pseudonym: String? → Bool - decoder.decodeIfPresent(String.self) → decode(Bool.self) ?? false - Test-Fixture: "pseudonym": null → "pseudonym": false Build 3 → 4. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b5edf5cf2e
commit
f528ea448a
3 changed files with 10 additions and 6 deletions
|
|
@ -37,7 +37,11 @@ struct PublicDeckOwner: Codable, Hashable, Sendable {
|
|||
let displayName: String
|
||||
let verifiedMana: Bool
|
||||
let verifiedCommunity: Bool
|
||||
let pseudonym: String?
|
||||
/// Flag: Autor tritt pseudonym auf (Anzeigename verbergen).
|
||||
/// Server-Schema ist `boolean NOT NULL DEFAULT false`. War in v0.8.x
|
||||
/// fälschlich als `String?` (Anzeige-Pseudonym) interpretiert —
|
||||
/// führte zu Decoder-typeMismatch beim Öffnen eines Marketplace-Decks.
|
||||
let pseudonym: Bool
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case slug
|
||||
|
|
@ -53,7 +57,7 @@ struct PublicDeckOwner: Codable, Hashable, Sendable {
|
|||
displayName = try c.decode(String.self, forKey: .displayName)
|
||||
verifiedMana = try c.decode(Bool.self, forKey: .verifiedMana)
|
||||
verifiedCommunity = try c.decode(Bool.self, forKey: .verifiedCommunity)
|
||||
pseudonym = try c.decodeIfPresent(String.self, forKey: .pseudonym)
|
||||
pseudonym = (try? c.decode(Bool.self, forKey: .pseudonym)) ?? false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue