allow paths that contain '.' (#125)

* allow paths that contain '.'

* remove InvalidPathWithDotShouldThrowException test
This commit is contained in:
arerlend 2017-11-07 11:24:52 -08:00 committed by Ryan Nowak
parent 478c640a68
commit 70c8133fce
2 changed files with 2 additions and 20 deletions

View File

@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.JsonPatch.Internal
// absolutely necessary, but it allows us to already catch mistakes
// on creation of the patch document rather than on execute.
if (path.Contains(".") || path.Contains("//") || path.Contains(" ") || path.Contains("\\"))
if (path.Contains("//") || path.Contains(" ") || path.Contains("\\"))
{
throw new JsonPatchException(Resources.FormatInvalidValueForPath(path), null);
}

View File

@ -45,24 +45,6 @@ namespace Microsoft.AspNetCore.JsonPatch
exception.Message);
}
[Fact]
public void InvalidPathWithDotShouldThrowException()
{
// Arrange
var patchDocument = new JsonPatchDocument();
// Act
var exception = Assert.Throws<JsonPatchException>(() =>
{
patchDocument.Add("NewInt.Test", 1);
});
// Assert
Assert.Equal(
"The provided string 'NewInt.Test' is an invalid path.",
exception.Message);
}
[Fact]
public void NonGenericPatchDocToGenericMustSerialize()
{
@ -177,4 +159,4 @@ namespace Microsoft.AspNetCore.JsonPatch
Assert.Equal("The JSON patch document was malformed and could not be parsed.", exception.Message);
}
}
}
}