Commit 47dc31b
committed
fix: omit optional fields with default values from client JSON serialization
The JSON-RPC client serialization used alwaysPrintFieldsWithNoPresence()
which caused proto3 implicit-presence fields (taskId, contextId, tenant, etc.)
to be serialized as empty strings instead of being omitted.
Removed alwaysPrintFieldsWithNoPresence() from JsonFormat.printer() in
JSONRPCUtils.toJsonRPCRequest() (client requests only), aligning with the
REST client transport which already omitted it.
This fixes #7701 parent d1578d3 commit 47dc31b
2 files changed
Lines changed: 16 additions & 50 deletions
File tree
- client/transport/jsonrpc/src/test/java/io/a2a/client/transport/jsonrpc
- spec-grpc/src/main/java/io/a2a/grpc/utils
Lines changed: 11 additions & 48 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
| 96 | + | |
100 | 97 | | |
101 | 98 | | |
102 | 99 | | |
| |||
143 | 140 | | |
144 | 141 | | |
145 | 142 | | |
146 | | - | |
147 | | - | |
148 | | - | |
| 143 | + | |
149 | 144 | | |
150 | 145 | | |
151 | 146 | | |
152 | 147 | | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
| 148 | + | |
158 | 149 | | |
159 | 150 | | |
160 | 151 | | |
| |||
192 | 183 | | |
193 | 184 | | |
194 | 185 | | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
| 186 | + | |
199 | 187 | | |
200 | 188 | | |
201 | 189 | | |
202 | 190 | | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
| 191 | + | |
208 | 192 | | |
209 | 193 | | |
210 | 194 | | |
| |||
376 | 360 | | |
377 | 361 | | |
378 | 362 | | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
| 363 | + | |
383 | 364 | | |
384 | 365 | | |
385 | 366 | | |
386 | 367 | | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
391 | | - | |
| 368 | + | |
392 | 369 | | |
393 | 370 | | |
394 | 371 | | |
| |||
443 | 420 | | |
444 | 421 | | |
445 | 422 | | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
| 423 | + | |
450 | 424 | | |
451 | 425 | | |
452 | 426 | | |
453 | 427 | | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
458 | | - | |
| 428 | + | |
459 | 429 | | |
460 | 430 | | |
461 | 431 | | |
| |||
514 | 484 | | |
515 | 485 | | |
516 | 486 | | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
| 487 | + | |
521 | 488 | | |
522 | 489 | | |
523 | 490 | | |
524 | 491 | | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
| 492 | + | |
530 | 493 | | |
531 | 494 | | |
532 | 495 | | |
| |||
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
174 | 177 | | |
175 | 178 | | |
176 | 179 | | |
| |||
556 | 559 | | |
557 | 560 | | |
558 | 561 | | |
559 | | - | |
| 562 | + | |
560 | 563 | | |
561 | 564 | | |
562 | 565 | | |
| |||
579 | 582 | | |
580 | 583 | | |
581 | 584 | | |
582 | | - | |
| 585 | + | |
583 | 586 | | |
584 | 587 | | |
585 | 588 | | |
| |||
0 commit comments