Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously we were deserializing step data based on the T provided by the compiler. However, this could be lossy if the step data was actually a subclass of T with additional fields and is semantically incorrect if we try to deserialize it as the parent class. To remedy this, we need to know what the actual class of the step data was before it was memoized with the Inngest server. We are adding this as an additional field `class` on the JSON when serializing, then reading (and deleting) this field and using it with reflection to deserialize using the proper class. It might make sense to put the field `class` in some kind of meta/extension section of the payload to avoid conflict, but it's highly unlikely a field will legitimately be named class in the user code since it is a reserved keyword in Java. This strategy doesn't entirely work for schema evolution because it's still possible the classes have changed to the point where deserialization would fail. We should follow up here and probably have a fallback mechanism of returning a generic hash if deserialization fails.
- Loading branch information