diff --git a/CHANGELOG.md b/CHANGELOG.md
index aae528e..668fcb1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,19 @@
+## 4.0.0
+
+**BREAKING CHANGE:** SystemTextJsonPatch now supports different property naming policies!
+f.e. `JsonNamingPolicy.SnakeCaseLower`. Fixes https://github.com/Havunen/SystemTextJsonPatch/issues/36
+
+- This means that the **path** and **from** of the system text json patch document needs to match the JSON serializer options property naming policy.
+For example, if the JSON serializer options are set to use camelCase, the patch path should also be in camelCase.
+
+**BREAKING CHANGE:** Exception types have been changed.
+
+- `JsonPatchException` -base exception type now contains `FailedOperation` and `AffectedObject` properties.
+These properties are populated with the failed operation when the operation is available.
+This change is to provide more information about the failed operation and the affected object. Fixes: https://github.com/Havunen/SystemTextJsonPatch/issues/26
+- `NotSupportedException` and `InvalidOperationException` are not thrown anymore. Instead, `JsonPatchException` is thrown with the appropriate message.
+- `JsonPatchTestOperationException` is now thrown only when the test operation fails. Fixes https://github.com/Havunen/SystemTextJsonPatch/issues/22
+
## 3.3.0
- Adds support for `DenyPatch` attribute to deny access to annotated property https://github.com/Havunen/SystemTextJsonPatch/pull/34
- Internal dependencies updated
diff --git a/README.md b/README.md
index 804990d..83cd189 100644
--- a/README.md
+++ b/README.md
@@ -65,16 +65,16 @@ This test deserializes a JSON patch document of 8 operations and applies the cha
See [SystemTextJsonPatch.Benchmark](https://github.com/Havunen/SystemTextJsonPatch/tree/main/SystemTextJsonPatch.Benchmark) for more details.
-BenchmarkDotNet v0.14.0, Windows 11 (10.0.22631.3880/23H2/2023Update/SunValley3)
+BenchmarkDotNet v0.14.0, Windows 11 (10.0.22631.4169/23H2/2023Update/SunValley3)
AMD Ryzen 9 5950X, 1 CPU, 32 logical and 16 physical cores
-.NET SDK 8.0.400-preview.0.24324.5
- [Host] : .NET 8.0.5 (8.0.524.21615), X64 RyuJIT AVX2
- Job-FECQKB : .NET 8.0.5 (8.0.524.21615), X64 RyuJIT AVX2
+.NET SDK 9.0.100-rc.1.24452.12
+ [Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
+ Job-MZQQSH : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
WarmupCount=2
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
|-------------------- |-----------:|----------:|----------:|-------:|-------:|----------:|
-| SystemTextJsonPatch | 5.253 us | 0.0315 us | 0.0451 us | 0.3357 | - | 5.52 KB |
-| MarvinJsonPatch | 830.553 us | 9.1462 us | 7.6375 us | 5.8594 | 3.9063 | 104.82 KB |
-| AspNetCoreJsonPatch | 18.078 us | 0.1070 us | 0.0948 us | 2.9297 | 0.0610 | 48.35 KB |
\ No newline at end of file
+| SystemTextJsonPatch | 4.297 us | 0.0364 us | 0.0340 us | 0.2975 | - | 4.98 KB |
+| MarvinJsonPatch | 764.999 us | 9.9837 us | 8.3368 us | 3.9063 | 1.9531 | 95.41 KB |
+| AspNetCoreJsonPatch | 16.692 us | 0.0996 us | 0.0932 us | 2.6550 | 0.0610 | 43.55 KB |
\ No newline at end of file
diff --git a/SystemTextJsonPatch.Benchmark/Benchmarks/DeserializeAndApplyToBenchmark.cs b/SystemTextJsonPatch.Benchmark/Benchmarks/DeserializeAndApplyToBenchmark.cs
index bdce33b..efc84b7 100644
--- a/SystemTextJsonPatch.Benchmark/Benchmarks/DeserializeAndApplyToBenchmark.cs
+++ b/SystemTextJsonPatch.Benchmark/Benchmarks/DeserializeAndApplyToBenchmark.cs
@@ -17,15 +17,18 @@ public void GlobalSetup()
};
}
- public static string DeserializePatchDocJson = string.Format("[" + "{{\"op\": \"replace\", \"path\": \"number\", \"value\": 86632}}," +
- "{{\"op\": \"replace\", \"path\": \"text\", \"value\": \"testing-performance\"}}," +
- "{{\"op\": \"add\", \"path\": \"amount\", \"value\": 86632.172712}}," +
- "{{\"op\": \"replace\", \"path\": \"amount2\", \"value\": null}}," +
- "{{\"op\": \"replace\", \"path\": \"subTestModel\", \"value\": {{\"id\": 91117, \"data\": 78}}}}," +
- "{{\"op\": \"test\", \"path\": \"number\", \"value\": 86632}}," +
- "{{\"op\": \"test\", \"path\": \"text\", \"value\": \"testing-performance\"}}," +
- "{{\"op\": \"copy\", \"path\": \"amount2\", \"from\": \"amount\"}}," +
- "{{\"op\": \"remove\", \"path\": \"text\"}}" + "]");
+ public static string DeserializePatchDocJson = string.Format(
+ "[" +
+ "{{\"op\": \"replace\", \"path\": \"Number\", \"value\": 86632}}," +
+ "{{\"op\": \"replace\", \"path\": \"Text\", \"value\": \"testing-performance\"}}," +
+ "{{\"op\": \"add\", \"path\": \"Amount\", \"value\": 86632.172712}}," +
+ "{{\"op\": \"replace\", \"path\": \"Amount2\", \"value\": null}}," +
+ "{{\"op\": \"replace\", \"path\": \"SubTestModel\", \"value\": {{\"Id\": 91117, \"Data\": 78}}}}," +
+ "{{\"op\": \"test\", \"path\": \"Number\", \"value\": 86632}}," +
+ "{{\"op\": \"copy\", \"path\": \"Amount2\", \"from\": \"Amount\"}}," +
+ "{{\"op\": \"remove\", \"path\": \"Text\"}}" +
+ "]"
+ );
[Benchmark]
diff --git a/SystemTextJsonPatch.Console/DeserializeTest.cs b/SystemTextJsonPatch.Console/DeserializeTest.cs
index c348ab5..062c315 100644
--- a/SystemTextJsonPatch.Console/DeserializeTest.cs
+++ b/SystemTextJsonPatch.Console/DeserializeTest.cs
@@ -7,14 +7,14 @@ public class DeserializeTest
{
public static string DeserializePatchDocJson = string.Format(
"[" +
- "{{\"op\": \"replace\", \"path\": \"number\", \"value\": 86632}}," +
- "{{\"op\": \"replace\", \"path\": \"text\", \"value\": \"testing-performance\"}}," +
- "{{\"op\": \"add\", \"path\": \"amount\", \"value\": 86632.172712}}," +
- "{{\"op\": \"replace\", \"path\": \"amount2\", \"value\": null}}," +
- "{{\"op\": \"replace\", \"path\": \"subTestModel\", \"value\": {{\"id\": 91117, \"data\": 78}}}}," +
- "{{\"op\": \"test\", \"path\": \"number\", \"value\": 86632}}," +
- "{{\"op\": \"copy\", \"path\": \"amount2\", \"from\": \"amount\"}}," +
- "{{\"op\": \"remove\", \"path\": \"text\"}}" +
+ "{{\"op\": \"replace\", \"path\": \"Number\", \"value\": 86632}}," +
+ "{{\"op\": \"replace\", \"path\": \"Text\", \"value\": \"testing-performance\"}}," +
+ "{{\"op\": \"add\", \"path\": \"Amount\", \"value\": 86632.172712}}," +
+ "{{\"op\": \"replace\", \"path\": \"Amount2\", \"value\": null}}," +
+ "{{\"op\": \"replace\", \"path\": \"SubTestModel\", \"value\": {{\"Id\": 91117, \"Data\": 78}}}}," +
+ "{{\"op\": \"test\", \"path\": \"Number\", \"value\": 86632}}," +
+ "{{\"op\": \"copy\", \"path\": \"Amount2\", \"from\": \"Amount\"}}," +
+ "{{\"op\": \"remove\", \"path\": \"Text\"}}" +
"]"
);
diff --git a/SystemTextJsonPatch/SystemTextJsonPatch.csproj b/SystemTextJsonPatch/SystemTextJsonPatch.csproj
index fe677bf..eb35be7 100644
--- a/SystemTextJsonPatch/SystemTextJsonPatch.csproj
+++ b/SystemTextJsonPatch/SystemTextJsonPatch.csproj
@@ -7,7 +7,7 @@
true
aspnetcore;json;jsonpatch;system.text.json;rfc6902;
12
- 3.3.0
+ 4.0.0
https://github.com/Havunen/SystemTextJsonPatch.git
git
8.0-all