Skip to content

Releases: corka149/jsonpatch

Edge cases and ignore invalid paths on opt-in

28 Feb 21:06
Compare
Choose a tag to compare
  • Cover more edge cases (notably regarding the root document)
  • Add option to ignore invalid paths

Favour maps for diffs

09 Aug 06:56
8ae3780
Compare
Choose a tag to compare

Create diffs as pure maps and do not use Jsonpatch structs

Better public API

26 May 17:06
f0a41e2
Compare
Choose a tag to compare

Changes

  • Bugfix - ADD behaviour is now compliant with RFC (insert or update)
  • Bugfix - allow usage of nil values, previous implementation used Map.get with default nil to detect if a key was not present
  • Change - COPY operation to be based on ADD operation (as per RFC)
  • Change - MOVE operation to be based on COPY+REMOVE operation (as per RFC)
  • Change - REPLACE operation to be based on REMOVE+ADD operation (as per RFC)
  • Change - Jsonpatch.apply_patch() signature changes:
    • patches can be defined as Jsonpatch.Operation.Add/Copy/Remove/... structs or with plain map conforming to the jsonpatch schema
    • error reason is now defined with a {:error, %Jsonpatch.Error{}} tuple.
      %Jsonpatch.Error{patch_index: _, path: _, reason: _} reports the patch index, the path and the reason that caused the error.
  • Removed - Jsonpatch.Mapper module, in favour of new Jsonpatch.apply_patch signature
  • Removed - Jsonpatch.Operation protocol
  • Feature - introduced new Jsonpatch.apply_patch() option keys: {:custom, convert_fn} to convert path fragments with a user specific logic
  • Improvements - increased test coverage

Fix diff creation for Remove operations

10 Aug 19:27
Compare
Choose a tag to compare

BUGFIXES:

  • Escape remaining keys before comparing them to the (already escaped) keys from earlier in the diffing process when determining Remove operations

Ready to battle

23 Jun 05:22
ccb4146
Compare
Choose a tag to compare

I know it exists but never had the time to fix it. I am talking about that patching of lists at top level never worked.
This was for me the milestone for v1.0.0. Finally it is fixed. 🥳.

Changes:

  • Allow lists at top level of Jsonpatch.apply_patch
  • Fix error message when updating a non existing key in list

Performance improvement

15 Jun 16:29
0a0f7d5
Compare
Choose a tag to compare
  • Make Jsonpatch faster by (un)escaping conditional

Allow usage of atoms

29 May 14:12
958549f
Compare
Choose a tag to compare

Now it is possible to patch maps with atoms as keys via the following options:

  • :keys - controls how parts of paths are decoded. Possible values:
    • :strings (default) - decodes parts of paths as binary strings,
    • :atoms - parts of paths are converted to atoms using String.to_atom/1,
    • :atoms! - parts of paths are converted to atoms using String.to_existing_atom/1

Better order for generated diffs

12 May 19:17
Compare
Choose a tag to compare

Generate diffs with correct order (thanks https://github.com/smartepsh)

Remove own ordering of patches before applying

12 Jan 06:53
dbdc34b
Compare
Choose a tag to compare

Previously Jsonpatch sorted the patches before applying them when they were provided as list. This was wrong.
The RFC says that they should be applied in the order as they appear in the list.

Improved patch creation by diff

05 Apr 13:06
6ebfb99
Compare
Choose a tag to compare
  • Removed module Jsonpatch.FlatMap because it is not necessary anymore and not the focus of the lib
  • Reworked creating diff to create less unnecessary data and for more accurate patches
  • Fixed adding values to empty lists (thanks https://github.com/webdeb)