Skip to content

Implement parsing fallback logic in @arborjs/json #140

@drborges

Description

@drborges

Often times, it's useful to rename classes to make their intent more clear as your application design evolves along with new requirements.

In order to allow applications to smoothly transition their serialized data model to new versions, it would be interesting to support parsing fallback logic that would allow @arborjs/json to deserialize data mapping it to the correct data type even when the serialized type is no longer available in runtime, due to renaming.

Ideas:

@serializableWithFallback("MyTodo", "NewTodo")
class Todo {
}

We could also look into providing a more generic decorator that would support various configuration options:

@serialize({
  as: "Todo",
  from: ["MyTodo", "NewTodo"]
})
class Todo {
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions