Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows inheritance on the client side. This was the behaviour available with Objc version of the SDK and one I could not find any drawbacks of in the current state of the SDK. Being able to inherit allows the use of type's init while preserving
SelfDescribingJson
identity. This allows to put subclasses in place ofSelfDescribingJson
and still preserve types.I've also checked that making
SelfDescribing
open
works just as fine, though, it does require making a few helper typesopen
as well. However, I haven't found similar applications forSelfDescribing
as forSelfDescribingJson
that would justify these side-effects. Hence, it's not included in this PR.Example
Take a look at the wrapper I've been using for LinkClick events:
It provides static type safety and ease of setting necessary parameters. At the same time I'm using event assemblies like this:
to separately generate payload and contexts and assemble them only later when needed.
This allows having access to individual parts of event(payload and contexts), differentiating events with dynamic type casting if needed in rare circumstances and all with an extremely lightweight syntax.
This can be partially replicated with global/static functions, but it will be much more cumbersome and there will be no way to have different types under
SelfDescribingJson
parent.