Skip to content

Commit 0f3e506

Browse files
MattEdwardsWaggleBeeReece Bradley
andcommitted
fix for issue 88 (#89)
Co-authored-by: Reece Bradley <[email protected]>
1 parent 2efcc63 commit 0f3e506

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

src/Hyperbee.Json/Patch/JsonPatch.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System.Collections;
1+
using System.Collections;
22
using System.Text.Json;
33
using System.Text.Json.Nodes;
44
using System.Text.Json.Serialization;
@@ -416,13 +416,11 @@ private static void ThrowLocationDoesNotExist( string path, JsonNode node )
416416

417417
private static JsonNode PatchValue( PatchOperation patch )
418418
{
419-
if ( patch.Value is null )
420-
throw new JsonPatchException( "The 'value' property was missing." );
421-
422419
return patch.Value switch
423420
{
424-
JsonNode node when node.Parent == null => node,
425-
JsonNode node => node.DeepClone(),
421+
null => null,
422+
JsonNode node when node.Parent != null => node.DeepClone(),
423+
JsonNode node => node,
426424
_ => JsonValue.Create( patch.Value )
427425
};
428426
}

0 commit comments

Comments
 (0)