-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cleanup type blacklist PR #254
Conversation
@@ -23,7 +23,8 @@ public class SerializerOptions | |||
serializerFactories: null, | |||
knownTypes: null, | |||
ignoreISerializable: false, | |||
packageNameOverrides: null); | |||
packageNameOverrides: null, | |||
disallowUnsafeTypes: true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move disallow unsafe types flag to options
private static bool IsValueType(this Type type) | ||
=> type.IsSubclassOf(typeof(ValueType)); | ||
|
||
private static bool IsSubclassOf(this Type p, Type c) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add missing type functions to netstandard 1.6, needed for the type blacklisting feature.
@@ -398,6 +406,11 @@ public class T | |||
/// </summary> | |||
private static bool IsSimilarType(this Type thisType, Type type) | |||
{ | |||
if (thisType == null && type == null) | |||
return true; | |||
if (thisType == null || type == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Null check for safety
public SerializerOptions(bool versionTolerance, bool preserveObjectReferences, System.Collections.Generic.IEnumerable<Hyperion.Surrogate> surrogates, System.Collections.Generic.IEnumerable<Hyperion.SerializerFactories.ValueSerializerFactory> serializerFactories, System.Collections.Generic.IEnumerable<System.Type> knownTypes, bool ignoreISerializable, System.Collections.Generic.IEnumerable<System.Func<string, string>> packageNameOverrides) { } | ||
public SerializerOptions(bool versionTolerance, bool preserveObjectReferences, System.Collections.Generic.IEnumerable<Hyperion.Surrogate> surrogates, System.Collections.Generic.IEnumerable<Hyperion.SerializerFactories.ValueSerializerFactory> serializerFactories, System.Collections.Generic.IEnumerable<System.Type> knownTypes, bool ignoreISerializable, System.Collections.Generic.IEnumerable<System.Func<string, string>> packageNameOverrides, bool disallowUnsafeTypes) { } | ||
public Hyperion.SerializerOptions WithDisallowUnsafeType(bool disallowUnsafeType) { } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
No description provided.