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 // absolutely necessary, but it allows us to already catch mistakes
// on creation of the patch document rather than on execute. // 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); throw new JsonPatchException(Resources.FormatInvalidValueForPath(path), null);
} }

View File

@ -45,24 +45,6 @@ namespace Microsoft.AspNetCore.JsonPatch
exception.Message); 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] [Fact]
public void NonGenericPatchDocToGenericMustSerialize() public void NonGenericPatchDocToGenericMustSerialize()
{ {