Skip to content

Better public API

Compare
Choose a tag to compare
@corka149 corka149 released this 26 May 17:06
· 17 commits to master since this release
f0a41e2

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