b1273f1b
json: canonical lowerCamelCase + NullValue WKT descriptor
Two unrelated JSON-decoder gaps captured under the conformance triage:
1. to_camel's gsub pattern '_(%w)' didn't match consecutive underscores
and didn't drop trailing underscores, so proto names like
__field_name13 / field__name4_ / field_name17__ generated JSON keys
that didn't match what protoc produces. The fix strips trailing _+
and collapses '_+%w' to a capitalized letter; a leading underscore
thus capitalizes the next character, matching the spec.
2. pb.wkt didn't export a descriptor for google.protobuf.NullValue, so
any enum field whose type is NullValue (oneof_null_value, or the
implicit one inside Value) crashed decode_enum with "attempt to
index a nil value." Adds a minimal {by_name, by_value} descriptor.
Drops 3 entries from test/conformance/known_failures.txt
(FieldNameInSnakeCase, FieldNameWithDoubleUnderscores,
NullValueInOtherOneofOldFormat). Adds 4 regression tests covering
double underscore, leading underscore, trailing underscore, and the
NullValue enum decode path.
Eugene Blikh <bigbes@gmail.com> — 2026-05-15 21:57:54 UTC
Commit b1273f1bd5ffa459ac5ff714a6dd75d405b8d43c —
view raw patch
Parent(s):
96ed328e
| File | Status | + | − |
|---|---|---|---|
runtime/pb/json.lua
|
M | +6 | -2 |
runtime/pb/wkt.lua
|
M | +11 | |
test/conformance/known_failures.txt
|
M | -3 | |
test/conformance_test.lua
|
M | +48 |