core: use reflect.TypeFor to check for encoding/json.RawMessage (#7274)

* check if the raw message type is the json v2 type

* use reflect.TypeFor to check for encoding/json.RawMessage

---------

Co-authored-by: Mohammed Al Sahaf <msaa1990@gmail.com>
This commit is contained in:
WeidiDengandMohammed Al Sahaf authored and GitHub committed 2025-09-26 10:46:18 -06:00
1 parent bc0e184130
commit b2ab419922
1 file changed
+3 -1
+3 -1
View File
@@ -345,9 +345,11 @@ func StrictUnmarshalJSON(data []byte, v any) error {
return dec.Decode(v)
}
var JSONRawMessageType = reflect.TypeFor[json.RawMessage]()
// isJSONRawMessage returns true if the type is encoding/json.RawMessage.
func isJSONRawMessage(typ reflect.Type) bool {
return typ.PkgPath() == "encoding/json" && typ.Name() == "RawMessage"
return typ == JSONRawMessageType
}
// isModuleMapType returns true if the type is map[string]json.RawMessage.