Alanxtl commented on code in PR #3796:
URL: https://github.com/apache/dubbo-go/pull/3796#discussion_r4500771984
##########
metadata/service_definition.go:
##########
@@ -183,29 +187,25 @@ func dedupeByService(urls []*common.URL) []*common.URL {
return out
}
-// describable reports whether a URL's export carries a contract this package
can
-// derive from Go reflection.
+// describable reports whether a URL's export carries a contract this package
+// knows how to describe.
//
-// Only two exports qualify: Dubbo/Hessian2, and Triple in non-IDL mode. An IDL
-// (protobuf) service must not be published from reflection — the generated
-// struct is a lossy view of the proto, missing real field names, enums, oneofs
-// and well-known type semantics — so its contract needs a descriptor-based
-// builder that does not exist yet.
+// Dubbo/Hessian2 and non-IDL Triple exports are described by Go reflection
over
+// the handler. Triple IDL (protobuf) exports are described from protobuf
+// descriptors instead (see definition.BuildFromURL), because the generated
+// struct is a lossy view of the proto: reflection misses the real field names,
+// enums, oneofs and well-known type semantics.
//
-// Non-IDL is detected by the absence of the ServiceInfo attribute rather than
-// the IDL-mode URL parameter the proposal suggested. Server.Register threads a
-// *common.ServiceInfo through for IDL services and Server.RegisterService
-// passes nil for non-IDL ones, and enhanceServiceInfo preserves that nil, so
the
-// attribute is set exactly for IDL exports. The IDL-mode parameter would work
-// today but is marked for removal along with constant.IDLMode, constant.NONIDL
-// and WithIDLMode.
+// IDL is detected by the presence of the ServiceInfo attribute rather than the
+// IDL-mode URL parameter. Server.Register threads a *common.ServiceInfo
through
+// for IDL services and Server.RegisterService passes nil for non-IDL ones, and
+// enhanceServiceInfo preserves that nil, so the attribute is set exactly for
IDL
+// exports. The IDL-mode parameter would work today but is marked for removal
+// along with constant.IDLMode, constant.NONIDL and WithIDLMode.
func describable(u *common.URL) bool {
switch u.Protocol {
- case constant.DubboProtocol:
+ case constant.DubboProtocol, constant.TriProtocol:
return true
- case constant.TriProtocol:
- _, isIDL := u.GetAttribute(constant.ServiceInfoKey)
- return !isIDL
Review Comment:
这个isIDL的开关为什么要移除
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]