Skip to content

Commit 2e496ef

Browse files
committed
4.0.0
1 parent f61fd2c commit 2e496ef

File tree

5 files changed

+44
-25
lines changed

5 files changed

+44
-25
lines changed

CHANGELOG.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
## 4.0.0
2+
3+
**BREAKING CHANGE:** SystemTextJsonPatch now supports different property naming policies!
4+
f.e. `JsonNamingPolicy.SnakeCaseLower`. Fixes https://github.com/Havunen/SystemTextJsonPatch/issues/36
5+
6+
- This means that the **path** and **from** of the system text json patch document needs to match the JSON serializer options property naming policy.
7+
For example, if the JSON serializer options are set to use camelCase, the patch path should also be in camelCase.
8+
9+
**BREAKING CHANGE:** Exception types have been changed.
10+
11+
- `JsonPatchException` -base exception type now contains `FailedOperation` and `AffectedObject` properties.
12+
These properties are populated with the failed operation when the operation is available.
13+
This change is to provide more information about the failed operation and the affected object. Fixes: https://github.com/Havunen/SystemTextJsonPatch/issues/26
14+
- `NotSupportedException` and `InvalidOperationException` are not thrown anymore. Instead, `JsonPatchException` is thrown with the appropriate message.
15+
- `JsonPatchTestOperationException` is now thrown only when the test operation fails. Fixes https://github.com/Havunen/SystemTextJsonPatch/issues/22
16+
117
## 3.3.0
218
- Adds support for `DenyPatch` attribute to deny access to annotated property https://github.com/Havunen/SystemTextJsonPatch/pull/34
319
- Internal dependencies updated

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ This test deserializes a JSON patch document of 8 operations and applies the cha
6565

6666
See [SystemTextJsonPatch.Benchmark](https://github.com/Havunen/SystemTextJsonPatch/tree/main/SystemTextJsonPatch.Benchmark) for more details.
6767

68-
BenchmarkDotNet v0.14.0, Windows 11 (10.0.22631.3880/23H2/2023Update/SunValley3)
68+
BenchmarkDotNet v0.14.0, Windows 11 (10.0.22631.4169/23H2/2023Update/SunValley3)
6969
AMD Ryzen 9 5950X, 1 CPU, 32 logical and 16 physical cores
70-
.NET SDK 8.0.400-preview.0.24324.5
71-
[Host] : .NET 8.0.5 (8.0.524.21615), X64 RyuJIT AVX2
72-
Job-FECQKB : .NET 8.0.5 (8.0.524.21615), X64 RyuJIT AVX2
70+
.NET SDK 9.0.100-rc.1.24452.12
71+
[Host] : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
72+
Job-MZQQSH : .NET 8.0.8 (8.0.824.36612), X64 RyuJIT AVX2
7373

7474
WarmupCount=2
7575

7676
| Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
7777
|-------------------- |-----------:|----------:|----------:|-------:|-------:|----------:|
78-
| SystemTextJsonPatch | 5.253 us | 0.0315 us | 0.0451 us | 0.3357 | - | 5.52 KB |
79-
| MarvinJsonPatch | 830.553 us | 9.1462 us | 7.6375 us | 5.8594 | 3.9063 | 104.82 KB |
80-
| AspNetCoreJsonPatch | 18.078 us | 0.1070 us | 0.0948 us | 2.9297 | 0.0610 | 48.35 KB |
78+
| SystemTextJsonPatch | 4.297 us | 0.0364 us | 0.0340 us | 0.2975 | - | 4.98 KB |
79+
| MarvinJsonPatch | 764.999 us | 9.9837 us | 8.3368 us | 3.9063 | 1.9531 | 95.41 KB |
80+
| AspNetCoreJsonPatch | 16.692 us | 0.0996 us | 0.0932 us | 2.6550 | 0.0610 | 43.55 KB |

SystemTextJsonPatch.Benchmark/Benchmarks/DeserializeAndApplyToBenchmark.cs

+12-9
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@ public void GlobalSetup()
1717
};
1818
}
1919

