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 displayName: String
|
||||||
let verifiedMana: Bool
|
let verifiedMana: Bool
|
||||||
let verifiedCommunity: 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 {
|
enum CodingKeys: String, CodingKey {
|
||||||
case slug
|
case slug
|
||||||
|
|
@ -53,7 +57,7 @@ struct PublicDeckOwner: Codable, Hashable, Sendable {
|
||||||
displayName = try c.decode(String.self, forKey: .displayName)
|
displayName = try c.decode(String.self, forKey: .displayName)
|
||||||
verifiedMana = try c.decode(Bool.self, forKey: .verifiedMana)
|
verifiedMana = try c.decode(Bool.self, forKey: .verifiedMana)
|
||||||
verifiedCommunity = try c.decode(Bool.self, forKey: .verifiedCommunity)
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ struct MarketplaceDecodingTests {
|
||||||
"display_name": "mana-Kuratoren",
|
"display_name": "mana-Kuratoren",
|
||||||
"verified_mana": true,
|
"verified_mana": true,
|
||||||
"verified_community": false,
|
"verified_community": false,
|
||||||
"pseudonym": null
|
"pseudonym": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
""".data(using: .utf8)!
|
""".data(using: .utf8)!
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ targets:
|
||||||
path: Sources/Resources/Info.plist
|
path: Sources/Resources/Info.plist
|
||||||
properties:
|
properties:
|
||||||
CFBundleShortVersionString: "0.1.0"
|
CFBundleShortVersionString: "0.1.0"
|
||||||
CFBundleVersion: "3"
|
CFBundleVersion: "4"
|
||||||
CFBundleDevelopmentRegion: de
|
CFBundleDevelopmentRegion: de
|
||||||
CFBundleDisplayName: Cardecky
|
CFBundleDisplayName: Cardecky
|
||||||
LSApplicationCategoryType: "public.app-category.education"
|
LSApplicationCategoryType: "public.app-category.education"
|
||||||
|
|
@ -111,7 +111,7 @@ targets:
|
||||||
properties:
|
properties:
|
||||||
CFBundleDisplayName: Als Karte speichern
|
CFBundleDisplayName: Als Karte speichern
|
||||||
CFBundleShortVersionString: "0.1.0"
|
CFBundleShortVersionString: "0.1.0"
|
||||||
CFBundleVersion: "3"
|
CFBundleVersion: "4"
|
||||||
NSExtension:
|
NSExtension:
|
||||||
NSExtensionPointIdentifier: com.apple.share-services
|
NSExtensionPointIdentifier: com.apple.share-services
|
||||||
NSExtensionPrincipalClass: $(PRODUCT_MODULE_NAME).ShareViewController
|
NSExtensionPrincipalClass: $(PRODUCT_MODULE_NAME).ShareViewController
|
||||||
|
|
@ -144,7 +144,7 @@ targets:
|
||||||
properties:
|
properties:
|
||||||
CFBundleDisplayName: Cardecky Widget
|
CFBundleDisplayName: Cardecky Widget
|
||||||
CFBundleShortVersionString: "0.1.0"
|
CFBundleShortVersionString: "0.1.0"
|
||||||
CFBundleVersion: "3"
|
CFBundleVersion: "4"
|
||||||
NSExtension:
|
NSExtension:
|
||||||
NSExtensionPointIdentifier: com.apple.widgetkit-extension
|
NSExtensionPointIdentifier: com.apple.widgetkit-extension
|
||||||
entitlements:
|
entitlements:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue