-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[wip] take better advantage of jsonptr #45
base: main
Are you sure you want to change the base?
Conversation
@@ -72,12 +72,11 @@ fn run_patch_test_case(tc: &PatchTestCase, kind: PatchKind) -> Result<Value, Str | |||
// Patch and verify that in case of error document wasn't changed | |||
let patch: Patch = serde_json::from_value(tc.patch.clone()).map_err(|err| err.to_string())?; | |||
json_patch::patch(&mut actual, &patch) | |||
.map_err(|e| { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an incidental clippy suggestion.
Value::Array(ref mut arr) if allow_last && last_unescaped == "-" => Ok(arr.pop().unwrap()), | ||
Value::Array(ref mut arr) => { | ||
let idx = parse_index(last_unescaped, arr.len())?; | ||
// XXX: is this really correct? semantically it seems off, `-` refers to an empty position, not the last element |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@idubrov could you share some context here?
@@ -15,7 +15,8 @@ default = ["diff"] | |||
diff = [] | |||
|
|||
[dependencies] | |||
jsonptr = "0.6.0" | |||
# jsonptr = "0.6.0" | |||
jsonptr = { git = "https://github.com/asmello/jsonptr", branch = "main" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Temporary until the upstream PRs get merged
jsonptr
has been upgraded with more specialised utility functions that this crate reimplements. Let's delegate low-level string manipulation to the source crate and take advantage of the nifty new zero-copy APIs.Still work in progress. Blocking on chanced/jsonptr#80 due to a regression in catching an edge case with
+
prefixes in array indices.