Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement parsing fallback logic in @arborjs/json #140

Open
drborges opened this issue Nov 2, 2024 · 0 comments
Open

Implement parsing fallback logic in @arborjs/json #140

drborges opened this issue Nov 2, 2024 · 0 comments

Comments

@drborges
Copy link
Owner

drborges commented Nov 2, 2024

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 {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant