798e8db9
json,text: presence-tracked fields skip proto3 default elision
Both codecs gated default-value elision on `f.optional or f.oneof` —
the proto3 implicit-presence shape. That elides proto2 `required`
fields set to zero and any other presence-tracked descriptor that
doesn't carry the proto3 explicit-optional flag.
Extend the bypass to `f.required` so a Cardinality{r=0} survives
the round-trip through pb.json.encode / pb.text.encode. 4 new
luatest cases pin the rule.
Eugene Blikh <bigbes@gmail.com> — 2026-05-17 05:13:06 UTC
Commit 798e8db974f929988200e49ada81076b406a50bd —
view raw patch
Parent(s):
4db0366a
| File | Status | + | − |
|---|---|---|---|
runtime/pb/json.lua
|
M | +7 | -1 |
runtime/pb/text.lua
|
M | +4 | -1 |
test/proto2_test.lua
|
M | +36 |