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

Tidy AbstractEvent internal properties #666

Merged
merged 2 commits into from
Jan 29, 2024

Conversation

mscwilson
Copy link
Contributor

Breaking changes in the base AbstractEvent class, to standardise the API with the iOS tracker.

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()
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@mscwilson mscwilson changed the title Match AbstractEvent entities API with iOS tracker Tidy AbstractEvent internal properties Jan 27, 2024
Copy link
Contributor

@matus-tomlein matus-tomlein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mscwilson mscwilson merged commit fbe62a0 into release/6.0.0 Jan 29, 2024
3 checks passed
@mscwilson mscwilson deleted the issue/standardise_entities branch January 29, 2024 08:49
@mscwilson mscwilson mentioned this pull request Feb 1, 2024
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

Successfully merging this pull request may close these issues.

2 participants