ref(project): Skip serializing default fields#1887
Merged
Conversation
jjbayer
commented
Mar 1, 2023
| pub rules: Vec<String>, | ||
| /// When set to true, the outer rule is reported. | ||
| #[serde(default)] | ||
| #[serde(default, skip_serializing_if = "is_flag_default")] |
Member
Author
There was a problem hiding this comment.
#[serde(default)] has been here for 4 years, so every Relay should be able to handle the field's absence. I checked the age of the default functionality for the other fields as well.
iker-barriocanal
approved these changes
Mar 1, 2023
|
|
||
| impl Vars { | ||
| fn is_empty(&self) -> bool { | ||
| self.hash_key.is_none() |
Contributor
There was a problem hiding this comment.
Should we also consider post-trimmed empty strings as empty vars? In the tests below (from the diff), I only see hash_key being null.
Member
Author
There was a problem hiding this comment.
You might have more context than me here, when would hash_key be an empty string?
jan-auer
added a commit
that referenced
this pull request
Mar 2, 2023
* master: doc(py): Add changelog entries (#1900) fix(build): Run check when PR is ready for review (#1899) chore(project_local): Allow to follow symlinks for projects configs (#1891) ref(project): Skip serializing default fields (#1887) chore(build): Run changelog check for draft PRs (#1897) chore(sentry): Add environment config option (#1890) feat(scrubbing): Scrub `span.data.http.query` with default scrubbers (#1889)
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.
Some fields that are not being sent by Sentry when they are empty are serialized by Relay. Align with Sentry and do not serialize these fields if they have default values.
Why though?