6 Commits

Author SHA1 Message Date
lone
c293d9b61c general callback, safer API & related tests
- Changed json_pointer_set_with_array_cb to json_pointer_set_with_cb, related cb updated
- Added tests(test_safe_json_pointer_set.*) for new-exported funcs, also updated cmake & meson

Signed-off-by: lone <lonechan314@qq.com>
2026-02-09 14:01:38 +08:00
Eric Hawicz
ce3184243a Fix json_patch_apply handling of removing the whole document (i.e. "path":"").
Enable all disabled tests, add a few more including some with null documents.
2023-07-31 22:18:04 -04:00
Eric Hawicz
9dbf2880cc Adjust the behavior of the args passed to json_patch_apply to make it easier to do in place modifications, and add a struct json_patch_error to report more details on failures. 2023-07-31 22:18:04 -04:00
Eric Hawicz
a14a3a680c Fix an uninitialized memory access in json_pointer.
Add comments describing when the fields of the internal struct json_pointer_get_result are valid.
2023-07-31 22:18:03 -04:00
Eric Hawicz
efc530594b Create a json_pointer_private.h and move a few things there, fix test warnings, note array_list_insert_idx is private. 2023-07-31 22:18:03 -04:00
Alexandru Ardelean
538b046884 json_patch: add first implementation only with patch application
Initially I wanted to also do a function that generates the JSON patch from
two JSON documents, but even just applying the JSON patch was a bit of
work, especially when needing to satisfy all the test-cases.

This change defines all the operation in the RFC6902. The addition isn't
too big (for the json_patch_apply() function), as part of the heavy lifting
is also done by JSON pointer logic.

All the ops were tested with the test-cases defined at:
  https://github.com/json-patch/json-patch-tests

RFC6902: https://tools.ietf.org/html/rfc6902

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
2023-07-31 22:18:01 -04:00