-
-
Notifications
You must be signed in to change notification settings - Fork 276
Deserialize and serialize unknown fields #2153
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
Merged
Merged
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
55fa42a
Add `unknown` map to `Breadcrumb`
denrase e227762
move unknown reading to helper function
denrase bb7feb6
Move unknown test data to mocks.dart
denrase 35bff66
Add `unknown` map to `DebugImage`
denrase 6b6ebf7
Add `unknown` map to `DebugMeta`
denrase c071d10
Add `unknown` map to `Mechanism`
denrase d07dbd4
Add `unknown` map to `MetricSummary`
denrase 7f87af9
Add `unknown` map to `SdkInfo `
denrase 0cd7479
Add `unknown` map to `SdkVersion`
denrase 7c1ba85
Add `unknown` map to `SentryApp`
denrase f42d993
Add `unknown` map to `SentryBrowser `
denrase 6a2449e
Add `unknown` map to `SentryCulture`
denrase ca57838
Add `unknown` map to `SentryDevice `
denrase 333b302
Add `unknown` map to `SentryEvent`
denrase f27e586
Add `unknown` map to `SentryException`
denrase d5f92f2
Add `unknown` map to `SentryGpu`
denrase 1924e07
Add `unknown` map to `SentryMessage `
denrase 1dc46f7
Add `unknown` map to `SentryOperatingSystem`
denrase f8def7f
Add `unknown` map to `SentryPackage`
denrase 8a2bff2
Add `unknown` map to `SentryRequest`
denrase 2aef9e9
Add `unknown` map to `SentryRuntime`
denrase 50b21c1
Add `unknown` map to `SentryStackFrame`
denrase afb78d0
Add `unknown` map to `SentryStackFrame`
denrase 7ef8109
Add `unknown` map to `SentryThread`
denrase ee6494a
Add `unknown` map to `SentryTraceContext`
denrase 33ea294
Add `unknown` map to `SentryTraceContextHeader`
denrase 934004e
Add `unknown` map to `SentryTransactionInf`
denrase fbb0fad
Add `unknown` map to `SentryUser`
denrase 7953f45
Add `unknown` map to `SentryUserFeedback`
denrase cf6e461
Add missing u param
denrase 42e7388
Merge branch 'main' into feat/unknown-serialization
denrase 41026d2
add changelog entry
denrase 6d7dd33
run dart fix
denrase 49341c1
add missing properties to SentryStackTrace copyWith
denrase 7a2dc8b
fix test
denrase 14588ad
add missing field
denrase 71a021e
Merge branch 'main' into feat/unknown-serialization
denrase 1aab0d4
Use spread operator to add unknown fields
denrase c5abedc
Keep track of unknwon keys via AccessAwareMap
denrase 565b780
Merge branch 'main' into feat/unknown-serialization
denrase f7ad96e
fix changelog
denrase a60c74c
early return for access aware map
denrase 91458ee
add tests for mapbase
denrase ef0d966
Merge branch 'main' into feat/unknown-serialization
denrase 294c0b2
fix cl
denrase 8471ec5
only track accessed keys with values, add unknown before other keys
denrase 2e5479c
Merge branch 'main' into feat/unknown-serialization
buenaflor cc0ac0f
Merge branch 'main' into feat/unknown-serialization
denrase 7171ae6
fix cl
denrase 3634f02
Merge branch 'main' into feat/unknown-serialization
denrase File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import 'dart:collection'; | ||
|
|
||
| import 'package:meta/meta.dart'; | ||
|
|
||
| @internal | ||
| class AccessAwareMap<String, V> extends MapBase<String, V> { | ||
| AccessAwareMap(this._map); | ||
|
|
||
| final Map<String, V> _map; | ||
| final Set<String> _accessedKeysWithValues = {}; | ||
|
|
||
| Set<String> get accessedKeysWithValues => _accessedKeysWithValues; | ||
|
|
||
| @override | ||
| V? operator [](Object? key) { | ||
| if (key is String && _map.containsKey(key)) { | ||
| _accessedKeysWithValues.add(key); | ||
| } | ||
| return _map[key]; | ||
| } | ||
|
|
||
| @override | ||
| void operator []=(String key, V value) { | ||
| _map[key] = value; | ||
| } | ||
|
|
||
| @override | ||
| void clear() { | ||
| _map.clear(); | ||
| _accessedKeysWithValues.clear(); | ||
| } | ||
|
|
||
| @override | ||
| Iterable<String> get keys => _map.keys; | ||
|
|
||
| @override | ||
| V? remove(Object? key) { | ||
| return _map.remove(key); | ||
| } | ||
|
|
||
| Map<String, dynamic>? notAccessed() { | ||
denrase marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (_accessedKeysWithValues.length == _map.length) { | ||
| return null; | ||
| } | ||
| Map<String, dynamic> unknown = _map.keys | ||
| .where((key) => !_accessedKeysWithValues.contains(key)) | ||
| .fold<Map<String, dynamic>>({}, (map, key) { | ||
| map[key] = _map[key]; | ||
| return map; | ||
| }); | ||
| return unknown.isNotEmpty ? unknown : null; | ||
| } | ||
| } | ||
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.