-
Notifications
You must be signed in to change notification settings - Fork 63
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
Tidy AbstractEvent internal properties #666
Conversation
snowplow-tracker/src/androidTest/java/com/snowplowanalytics/snowplow/event/AbstractEventTest.kt
Outdated
Show resolved
Hide resolved
entities?.let { customContexts.addAll(entities) } | ||
/** Replace the context entities attached to the event with a new list of entities. */ | ||
fun entities(entities: List<SelfDescribingJson>): AbstractEvent { | ||
this.entities = entities.toMutableList() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a bit of a coward and have a bad feeling about this 😅 On one hand, this looks like a builder function which usually replace the values, but going from a behaviour that is non-destructive (appending) to a destructive one (replacing) is a nasty breaking change. Nobody will notice this in the migration guide and it may lead to some very hard to find bugs with missing data.
I think I would prefer if we kept the Android behaviour and updated on iOS to append instead of replace. Other changes in this PR look good, I'd keep those. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair! I do think the API makes more sense as full replacement. But being cautious is good.
snowplow-tracker/src/main/java/com/snowplowanalytics/snowplow/event/AbstractEvent.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Breaking changes in the base
AbstractEvent
class, to standardise the API with the iOS tracker.