Commit 09252f7
committed
fix(wire-shape): validator now discovers unannotated Jackson fields
The Java validator's source-discovery only saw fields with
@JsonProperty(...) annotations. Many Java SDK POJOs declare fields
without the annotation and rely on Jackson's default name-mapping
(which works correctly when the Java field name matches the wire
key — `id`, `threshold`, `message`, `name`, etc.). The validator
under-counted SDK fields in those cases.
Three changes to lib.py:
- _FIELD_DECL_RE matches plain field declarations:
modifier-prefix + type-expression + field-name + `;`/`=`. Captures
the modifier sequence so the next change can post-filter.
- Filter out declarations whose modifier sequence contains `static`
(those are class-level constants — never wire-serialized).
- _extract_types_from_java now collects both annotated (@JsonProperty)
AND plain field decls. Each plain field's "claim" on a preceding
@JsonProperty within a 250-char lookback window is consumed —
whichever annotation/field pair is closest. Annotation wins on
the wire-name when a field is annotated; field name is used
directly when the field is unannotated.
Synthetic tests cover:
- Mixed annotated + unannotated POJO (BudgetAlert pattern)
- `private static final String CONST = "..."` excluded
- Methods (have `(`) excluded
- Generics like `Map<String, Object>` and `List<String>`
- Record params with `@JsonProperty`
- Class with both constants and fields
Effect on Java SDK baseline:
- registered_types: 70 → 73 (3 types newly visible; previously had
no @JsonProperty annotations so the validator skipped them)
- per_type_drift: 37 → 39 (newly visible types surfaced 2 more
drift entries; previously hidden coverage gaps)
The drift increase is the validator working correctly for the
first time — the previous count was an under-measurement, not a
real "no drift" signal.1 parent 489096a commit 09252f7
2 files changed
Lines changed: 122 additions & 54 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
57 | 85 | | |
58 | 86 | | |
59 | 87 | | |
| |||
258 | 286 | | |
259 | 287 | | |
260 | 288 | | |
261 | | - | |
| 289 | + | |
262 | 290 | | |
263 | 291 | | |
264 | 292 | | |
265 | 293 | | |
266 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
267 | 341 | | |
268 | 342 | | |
269 | 343 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
206 | 208 | | |
207 | | - | |
208 | | - | |
209 | 209 | | |
210 | | - | |
211 | | - | |
212 | 210 | | |
213 | 211 | | |
214 | 212 | | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | 213 | | |
223 | 214 | | |
224 | 215 | | |
| |||
260 | 251 | | |
261 | 252 | | |
262 | 253 | | |
263 | | - | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | 254 | | |
270 | | - | |
271 | | - | |
272 | | - | |
| 255 | + | |
273 | 256 | | |
274 | 257 | | |
275 | 258 | | |
| |||
283 | 266 | | |
284 | 267 | | |
285 | 268 | | |
| 269 | + | |
286 | 270 | | |
287 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
288 | 275 | | |
289 | 276 | | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
| 277 | + | |
298 | 278 | | |
299 | 279 | | |
300 | 280 | | |
| |||
427 | 407 | | |
428 | 408 | | |
429 | 409 | | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
430 | 419 | | |
431 | 420 | | |
432 | 421 | | |
| |||
446 | 435 | | |
447 | 436 | | |
448 | 437 | | |
449 | | - | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
450 | 441 | | |
451 | 442 | | |
452 | 443 | | |
| |||
462 | 453 | | |
463 | 454 | | |
464 | 455 | | |
465 | | - | |
466 | | - | |
| 456 | + | |
467 | 457 | | |
468 | 458 | | |
469 | 459 | | |
| |||
482 | 472 | | |
483 | 473 | | |
484 | 474 | | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
492 | | - | |
493 | 475 | | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
| 476 | + | |
498 | 477 | | |
499 | 478 | | |
500 | 479 | | |
| |||
517 | 496 | | |
518 | 497 | | |
519 | 498 | | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
520 | 508 | | |
521 | 509 | | |
| 510 | + | |
522 | 511 | | |
523 | 512 | | |
524 | 513 | | |
525 | | - | |
526 | | - | |
527 | | - | |
| 514 | + | |
528 | 515 | | |
529 | 516 | | |
530 | 517 | | |
531 | 518 | | |
532 | | - | |
533 | | - | |
| 519 | + | |
534 | 520 | | |
535 | 521 | | |
536 | 522 | | |
537 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
538 | 526 | | |
539 | 527 | | |
540 | 528 | | |
541 | | - | |
542 | 529 | | |
543 | | - | |
544 | | - | |
545 | 530 | | |
546 | 531 | | |
547 | 532 | | |
548 | 533 | | |
549 | 534 | | |
550 | 535 | | |
551 | 536 | | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
552 | 543 | | |
553 | 544 | | |
554 | 545 | | |
| |||
608 | 599 | | |
609 | 600 | | |
610 | 601 | | |
| 602 | + | |
611 | 603 | | |
612 | 604 | | |
613 | 605 | | |
614 | 606 | | |
615 | 607 | | |
616 | 608 | | |
| 609 | + | |
617 | 610 | | |
618 | 611 | | |
619 | 612 | | |
| |||
627 | 620 | | |
628 | 621 | | |
629 | 622 | | |
| 623 | + | |
630 | 624 | | |
631 | 625 | | |
632 | 626 | | |
| |||
0 commit comments