Skip to content

StreamEvent.parse: replace manual JSONSerialization with Codable #68

@2witstudios

Description

@2witstudios

Problem

StreamEvent.parse() manually deserializes JSON using JSONSerialization and casts through [String: Any] dictionaries. This is verbose, loses type safety, and silently swallows malformed data.

Location

apps/purepoint-macos/purepoint-macos/Models/StreamEvent.swiftparse() and its 4 private helper methods

Suggested Fix

Define Codable structs for the wire format and use JSONDecoder. The discriminated union pattern (switching on a type field) can be handled with a custom init(from:) on StreamEvent.

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions