Repository navigation
Commit a4db08d
committed
Preserve proto3 field presence for falsy values in REST/gRPC conversion
Three spots in conversions/conversion.py lost information for legitimately
falsy values when converting between the REST and gRPC models:
- ScoredPoint/Record: a shard_key of 0 or an order_value of 0/0.0 was
dropped by a truthiness check (`if model.shard_key`), so it never made it
into the gRPC message. Check `is not None` instead.
- IntegerIndexParams: `range` and `lookup` are optional bools but were read
without a HasField guard, so an unset field turned into False instead of
None, silently overriding the server-side default.
- SparseVectorParams: the index guard was `HasField("index") is not None`,
which is always true since HasField returns a bool, so an empty
SparseIndexParams was fabricated even when no index was configured.
Added regression tests covering all three.1 parent b4713cd commit a4db08d
2 files changed
Lines changed: 76 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1594 | 1594 | | |
1595 | 1595 | | |
1596 | 1596 | | |
1597 | | - | |
1598 | | - | |
| 1597 | + | |
| 1598 | + | |
1599 | 1599 | | |
1600 | 1600 | | |
1601 | 1601 | | |
| |||
2155 | 2155 | | |
2156 | 2156 | | |
2157 | 2157 | | |
2158 | | - | |
2159 | | - | |
2160 | | - | |
| 2158 | + | |
2161 | 2159 | | |
2162 | 2160 | | |
2163 | 2161 | | |
| |||
3092 | 3090 | | |
3093 | 3091 | | |
3094 | 3092 | | |
3095 | | - | |
3096 | | - | |
| 3093 | + | |
| 3094 | + | |
| 3095 | + | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
| 3100 | + | |
3097 | 3101 | | |
3098 | 3102 | | |
3099 | 3103 | | |
| |||
3558 | 3562 | | |
3559 | 3563 | | |
3560 | 3564 | | |
3561 | | - | |
3562 | | - | |
| 3565 | + | |
| 3566 | + | |
| 3567 | + | |
| 3568 | + | |
| 3569 | + | |
| 3570 | + | |
| 3571 | + | |
| 3572 | + | |
3563 | 3573 | | |
3564 | 3574 | | |
3565 | 3575 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
0 commit comments