Skip to content

Commit f4a0e9a

Browse files
committed
Add WithoutOptions to IgnoreList + convert to use IgnoreCase HashSet
1 parent 92efc8e commit f4a0e9a

3 files changed

Lines changed: 18 additions & 16 deletions

File tree

src/ServiceStack.Client/Serialization/StringMapTypeDeserializer.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
using ServiceStack.Text;
77
using ServiceStack.Text.Common;
88
using ServiceStack.Text.Jsv;
9-
using System.Linq;
10-
using System.Threading;
11-
using ServiceStack.Web;
129

1310
namespace ServiceStack.Serialization
1411
{
@@ -83,7 +80,7 @@ public StringMapTypeDeserializer(Type type)
8380
}
8481
}
8582

86-
public object PopulateFromMap(object instance, IDictionary<string, string> keyValuePairs, List<string> ignoredWarningsOnPropertyNames = null)
83+
public object PopulateFromMap(object instance, IDictionary<string, string> keyValuePairs, HashSet<string> ignoredWarningsOnPropertyNames = null)
8784
{
8885
var errors = new List<RequestBindingError>();
8986

@@ -109,7 +106,7 @@ public object PopulateFromMap(object instance, IDictionary<string, string> keyVa
109106
return instance;
110107
}
111108

112-
public object PopulateFromMap(object instance, NameValueCollection nameValues, List<string> ignoredWarningsOnPropertyNames = null)
109+
public object PopulateFromMap(object instance, NameValueCollection nameValues, HashSet<string> ignoredWarningsOnPropertyNames = null)
113110
{
114111
var errors = new List<RequestBindingError>();
115112

@@ -137,7 +134,8 @@ public object PopulateFromMap(object instance, NameValueCollection nameValues, L
137134
}
138135

139136

140-
private object PopulateFromKeyValue(object instance, string propertyName, string propertyTextValue, out PropertySerializerEntry propertySerializerEntry, List<RequestBindingError> errors, List<string> ignoredWarningsOnPropertyNames = null)
137+
private object PopulateFromKeyValue(object instance, string propertyName, string propertyTextValue, out PropertySerializerEntry propertySerializerEntry, List<RequestBindingError> errors,
138+
HashSet<string> ignoredWarningsOnPropertyNames = null)
141139
{
142140
propertySerializerEntry = null;
143141

@@ -154,11 +152,10 @@ private object PopulateFromKeyValue(object instance, string propertyName, string
154152
return instance;
155153
}
156154

157-
var ignoredProperty = propertyName.ToLowerInvariant();
158-
if (ignoredWarningsOnPropertyNames != null && !ignoredWarningsOnPropertyNames.Contains(ignoredProperty)
155+
if (ignoredWarningsOnPropertyNames != null && !ignoredWarningsOnPropertyNames.Contains(propertyName)
159156
&& !type.HasAttributeCached<FallbackRouteAttribute>())
160157
{
161-
Log.WarnFormat("Property '{0}' does not exist on type '{1}'", ignoredProperty, type.FullName);
158+
Log.WarnFormat("Property '{0}' does not exist on type '{1}'", propertyName, type.FullName);
162159
}
163160
return instance;
164161
}

src/ServiceStack/HostConfig.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,11 @@ public static HostConfig NewInstance()
156156
{
157157
{ "/metadata/", "/metadata" },
158158
},
159-
IgnoreWarningsOnPropertyNames = new List<string> {
159+
IgnoreWarningsOnPropertyNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase) {
160160
Keywords.Format, Keywords.Callback, Keywords.Debug, Keywords.AuthSecret, Keywords.JsConfig,
161-
Keywords.IgnorePlaceHolder, Keywords.Version, Keywords.VersionAbbr, Keywords.Version.ToPascalCase(),
162-
Keywords.ApiKeyParam, Keywords.Code, Keywords.Redirect, Keywords.Continue, "session_state", "s", "f"
161+
Keywords.IgnorePlaceHolder, Keywords.Version, Keywords.VersionAbbr, Keywords.Version,
162+
Keywords.ApiKeyParam, Keywords.Code, Keywords.Redirect, Keywords.Continue,
163+
Keywords.SessionState, Keywords.OAuthSuccess, Keywords.OAuthFailed, Keywords.WithoutOptions,
163164
},
164165
IgnoreWarningsOnAutoQueryApis = true,
165166
XmlWriterSettings = new XmlWriterSettings
@@ -310,7 +311,7 @@ public RequestAttributes MetadataVisibility
310311

311312
public bool IgnoreWarningsOnAllProperties { get; set; }
312313
public bool IgnoreWarningsOnAutoQueryApis { get; set; }
313-
public List<string> IgnoreWarningsOnPropertyNames { get; private set; }
314+
public HashSet<string> IgnoreWarningsOnPropertyNames { get; private set; }
314315

315316
public HashSet<string> IgnoreFormatsInMetadata { get; set; }
316317

src/ServiceStack/Keywords.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@ public static class Keywords
2424
public static string Redirect = "redirect";
2525
public static string NoRedirect = "noredirect";
2626
public static string ReturnUrl = nameof(ReturnUrl); //.NET Core default convention
27-
public static string AutoBatchIndex = nameof(AutoBatchIndex);
28-
public static string SoapMessage = nameof(SoapMessage);
29-
27+
28+
public const string AutoBatchIndex = nameof(AutoBatchIndex);
29+
public const string SoapMessage = nameof(SoapMessage);
30+
public const string WithoutOptions = nameof(WithoutOptions);
31+
public const string SessionState = "session_state";
32+
public const string OAuthSuccess = "s";
33+
public const string OAuthFailed = "f";
3034
public const string Route = "__route";
3135
public const string InvokeVerb = "__verb";
3236
public const string DbInfo = "__dbinfo";

0 commit comments

Comments
 (0)