Releases: corka149/jsonpatch
Releases · corka149/jsonpatch
Escaping, appending operations, bug fixing
- Made jsonpatch more Elixir-API-like by adding Jsonpatch.apply_patch! (which raise an exception) and changed Jsonpatch.apply_patch to return a tuple.
- Implemented escaping for '~' and '/'
- Allow usage of '-' for Add and Copy operation
- Fixed adding and copying values to array
- Improved error feedback of test operation
- Fixed: Replace operation adds error to target
- Cleaned code: Replaced strange constructs of Enum.with_index with Enum.fetch
Improved documentation
Improvement of documents (especially for hexdocs.pm)
Reviewed documentation and code
The tests were improved since last release. The documentation was also reviewed.
Error feedback
Jsonpatch provides now helpful feedback on patch error like:
iex> patch = [
...> %Jsonpatch.Operation.Add{path: "/age", value: 33},
...> %Jsonpatch.Operation.Test{path: "/name", value: "Alice"}
...> ]
iex> target = %{"name" => "Bob", "married" => false, "hobbies" => ["Sport", "Elixir", "Football"], "home" => "Berlin"}
iex> Jsonpatch.apply_patch(patch, target)
{:error, :test_failed, "Expected value 'Alice' at '/name'"}
Better documentation
It were some documentation missing.
Feature complete
Jsonpatch should included every requirement of https://tools.ietf.org/html/rfc6902 at this point.