Skip to content

Commit 4b4e405

Browse files
Use the 'better' JSON parser on the conformance suite harness.
This switches it to use the Descriptor-based path instead of the type.proto-based path, which also unlocks the ability to test for handling of extensions. PiperOrigin-RevId: 799542063
1 parent d549ca0 commit 4b4e405

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

conformance/binary_json_conformance_suite.cc

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -232,22 +232,14 @@ namespace protobuf {
232232

233233
bool BinaryAndJsonConformanceSuite::ParseJsonResponse(
234234
const ConformanceResponse& response, Message* test_message) {
235-
std::string binary_protobuf;
235+
json::ParseOptions options;
236+
options.allow_legacy_nonconformant_behavior = false;
236237
absl::Status status =
237-
json::JsonToBinaryString(type_resolver_.get(), type_url_,
238-
response.json_payload(), &binary_protobuf);
239-
238+
json::JsonStringToMessage(response.json_payload(), test_message);
240239
if (!status.ok()) {
241240
ABSL_LOG(ERROR) << status;
242241
return false;
243242
}
244-
245-
if (!test_message->ParseFromString(binary_protobuf)) {
246-
ABSL_LOG(FATAL) << "INTERNAL ERROR: internal JSON->protobuf transcode "
247-
<< "yielded unparseable proto.";
248-
return false;
249-
}
250-
251243
return true;
252244
}
253245

0 commit comments

Comments
 (0)