a2f1209d
json: drop unrecognized enum string names per proto3 spec
decode_enum returned the raw input string for unknown enum names,
which then propagated through the codec and errored at encode time
with "unknown enum value '...'". For repeated and map fields the
spec requires *dropping* the element (not substituting 0), so the
encoded output should be shorter than the input.
decode_enum now returns nil for unrecognized names. The optional /
repeated / map call sites in decode_message skip nil values: optional
leaves the field unset (encoded as default), repeated compacts the
array, map omits the entry. Numeric and known-name inputs are
unchanged.
Drops 5 entries from test/conformance/known_failures.txt:
IgnoreUnknownEnumStringValueIn{Optional,Repeated,RepeatedPart,
MapPart,MapValue}.
Eugene Blikh <bigbes@gmail.com> — 2026-05-15 21:22:27 UTC
Commit a2f1209d39dd42c812e515369ed21e39430048fb —
view raw patch
Parent(s):
1712192b
| File | Status | + | − |
|---|---|---|---|
runtime/pb/json.lua
|
M | +15 | -4 |
test/conformance/known_failures.txt
|
M | -5 |