npofsi commented on code in PR #17402:
URL: 
https://github.com/apache/dolphinscheduler/pull/17402#discussion_r2343005536


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-grpc/src/main/java/org/apache/dolphinscheduler/plugin/task/grpc/protobufjs/JSONDescriptorParser.java:
##########
@@ -0,0 +1,297 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.dolphinscheduler.plugin.task.grpc.protobufjs;
+
+import static java.util.Objects.isNull;
+
+import org.apache.dolphinscheduler.plugin.task.grpc.protobufjs.types.Enum;
+import org.apache.dolphinscheduler.plugin.task.grpc.protobufjs.types.Field;
+import org.apache.dolphinscheduler.plugin.task.grpc.protobufjs.types.MapField;
+import org.apache.dolphinscheduler.plugin.task.grpc.protobufjs.types.Method;
+import org.apache.dolphinscheduler.plugin.task.grpc.protobufjs.types.Namespace;
+import org.apache.dolphinscheduler.plugin.task.grpc.protobufjs.types.OneOf;
+import org.apache.dolphinscheduler.plugin.task.grpc.protobufjs.types.Root;
+import org.apache.dolphinscheduler.plugin.task.grpc.protobufjs.types.Service;
+import org.apache.dolphinscheduler.plugin.task.grpc.protobufjs.types.Type;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.protobuf.DescriptorProtos;
+import com.google.protobuf.Descriptors;
+
+public class JSONDescriptorParser {

Review Comment:
   We can not use `.proto` file directly, because the ` .proto` file is 
designed as a static definition, not a format to transfer data. The inner 
transmission type of protobuf is a binary format. The file needs to be compiled 
to a builder of binaries (by `protoc` or `protobufjs`). So that we can use the 
compiled dist to create a runtime definition (or protobuf descriptor) 
dynamically. And we choose to compile it at front end.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to