Commit c08debc
fix: recurse into JSON-native containers in A2A _serialize_value()
The previous change passed `dict` and `list` values through
`_serialize_value()` unchanged. A non-JSON-serializable value nested inside one
of those containers (e.g. a `datetime`, `uuid.UUID`, or a nested Pydantic
model) was therefore returned raw. That is inconsistent with the stated intent
that only non-JSON-serializable types are stringified, and it risks a
`TypeError` when the A2A metadata is later JSON-encoded.
Recurse into `dict` and `list` elements so nested non-JSON-serializable values
are still stringified, while JSON-native scalars continue to pass through as-is.
Co-authored-by: Haran Rajkumar <haranrk@google.com>
PiperOrigin-RevId: 9350439021 parent 25d666a commit c08debc
2 files changed
Lines changed: 47 additions & 2 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 | | - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
264 | 275 | | |
265 | 276 | | |
266 | 277 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
0 commit comments