Alanxtl commented on code in PR #3500:
URL: https://github.com/apache/dubbo-go/pull/3500#discussion_r3628038741


##########
internal/config.go:
##########
@@ -215,3 +215,23 @@ func ValidateRegistryIDs(ids []string, regs 
map[string]*global.RegistryConfig) e
        }
        return nil
 }
+
+// ValidateGenericType validates the generic serialization type (generic mode).
+// An empty value means the call is not generic and is allowed. Unknown values 
fail
+// fast instead of silently falling back to the Map generalizer.
+//
+// Valid values: "true" (Map, default), "gson", "protobuf-json", "bean".
+// "protobuf" is kept as a legacy compatibility value and is not recommended.
+func ValidateGenericType(generic string) error {
+       switch {
+       case generic == "",
+               strings.EqualFold(generic, 
constant.GenericSerializationDefault),
+               strings.EqualFold(generic, constant.GenericSerializationGson),
+               strings.EqualFold(generic, 
constant.GenericSerializationProtobufJson),
+               strings.EqualFold(generic, constant.GenericSerializationBean),
+               strings.EqualFold(generic, 
constant.GenericSerializationProtobuf):
+               return nil

Review Comment:
   确实



##########
internal/config.go:
##########
@@ -215,3 +215,23 @@ func ValidateRegistryIDs(ids []string, regs 
map[string]*global.RegistryConfig) e
        }
        return nil
 }
+
+// ValidateGenericType validates the generic serialization type (generic mode).
+// An empty value means the call is not generic and is allowed. Unknown values 
fail
+// fast instead of silently falling back to the Map generalizer.
+//
+// Valid values: "true" (Map, default), "gson", "protobuf-json", "bean".
+// "protobuf" is kept as a legacy compatibility value and is not recommended.
+func ValidateGenericType(generic string) error {
+       switch {
+       case generic == "",
+               strings.EqualFold(generic, 
constant.GenericSerializationDefault),
+               strings.EqualFold(generic, constant.GenericSerializationGson),
+               strings.EqualFold(generic, 
constant.GenericSerializationProtobufJson),
+               strings.EqualFold(generic, constant.GenericSerializationBean),
+               strings.EqualFold(generic, 
constant.GenericSerializationProtobuf):
+               return nil

Review Comment:
   确实



-- 
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]

Reply via email to