Internal change
PiperOrigin-RevId: 812230581
diff --git a/src/google/protobuf/compiler/cpp/helpers.cc b/src/google/protobuf/compiler/cpp/helpers.cc
index 281cf2c..358ef61 100644
--- a/src/google/protobuf/compiler/cpp/helpers.cc
+++ b/src/google/protobuf/compiler/cpp/helpers.cc
@@ -1377,7 +1377,10 @@
MessageSCCAnalyzer* scc_analyzer) {
if (!ShouldVerify(descriptor, options, scc_analyzer)) return false;
- return HasRequiredFields(descriptor);
+ // Note that only verification needs to transitively check if required fields
+ // exist because otherwise the verification will be done schemaless. Parser
+ // doesn't need it because it's always done with schema.
+ return scc_analyzer->HasRequiredFields(descriptor);
}
bool IsEligibleForV2Batching(const FieldDescriptor* field) {