allow paths that contain '.' (#125)
* allow paths that contain '.' * remove InvalidPathWithDotShouldThrowException test
This commit is contained in:
parent
478c640a68
commit
70c8133fce
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue