protobuf
protobuf copied to clipboard
Add in patchable _INT64_CONVERTER
An alternative to https://github.com/protocolbuffers/protobuf/pull/16130, which I presume was rejected because you would also have to contribute the option to the mapping specification for every language, add a bunch of tests, etc.
The pitch here: outputting int64 as a string produces results that are defensible as a mapping, but not great for a consumer ("why are my numbers, strings?"). This PR modifies no existing logic, but allows an upstream user who knows what they want to in-place patch the json_format.py without vendoring the entire json_format submodule:
from google.protobuf import json_format
assert json_format._INT64_CONVERTER == str
json_format._INT64_CONVERTER = int