Commit 5d34264
authored
feat(rust-only): better tolerate malformed optional fields in deserialization (#1006)
* feat(rust-only): better tolerate malformed optional fields in deserialization
Use `serde_with` helpers to default invalid optional values and
skip bad vector entries across protocol types.
Sometimes agents or clients send something not quite right. If it is an
optional field, we can fallback to best-effort and retain as much
information as possible without losing everything.
* Apply `skip_serializing_none` across protocol structs so optional
fields are omitted consistently.
* Add optional tracing for skipped list entries
Introduce a `tracing` feature that logs `VecSkipError` drops via a
shared `SkipListener` inspector, while remaining a zero-cost no-op
when the feature is disabled.
Also add tests covering inspector callbacks for malformed entries.
* Make List Deserialization Fall Back to Defaults
Wrap list deserializers with `DefaultOnError` so invalid outer
shapes default instead of failing, while still skipping invalid
elements inside valid arrays.1 parent 34c5176 commit 5d34264
File tree
14 files changed
+1193
-310
lines changed- src
14 files changed
+1193
-310
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
48 | 53 | | |
49 | 54 | | |
50 | 55 | | |
| |||
55 | 60 | | |
56 | 61 | | |
57 | 62 | | |
| 63 | + | |
58 | 64 | | |
| 65 | + | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
Large diffs are not rendered by default.
0 commit comments