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

[Recipe] Event deserialization and decoding #19

Open
slashdotdash opened this issue Dec 4, 2020 · 0 comments
Open

[Recipe] Event deserialization and decoding #19

slashdotdash opened this issue Dec 4, 2020 · 0 comments

Comments

@slashdotdash
Copy link
Member

How to deserialize events to their Elixir types.

Commanded uses JSON as the event data and metadata serialization format by default. This means that type information is lost when serializing Elixir structs to JSON and requires one to implement the Commanded.Serialization.JsonDecoder to decode strings to their actual Elixir type, such as DateTime.

One possible option for automatic deserialization would be to provide a typespec for the domain event structs and use the defined types to deserialize events. The Spec library provides structure decoding from a typespec and could be used via a custom event store serializer.

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