automerge / automerge-swift

Swift language bindings presenting Automerge

Home Page:https://automerge.org/automerge-swift/documentation/automerge/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

updated AutomergeText (as reference type) isn't always encoding correctly

heckj opened this issue · comments

Working with demo app code, and on decode of existing files I'm getting the following generic error on file load

error: The data couldn’t be read because it is missing.

Adding more detailed logging, it appears as though a key is missing from the Automerge doc:

Key 'CodingKeys(stringValue: "discussion", intValue: nil)' not found: No value associated with key CodingKeys(stringValue: "discussion", intValue: nil) ("discussion").
codingPath: [CodingKeys(stringValue: "agendas", intValue: nil), [0]]

And dumping the raw automerge content using a CLI tool shows that is indeed the case:

{
  "agendas" : {
    [
      "id" :String(DD1E2812-0280-48CF-9FBD-12B6124E40B1)
      "title" :String(agenda item 1)
    ]
  }
  "attendees" : {
    []
  }
  "title" :String(Example Meeting ...)
}

The "agendas" should each have an id (UUID), title (String), and discussion (AutomergeText) - but the text content isn't included within the encoded results, and what had been there previously was removed/the file corrupted for decoding with this model.