Raise "Proto Message has an Unknown Field" in certain situations.
The motivation for this change is to flag accidental loss of protobuf extensions when use_fast_cpp_protos is in use, to turn silent but potentially critical failures into noisy failures, for example:
Proto Message of type pybind11.test.NestRepeated has an Unknown Field with
parent of type pybind11.test.BaseMessage: base_msgs.1003
(pybind11_protobuf/tests/extension_nest_repeated.proto,
pybind11_protobuf/tests/extension.proto).
Please add the required `cc_proto_library` `deps`.
Only if there is no alternative to suppressing this error, use
`pybind11_protobuf::AllowUnknownFieldsFor("pybind11.test.NestRepeated", "base_msgs");`
(Warning: suppressions may mask critical bugs.)
See the updated "Protobuf Extensions" section in README.md for background and details.
check_unknown_fields.cc is mostly the work of @laramiel, with an initial implementation only by @rwgk.
MessageMayContainExtensionsMemoized() is for speed-up, but note that it also limits the scope of the Unknown Field detection (as explained in the updated README.md section).
Raise "Proto Message has an Unknown Field" in certain situations.
The motivation for this change is to flag accidental loss of protobuf extensions when
use_fast_cpp_protos
is in use, to turn silent but potentially critical failures into noisy failures, for example:See the updated "Protobuf Extensions" section in README.md for background and details.
check_unknown_fields.cc is mostly the work of @laramiel, with an initial implementation only by @rwgk.
MessageMayContainExtensionsMemoized()
is for speed-up, but note that it also limits the scope of the Unknown Field detection (as explained in the updated README.md section).