Commit 139c700
fix: preserve JSON-native types in A2A _serialize_value()
`_serialize_value()` in `from_adk_event.py` was calling `str()` on all
non-Pydantic values, which corrupted JSON-native metadata types (`dict`,
`list`, `int`, `float`, `bool`) into their Python string representations
during A2A event conversion.
Before: `{"count": 42}` became `{"count": "42"}` and `{"tags": ["a", "b"]}`
became `{"tags": "['a', 'b']"}`.
After: JSON-native types (`dict`, `list`, `int`, `float`, `bool`, `str`) are
passed through as-is. Only non-JSON-serializable types (e.g. `datetime`) are
still stringified.
Closes #5183
Co-authored-by: Haran Rajkumar <haranrk@google.com>
PiperOrigin-RevId: 9344961311 parent ee79e71 commit 139c700
2 files changed
Lines changed: 53 additions & 0 deletions
File tree
- src/google/adk/a2a/converters
- tests/unittests/a2a/converters
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
259 | 259 | | |
260 | 260 | | |
261 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
262 | 266 | | |
263 | 267 | | |
264 | 268 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
0 commit comments