MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / ConvertToJson

Method ConvertToJson

common/values/parsed_message_value.cc:107–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105}
106
107absl::Status ParsedMessageValue::ConvertToJson(
108 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
109 google::protobuf::MessageFactory* absl_nonnull message_factory,
110 google::protobuf::Message* absl_nonnull json) const {
111 ABSL_DCHECK(descriptor_pool != nullptr);
112 ABSL_DCHECK(message_factory != nullptr);
113 ABSL_DCHECK(json != nullptr);
114 ABSL_DCHECK_EQ(json->GetDescriptor()->well_known_type(),
115 google::protobuf::Descriptor::WELLKNOWNTYPE_VALUE);
116
117 ValueReflection value_reflection;
118 CEL_RETURN_IF_ERROR(value_reflection.Initialize(json->GetDescriptor()));
119 google::protobuf::Message* json_object = value_reflection.MutableStructValue(json);
120
121 return internal::MessageToJson(*value_, descriptor_pool, message_factory,
122 json_object);
123}
124
125absl::Status ParsedMessageValue::ConvertToJsonObject(
126 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,

Callers

nothing calls this directly

Calls 4

MessageToJsonFunction · 0.85
GetDescriptorMethod · 0.45
InitializeMethod · 0.45
MutableStructValueMethod · 0.45

Tested by

no test coverage detected