Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(482)

Unified Diff: Src/GoogleApis/Apis/Requests/Parameters/ParameterValidator.cs

Issue 13412046: Reimplement OAuth2 library - Step 1 (Closed) Base URL: https://google-api-dotnet-client.googlecode.com/hg/
Patch Set: minor Created 10 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Src/GoogleApis/Apis/Requests/Parameters/ParameterValidator.cs
===================================================================
rename from Src/GoogleApis/Apis/Requests/ParameterValidator.cs
rename to Src/GoogleApis/Apis/Requests/Parameters/ParameterValidator.cs
--- a/Src/GoogleApis/Apis/Requests/ParameterValidator.cs
b/Src/GoogleApis/Apis/Requests/Parameters/ParameterValidator.cs
@@ -22,30 22,28 @@
using Google.Apis.Testing;
using Google.Apis.Util;
-namespace Google.Apis
namespace Google.Apis.Requests.Parameters
{
- /// <summary>
- /// Logic for validating a parameter
- /// </summary>
/// <summary>Logic for validating a parameter.</summary>
public static class ParameterValidator
{
- /// <summary> Validates a parameter value against the methods regex. </summary>
/// <summary>Validates a parameter value against the methods regex.</summary>
[VisibleForTestOnly]
internal static bool ValidateRegex(IParameter param, string paramValue)
{
return string.IsNullOrEmpty(param.Pattern) || new Regex(param.Pattern).IsMatch(paramValue);
}
- /// <summary> Validates if a parameter is valid. </summary>
/// <summary>Validates if a parameter is valid.</summary>
public static bool ValidateParameter(IParameter parameter, string value)
{
- // If a required parameter is not present, fail
// Fail if a required parameter is not present.
if (String.IsNullOrEmpty(value))
{
return !parameter.IsRequired;
}
- // The parameter has value so validate the regex
// The parameter has value so validate the regex.
return ValidateRegex(parameter, value);
}
}

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b