Skip to content

Commit 511a0b6

Browse files
committed
Updated JsonPatch. to JsonPatch.SystemTextJson. throughout jsonpatch.md
1 parent 6604d2c commit 511a0b6

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

aspnetcore/web-api/jsonpatch.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ This package provides a <xref:Microsoft.AspNetCore.JsonPatch.SystemTextJson.Json
6464
In an API controller, an action method for JSON Patch:
6565

6666
* Is annotated with the <xref:Microsoft.AspNetCore.Mvc.HttpPatchAttribute> attribute.
67-
* Accepts a <xref:Microsoft.AspNetCore.JsonPatch.JsonPatchDocument%601>, typically with [<xref:Microsoft.AspNetCore.Mvc.FromBodyAttribute>](xref:Microsoft.AspNetCore.Mvc.FromBodyAttribute).
68-
* Calls <xref:Microsoft.AspNetCore.JsonPatch.JsonPatchDocument.ApplyTo(System.Object)> on the patch document to apply the changes.
67+
* Accepts a <xref:Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument%601>, typically with [<xref:Microsoft.AspNetCore.Mvc.FromBodyAttribute>](xref:Microsoft.AspNetCore.Mvc.FromBodyAttribute).
68+
* Calls <xref:Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument.ApplyTo(System.Object)> on the patch document to apply the changes.
6969

7070
### Example Controller Action method:
7171

@@ -83,7 +83,7 @@ The sample action method's key steps:
8383
* The method retrieves a `Customer` object from the database `AppDb` using the provided id.
8484
* If no `Customer` object is found, it returns a `404 Not Found` response.
8585
* **Apply JSON Patch**:
86-
* The <xref:Microsoft.AspNetCore.JsonPatch.JsonPatchDocument.ApplyTo(System.Object)> method applies the JSON Patch operations from the patchDoc to the retrieved `Customer` object.
86+
* The <xref:Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument.ApplyTo(System.Object)> method applies the JSON Patch operations from the patchDoc to the retrieved `Customer` object.
8787
* If errors occur during the patch application, such as invalid operations or conflicts, they are captured by an error handling delegate. This delegate adds error messages to the `ModelState` using the type name of the affected object and the error message.
8888
* **Validate ModelState**:
8989
* After applying the patch, the method checks the `ModelState` for errors.
@@ -105,9 +105,9 @@ The following example shows the body of a `400 Bad Request` response for a JSON
105105

106106
## Apply a JSON Patch document to an object
107107

108-
The following examples demonstrate how to use the <xref:Microsoft.AspNetCore.JsonPatch.JsonPatchDocument.ApplyTo(System.Object)> method to apply a JSON Patch document to an object.
108+
The following examples demonstrate how to use the <xref:Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument.ApplyTo(System.Object)> method to apply a JSON Patch document to an object.
109109

110-
### Example: Apply a <xref:Microsoft.AspNetCore.JsonPatch.JsonPatchDocument%601> to an object
110+
### Example: Apply a <xref:Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument%601> to an object
111111

112112
The following example demonstrates:
113113

@@ -177,14 +177,14 @@ The previous example results in the following output of the updated object:
177177
}
178178
```
179179

180-
The <xref:Microsoft.AspNetCore.JsonPatch.JsonPatchDocument.ApplyTo(System.Object)> method generally follows the conventions and options of <xref:System.Text.Json> for processing the <xref:Microsoft.AspNetCore.JsonPatch.JsonPatchDocument%601>, including the behavior controlled by the following options:
180+
The <xref:Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument.ApplyTo(System.Object)> method generally follows the conventions and options of <xref:System.Text.Json> for processing the <xref:Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument%601>, including the behavior controlled by the following options:
181181

182182
* <xref:System.Text.Json.Serialization.JsonNumberHandling>: Whether numeric properties are read from strings.
183183
* <xref:System.Text.Json.JsonSerializerOptions.PropertyNameCaseInsensitive>: Whether property names are case-sensitive.
184184

185-
Key differences between <xref:System.Text.Json> and the new <xref:Microsoft.AspNetCore.JsonPatch.JsonPatchDocument%601> implementation:
185+
Key differences between <xref:System.Text.Json> and the new <xref:Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument%601> implementation:
186186

187-
* The runtime type of the target object, not the declared type, determines which properties <xref:Microsoft.AspNetCore.JsonPatch.JsonPatchDocument.ApplyTo(System.Object)> patches.
187+
* The runtime type of the target object, not the declared type, determines which properties <xref:Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument.ApplyTo(System.Object)> patches.
188188
* <xref:System.Text.Json> deserialization relies on the declared type to identify eligible properties.
189189

190190
### Example: Apply a JsonPatchDocument with error handling
@@ -196,7 +196,7 @@ JSON `Patch` supports the `test` operation, which checks if a specified value eq
196196
The following example demonstrates how to handle these errors gracefully.
197197

198198
> [!Important]
199-
> The object passed to the <xref:Microsoft.AspNetCore.JsonPatch.JsonPatchDocument.ApplyTo(System.Object)> method is modified in place. The caller is responsible for discarding changes if any operation fails.
199+
> The object passed to the <xref:Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument.ApplyTo(System.Object)> method is modified in place. The caller is responsible for discarding changes if any operation fails.
200200
201201
```csharp
202202
// Original object
@@ -274,7 +274,7 @@ To minimize security risks when integrating JSON Patch functionality into their
274274
* **Scenario**: A malicious client submits a `copy` operation that duplicates large object graphs multiple times, leading to excessive memory consumption.
275275
* **Impact**: Potential Out-Of-Memory (OOM) conditions, causing service disruptions.
276276
* **Mitigation**:
277-
* Validate incoming JSON Patch documents for size and structure before calling <xref:Microsoft.AspNetCore.JsonPatch.JsonPatchDocument.ApplyTo(System.Object)>.
277+
* Validate incoming JSON Patch documents for size and structure before calling <xref:Microsoft.AspNetCore.JsonPatch.SystemTextJson.JsonPatchDocument.ApplyTo(System.Object)>.
278278
* The validation must be app specific, but an example validation can look similar to the following:
279279

280280
```csharp

0 commit comments

Comments
 (0)