Validator allows empty string

This commit is contained in:
yutopp
2019-01-09 22:49:12 +09:00
parent 4d01aff7e3
commit 12519f26e3
2 changed files with 6 additions and 4 deletions

View File

@@ -100,6 +100,12 @@ namespace UniJSON
{
var c = new JsonSchemaValidationContext("test");
{
var v = new JsonStringValidator();
Assert.Null(v.Validate(c, ""));
Assert.Null(v.Validate(c, "a"));
}
{
var v = new JsonStringValidator();
v.MinLength = 1;

View File

@@ -111,10 +111,6 @@ namespace UniJSON
}
var value = o as string;
if (value.All(x => Char.IsWhiteSpace(x)))
{
return new JsonSchemaValidationException(c, "whitespace");
}
if (MinLength.HasValue && value.Length < MinLength)
{