private JsonPatchResult _Test(JsonValue json) { var value = JsonPointerFunctions.RetrieveValue(json, Path); if (ReferenceEquals(value, null)) { return(new JsonPatchResult(json, $"The path '{Path}' does not exist.")); } if (value != Value) { return(new JsonPatchResult(json, $"The value at '{Path}' is not the expected value.")); } return(new JsonPatchResult(json)); }
private JsonPatchResult _Copy(JsonValue json) { var value = JsonPointerFunctions.RetrieveValue(json, From); if (ReferenceEquals(value, null)) { return(new JsonPatchResult(json, $"The path '{Path}' does not exist.")); } var(result, success) = JsonPointerFunctions.InsertValue(json, Path, value); if (!success) { return(new JsonPatchResult(json, "Could not add the value")); } return(new JsonPatchResult(result)); }