20-
public static string DeserializePatchDocJson = string.Format("[" + "{{\"op\": \"replace\", \"path\": \"number\", \"value\": 86632}}," +
21-
"{{\"op\": \"replace\", \"path\": \"text\", \"value\": \"testing-performance\"}}," +
22-
"{{\"op\": \"add\", \"path\": \"amount\", \"value\": 86632.172712}}," +
23-
"{{\"op\": \"replace\", \"path\": \"amount2\", \"value\": null}}," +
24-
"{{\"op\": \"replace\", \"path\": \"subTestModel\", \"value\": {{\"id\": 91117, \"data\": 78}}}}," +
25-
"{{\"op\": \"test\", \"path\": \"number\", \"value\": 86632}}," +
26-
"{{\"op\": \"test\", \"path\": \"text\", \"value\": \"testing-performance\"}}," +
27-
"{{\"op\": \"copy\", \"path\": \"amount2\", \"from\": \"amount\"}}," +
28-
"{{\"op\": \"remove\", \"path\": \"text\"}}" + "]");
20+
public static string DeserializePatchDocJson = string.Format(
21+
"[" +
22+
"{{\"op\": \"replace\", \"path\": \"Number\", \"value\": 86632}}," +
23+
"{{\"op\": \"replace\", \"path\": \"Text\", \"value\": \"testing-performance\"}}," +
24+
"{{\"op\": \"add\", \"path\": \"Amount\", \"value\": 86632.172712}}," +
25+
"{{\"op\": \"replace\", \"path\": \"Amount2\", \"value\": null}}," +
26+
"{{\"op\": \"replace\", \"path\": \"SubTestModel\", \"value\": {{\"Id\": 91117, \"Data\": 78}}}}," +
27+
"{{\"op\": \"test\", \"path\": \"Number\", \"value\": 86632}}," +
28+
"{{\"op\": \"copy\", \"path\": \"Amount2\", \"from\": \"Amount\"}}," +
29+
"{{\"op\": \"remove\", \"path\": \"Text\"}}" +
30+
"]"
31+
);
2932

3033

3134
[Benchmark]

SystemTextJsonPatch.Console/DeserializeTest.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ public class DeserializeTest
77
{
88
public static string DeserializePatchDocJson = string.Format(
99
"[" +
10-
"{{\"op\": \"replace\", \"path\": \"number\", \"value\": 86632}}," +
11-
"{{\"op\": \"replace\", \"path\": \"text\", \"value\": \"testing-performance\"}}," +
12-
"{{\"op\": \"add\", \"path\": \"amount\", \"value\": 86632.172712}}," +
13-
"{{\"op\": \"replace\", \"path\": \"amount2\", \"value\": null}}," +
14-
"{{\"op\": \"replace\", \"path\": \"subTestModel\", \"value\": {{\"id\": 91117, \"data\": 78}}}}," +
15-
"{{\"op\": \"test\", \"path\": \"number\", \"value\": 86632}}," +
16-
"{{\"op\": \"copy\", \"path\": \"amount2\", \"from\": \"amount\"}}," +
17-
"{{\"op\": \"remove\", \"path\": \"text\"}}" +
10+
"{{\"op\": \"replace\", \"path\": \"Number\", \"value\": 86632}}," +
11+
"{{\"op\": \"replace\", \"path\": \"Text\", \"value\": \"testing-performance\"}}," +
12+
"{{\"op\": \"add\", \"path\": \"Amount\", \"value\": 86632.172712}}," +
13+
"{{\"op\": \"replace\", \"path\": \"Amount2\", \"value\": null}}," +
14+
"{{\"op\": \"replace\", \"path\": \"SubTestModel\", \"value\": {{\"Id\": 91117, \"Data\": 78}}}}," +
15+
"{{\"op\": \"test\", \"path\": \"Number\", \"value\": 86632}}," +
16+
"{{\"op\": \"copy\", \"path\": \"Amount2\", \"from\": \"Amount\"}}," +
17+
"{{\"op\": \"remove\", \"path\": \"Text\"}}" +
1818
"]"
1919
);
2020

SystemTextJsonPatch/SystemTextJsonPatch.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<GenerateDocumentationFile>true</GenerateDocumentationFile>
88
<PackageTags>aspnetcore;json;jsonpatch;system.text.json;rfc6902;</PackageTags>
99
<LangVersion>12</LangVersion>
10-
<Version>3.3.0</Version>
10+
<Version>4.0.0</Version>
1111
<RepositoryUrl>https://github.com/Havunen/SystemTextJsonPatch.git</RepositoryUrl>
1212
<RepositoryType>git</RepositoryType>
1313
<AnalysisLevel>8.0-all</AnalysisLevel>

0 commit comments

Comments
 (0)