Strip empty strings from optional media player entity fields#1474
Merged
Jack Keene (Jack-Keene) merged 4 commits intoMay 22, 2026
Conversation
Matus Tomlein (matus-tomlein)
approved these changes
May 20, 2026
Contributor
Matus Tomlein (matus-tomlein)
left a comment
There was a problem hiding this comment.
LGTM but please update the PR title and description to give more context on exactly what changed and why.
Matus Tomlein (matus-tomlein)
approved these changes
May 22, 2026
Matus Tomlein (matus-tomlein)
pushed a commit
that referenced
this pull request
May 22, 2026
* explicitly remove optional properties from media entity
Merged
Matus Tomlein (matus-tomlein)
pushed a commit
that referenced
this pull request
May 22, 2026
* explicitly remove optional properties from media entity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The media_player entity (iglu:com.snowplowanalytics.snowplow/media_player/jsonschema/2-0-0) can produce inconsistent values for optional string fields (label, playerType, quality). The
removeEmptyPropertiesfunction inbrowser-plugin-media/src/core.tsstrips null and undefined but passes through empty strings "". This means callers supplying "" where undefined is intended produce events where the field is present but empty, rather than absent.Downstream, the dbt media player package treats "" and NULL as distinct values. When the same media content generates events with both representations, it produces different surrogate keys for media_identifier, causing merge conflicts and duplicate rows in aggregated models.
Fix
Added a stripEmptyStrings option to removeEmptyProperties, enabled only for buildMediaPlayerEntity. This keeps the change scoped to the media player entity — other entity builders (ad, ad break, session, event) are unaffected.
When stripEmptyStrings is true, empty string values are filtered out alongside null/undefined, so optional string fields that are "" are omitted from the payload entirely (equivalent to NULL in the warehouse).