8000 feature request: Better tolerance for missing fields in derived hydrate for forward-compatibility · Issue #52 · automerge/autosurgeon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
feature request: Better tolerance for missing fields in derived hydrate for forward-compatibility #52
Open
@aran

Description

@aran

If I have a struct TOld and add a field to my code to make TNew, I may want to hydrate a TOld into a TNew.

As a concrete example, if I add a new Option<X> field, (perhaps configurably) it should treat missing field as a None.
If I add a field that has implements Default I could also see it treating a missing field as that ::default().

Currently the Hydrate implementation for Option throws an Unexpected when a field is missing.

Quick notes:

  • There's lots of decisions needed in how the API could look for this
  • I think in general this kind of forward-compatibility should be doable if semantically TOld is a subtype of TNew (Liskov substitutable)
  • Thinking about forward-compatibility obviously raises the idea of push-safety / backward compatibility, which would suggest explicitly doing the opposite of Autosurgeon reconcile not clearing all old data #46 so old code could still read new documents. I believe changes are backward compatible if TNew is a subtype of TOld.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0