Use ContractResolver instead of forcing to lower case (#112)
Addresses #90
This commit is contained in:
parent
e4a412e164
commit
f1efb29b18
|
|
@ -691,12 +691,13 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
{
|
||||
foreach (var op in Operations)
|
||||
{
|
||||
var untypedOp = new Operation();
|
||||
|
||||
untypedOp.op = op.op;
|
||||
untypedOp.value = op.value;
|
||||
untypedOp.path = op.path;
|
||||
untypedOp.from = op.from;
|
||||
var untypedOp = new Operation
|
||||
{
|
||||
op = op.op,
|
||||
value = op.value,
|
||||
path = op.path,
|
||||
from = op.from
|
||||
};
|
||||
|
||||
allOps.Add(untypedOp);
|
||||
}
|
||||
|
|
@ -715,11 +716,11 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
path += "/" + position;
|
||||
if (segments.Count == 0)
|
||||
{
|
||||
return path.ToLowerInvariant();
|
||||
return path;
|
||||
}
|
||||
}
|
||||
|
||||
return "/" + path.ToLowerInvariant();
|
||||
return "/" + path;
|
||||
}
|
||||
|
||||
private List<string> GetPathSegments(Expression expr)
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
var path = patchDocument.GetPath(p => p.SimpleObject.IntegerList, "-");
|
||||
|
||||
// Assert
|
||||
Assert.Equal("/simpleobject/integerlist/-", path);
|
||||
Assert.Equal("/SimpleObject/IntegerList/-", path);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -84,7 +84,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
var path = patchDocument.GetPath(p => (BaseClass)p.DerivedObject, null);
|
||||
|
||||
// Assert
|
||||
Assert.Equal("/derivedobject", path);
|
||||
Assert.Equal("/DerivedObject", path);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
|
||||
// get path
|
||||
var pathToCheck = deserialized.Operations.First().path;
|
||||
Assert.Equal("/anothername", pathToCheck);
|
||||
Assert.Equal("/AnotherName", pathToCheck);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -73,7 +73,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
|
||||
// Assert
|
||||
var pathToCheck = deserialized.Operations.First().path;
|
||||
Assert.Equal("/stringproperty", pathToCheck);
|
||||
Assert.Equal("/StringProperty", pathToCheck);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -90,7 +90,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
|
||||
// Assert
|
||||
var pathToCheck = deserialized.Operations.First().path;
|
||||
Assert.Equal("/arrayproperty/-", pathToCheck);
|
||||
Assert.Equal("/ArrayProperty/-", pathToCheck);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -209,7 +209,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
|
||||
// get path
|
||||
var pathToCheck = deserialized.Operations.First().path;
|
||||
Assert.Equal("/anothername", pathToCheck);
|
||||
Assert.Equal("/AnotherName", pathToCheck);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -249,9 +249,9 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
|
||||
// Assert
|
||||
var fromPath = deserialized.Operations.First().from;
|
||||
Assert.Equal("/stringproperty", fromPath);
|
||||
Assert.Equal("/StringProperty", fromPath);
|
||||
var toPath = deserialized.Operations.First().path;
|
||||
Assert.Equal("/stringproperty2", toPath);
|
||||
Assert.Equal("/StringProperty2", toPath);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -269,7 +269,7 @@ namespace Microsoft.AspNetCore.JsonPatch
|
|||
|
||||
// Assert
|
||||
var path = deserialized.Operations.First().path;
|
||||
Assert.Equal("/socialsecuritynumber", path);
|
||||
Assert.Equal("/SocialSecurityNumber", path);
|
||||
}
|
||||
|
||||
private class JsonPropertyWithNoPropertyName
|
||||
|
|
|
|||
Loading…
Reference in New Issue